]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Move NFS lock manager grace hack to callout
authorMartin Schwenke <mschwenke@ddn.com>
Thu, 1 May 2025 23:15:08 +0000 (09:15 +1000)
committerVolker Lendecke <vl@samba.org>
Mon, 9 Feb 2026 11:17:41 +0000 (11:17 +0000)
The "startipreallocate" event was added so the NFS-Ganesha callout
could use it to start grace.  Use it for Linux kernel lock manager
grace too.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/config/nfs-linux-kernel-callout
ctdb/tools/statd_callout_helper

index f526e1c6342887a27e7946dc437bf52c6733a2cf..54857093138ef8db408130f7f0bf399e5b972ac7 100755 (executable)
@@ -326,6 +326,24 @@ nfs_startup()
        fi
 }
 
+##################################################
+# failover support
+
+nfs_startipreallocate()
+{
+       # Put the lock manager into grace
+       #
+       # We must let some time pass between stopping and restarting
+       # the lock manager.  Otherwise there is a window where the
+       # lock manager will respond "strangely" immediately after
+       # restarting it, which causes clients to fail to reclaim their
+       # locks.
+       nfs_callout_init
+       service_stop "nlockmgr" >/dev/null 2>&1
+       sleep 2
+       service_start "nlockmgr" >/dev/null 2>&1
+}
+
 ##################################################
 # monitor-post support
 
@@ -419,6 +437,9 @@ stop)
 start)
        service_start "$2"
        ;;
+startipreallocate)
+       nfs_startipreallocate
+       ;;
 monitor-list-shares)
        nfs_monitor_list_shares
        ;;
@@ -428,7 +449,7 @@ monitor-post)
 register)
        nfs_register
        ;;
-monitor-pre | releaseip | takeip | startipreallocate)
+monitor-pre | releaseip | takeip)
        # Not required/implemented
        :
        ;;
index b4606470cf83dc203a03433be6d24e2346296c93..6ab466f74b2b0b51bf6ed4e001d1cf9b2d39bc02 100755 (executable)
@@ -435,16 +435,6 @@ notify)
        dir=$(find_statd_sm_dir)
        rm -f "${dir}/"* "${dir}.bak/"*
 
-       # We must also let some time pass between stopping and
-       # restarting the lock manager.  Otherwise there is a window
-       # where the lock manager will respond "strangely" immediately
-       # after restarting it, which causes clients to fail to reclaim
-       # their locks.
-       nfs_callout_init
-       "$CTDB_NFS_CALLOUT" "stop" "nlockmgr" >/dev/null 2>&1
-       sleep 2
-       "$CTDB_NFS_CALLOUT" "start" "nlockmgr" >/dev/null 2>&1
-
        statd_state="${statd_callout_state_dir}/.statd_state"
        list_records >"$statd_state"