2 # script to manage nfs in a clustered environment
4 [ -n "$CTDB_BASE" ] || \
5 export CTDB_BASE
=$
(cd -P $
(dirname "$0") ; dirname "$PWD")
14 set_proc
"sys/net/ipv4/tcp_tw_recycle" 1
20 service_reconfigure
()
22 # if the ips have been reallocated, we must restart the lockmanager
23 # across all nodes and ping all statd listeners
24 [ -x $CTDB_BASE/statd-callout
] && {
25 $CTDB_BASE/statd-callout notify
&
29 nfs_check_thread_count
()
31 [ "$CTDB_MONITOR_NFS_THREAD_COUNT" = "yes" ] ||
return 0
33 # If $RPCNFSDCOUNT/$USE_KERNEL_NFSD_NUMBER isn't set then we could
34 # guess the default from the initscript. However, let's just
35 # assume that those using the default don't care about the number
36 # of threads and that they have switched on this feature in error.
37 _configured_threads
="${RPCNFSDCOUNT:-${USE_KERNEL_NFSD_NUMBER}}"
38 [ -n "$_configured_threads" ] ||
return 0
40 # nfsd should be running the configured number of threads. If
41 # there are a different number of threads then tell nfsd the
43 _running_threads
=$
(get_proc
"fs/nfsd/threads")
44 # Intentionally not arithmetic comparison - avoids extra errors
45 # when get_proc() fails...
46 if [ "$_running_threads" != "$_configured_threads" ] ; then
47 echo "Attempting to correct number of nfsd threads from ${_running_threads} to ${_configured_threads}"
48 set_proc
"fs/nfsd/threads" "$_configured_threads"
54 [ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" != "ganesha" ] ||
exit 0
56 ctdb_setup_service_state_dir
58 ctdb_start_stop_service
60 is_ctdb_managed_service ||
exit 0
62 ctdb_service_check_reconfigure
66 # read statd from persistent database
77 ctdb_service_set_reconfigure
81 ctdb_service_set_reconfigure
85 # Check that directories for shares actually exist.
86 [ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] ||
{
87 exportfs
-v |
grep '^/' |
88 sed -r -e 's@[[:space:]]+[^[:space:]()]+\([^[:space:]()]+\)$@@' |
90 ctdb_check_directories
95 nfs_check_rpc_services
97 nfs_check_thread_count
99 # Every 10 minutes, update the statd state database for which
100 # clients need notifications
105 ctdb_standard_event_handler
"$@"