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 # Restart lock manager, notify clients
23 if [ -x "${CTDB_BASE}/statd-callout" ] ; then
24 "${CTDB_BASE}/statd-callout" notify &
28 nfs_check_thread_count ()
30 [ "$CTDB_MONITOR_NFS_THREAD_COUNT" = "yes" ] || return 0
32 # If $RPCNFSDCOUNT/$USE_KERNEL_NFSD_NUMBER isn't set then we could
33 # guess the default from the initscript. However, let's just
34 # assume that those using the default don't care about the number
35 # of threads and that they have switched on this feature in error.
36 _configured_threads="${RPCNFSDCOUNT:-${USE_KERNEL_NFSD_NUMBER}}"
37 [ -n "$_configured_threads" ] || return 0
39 # nfsd should be running the configured number of threads. If
40 # there are a different number of threads then tell nfsd the
42 _running_threads=$(get_proc "fs/nfsd/threads")
43 # Intentionally not arithmetic comparison - avoids extra errors
44 # when get_proc() fails...
45 if [ "$_running_threads" != "$_configured_threads" ] ; then
46 echo "Attempting to correct number of nfsd threads from ${_running_threads} to ${_configured_threads}"
47 set_proc "fs/nfsd/threads" "$_configured_threads"
53 [ "${CTDB_NFS_SERVER_MODE:-${NFS_SERVER_MODE}}" != "ganesha" ] || exit 0
55 ctdb_setup_service_state_dir
57 ctdb_start_stop_service
59 is_ctdb_managed_service || exit 0
61 ctdb_service_check_reconfigure
65 # read statd from persistent database
76 ctdb_service_set_reconfigure
80 ctdb_service_set_reconfigure
84 # Check that directories for shares actually exist.
85 [ "$CTDB_NFS_SKIP_SHARE_CHECK" = "yes" ] || {
86 exportfs -v | grep '^/' |
87 sed -r -e 's@[[:space:]]+[^[:space:]()]+\([^[:space:]()]+\)$@@' |
89 ctdb_check_directories
97 nfs_check_thread_count
101 ctdb_standard_event_handler "$@"