diff options
Diffstat (limited to 'ctdb')
-rwxr-xr-x | ctdb/config/events.d/60.nfs | 45 | ||||
-rwxr-xr-x | ctdb/config/nfs-ganesha-callout | 2 | ||||
-rwxr-xr-x | ctdb/config/nfs-linux-kernel-callout | 4 |
3 files changed, 45 insertions, 6 deletions
diff --git a/ctdb/config/events.d/60.nfs b/ctdb/config/events.d/60.nfs index 957d8eaab75..fce6beb9118 100755 --- a/ctdb/config/events.d/60.nfs +++ b/ctdb/config/events.d/60.nfs @@ -7,6 +7,10 @@ . $CTDB_BASE/functions service_name="nfs" +loadconfig +ctdb_setup_service_state_dir + +###################################################################### if [ -z "$CTDB_NFS_CALLOUT" ] ; then CTDB_NFS_CALLOUT="${CTDB_BASE}/nfs-linux-kernel-callout" @@ -14,9 +18,44 @@ fi # Always export, for statd callout export CTDB_NFS_CALLOUT +nfs_callout_cache="${service_state_dir}/nfs_callout_cache" +nfs_callout_cache_callout="${nfs_callout_cache}/CTDB_NFS_CALLOUT" +nfs_callout_cache_ops="${nfs_callout_cache}/ops" + +nfs_callout_register () +{ + mkdir -p "$nfs_callout_cache_ops" + rm -f "$nfs_callout_cache_ops"/* + + echo "$CTDB_NFS_CALLOUT" >"$nfs_callout_cache_callout" + + _t=$(eval "$CTDB_NFS_CALLOUT" "register") + if [ -n "$_t" ] ; then + echo "$_t" | + while IFS="" read _op ; do + touch "${nfs_callout_cache_ops}/${_op}" + done + else + touch "${nfs_callout_cache_ops}/ALL" + fi +} + nfs_callout () { - eval "$CTDB_NFS_CALLOUT" "$@" + # Re-run registration if $CTDB_NFS_CALLOUT has changed + _prev="" + if [ -r "$nfs_callout_cache_callout" ] ; then + read _prev <"$nfs_callout_cache_callout" + fi + if [ "$CTDB_NFS_CALLOUT" != "$_prev" ] ; then + nfs_callout_register + fi + + # Run the operation if it is registered... + if [ -e "${nfs_callout_cache_ops}/${1}" ] || \ + [ -e "${nfs_callout_cache_ops}/ALL" ]; then + eval "$CTDB_NFS_CALLOUT" "$@" + fi } service_reconfigure () @@ -234,10 +273,6 @@ nfs_update_lock_info () ###################################################################### -loadconfig - -ctdb_setup_service_state_dir - ctdb_start_stop_service is_ctdb_managed_service || exit 0 diff --git a/ctdb/config/nfs-ganesha-callout b/ctdb/config/nfs-ganesha-callout index 0d510e779ea..b66611c84f9 100755 --- a/ctdb/config/nfs-ganesha-callout +++ b/ctdb/config/nfs-ganesha-callout @@ -290,7 +290,7 @@ case "$action" in releaseip) nfs_releaseip "$@" ;; takeip) nfs_takeip "$@" ;; monitor-list-shares) nfs_monitor_list_shares ;; - monitor-pre|monitor-post) + register|monitor-pre|monitor-post) # Not required/implemented : ;; diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout index 59618d79dfb..31810d0f7d4 100755 --- a/ctdb/config/nfs-linux-kernel-callout +++ b/ctdb/config/nfs-linux-kernel-callout @@ -32,6 +32,7 @@ usage () usage: $_c { shutdown | startup } $_c { stop | start } { nfs | nlockmgr } $_c { monitor-list-shares | monitor-post } + $_c { register } EOF exit 1 } @@ -196,6 +197,9 @@ case "$1" in monitor-post) nfs_check_thread_count ;; + register) + : # Nothing yet + ;; monitor-pre|releaseip|takeip) # Not required/implemented : |