# CTDB_MONITOR_FREE_MEMORY_WARN=100
# CTDB_MONITOR_FREE_MEMORY=10
+# Should the 60.nfs monitor event try to correct the number of nfsd
+# threads? This works around a limitation in some NFS initscripts
+# where some threads can be stuck in host filesystem calls (perhaps
+# due to slow storage), a restart occurs, some threads don't exit, the
+# start only adds the missing number of threads, the stuck threads
+# exit, and the result is a lower than expected thread count. Note
+# that if you must also set $RPCNFSDCOUNT (RedHat/Debian) or
+# $USE_KERNEL_NFSD_NUMBER (SUSE) in your NFS configuration so the
+# monitoring code knows how many threads there should be - if neither
+# of these are set then this option will be ignored. The default is
+# to not do this check.
+# CTDB_MONITOR_NFS_THREAD_COUNT="yes"
+
# When set to yes, the CTDB node will start in DISABLED mode and not host
# any public ip addresses. The administrator needs to explicitely enable
# the node with "ctdb enable"
service_stop="startstop_nfs stop"
service_reconfigure="startstop_nfs restart"
+nfs_check_thread_count ()
+{
+ [ "$CTDB_MONITOR_NFS_THREAD_COUNT" = "yes" ] || return 0
+
+ # If $RPCNFSDCOUNT/$USE_KERNEL_NFSD_NUMBER isn't set then we could
+ # guess the default from the initscript. However, let's just
+ # assume that those using the default don't care about the number
+ # of threads and that they have switched on this feature in error.
+ _configured_threads="${RPCNFSDCOUNT:-${USE_KERNEL_NFSD_NUMBER}}"
+ [ -n "$_configured_threads" ] || return 0
+
+ # nfsd should be running the configured number of threads. If
+ # there are a different number of threads then tell nfsd the
+ # correct number.
+ _running_threads=$(get_proc "fs/nfsd/threads")
+ # Intentionally not arithmetic comparison - avoids extra errors
+ # when get_proc() fails...
+ if [ "$_running_threads" != "$_configured_threads" ] ; then
+ echo "Attempting to correct number of nfsd threads from ${_running_threads} to ${_configured_threads}"
+ set_proc "fs/nfsd/threads" "$_configured_threads"
+ fi
+}
+
loadconfig
[ "$NFS_SERVER_MODE" != "GANESHA" ] || exit 0
$cmd &
}
+ nfs_check_thread_count
+
# once every 600 seconds, update the statd state database for which
# clients need notifications
LAST_UPDATE=`stat --printf="%Y" $CTDB_VARDIR/state/statd/update-trigger 2>/dev/null`