The Samba-Bugzilla – Attachment 15041 Details for
Bug 13860
CTDB restarts failed NFS RPC services by hand, which is incompatible with systemd
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.9 and 4.10
BZ13860.patch (text/plain), 25.25 KB, created by
Martin Schwenke
on 2019-04-03 06:04:23 UTC
(
hide
)
Description:
Patch for 4.9 and 4.10
Filename:
MIME Type:
Creator:
Martin Schwenke
Created:
2019-04-03 06:04:23 UTC
Size:
25.25 KB
patch
obsolete
>From 30acdb474650b82b441d3f5a3d2e3585798f30b4 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Mon, 18 Mar 2019 14:42:36 +1100 >Subject: [PATCH 01/11] ctdb-scripts: Reindent some functions prior to making > changes > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit d7e187c1a7046196ec96637bdc14cc6b042eafcc) >--- > ctdb/config/nfs-linux-kernel-callout | 88 ++++++++++++++-------------- > 1 file changed, 44 insertions(+), 44 deletions(-) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index 9b72446b44e..295989cd0ff 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -52,44 +52,44 @@ EOF > > basic_stop () > { >- case "$1" in >+ case "$1" in > nfs) >- service "$nfs_service" stop >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" stop >- fi >- ;; >- nfslock) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" stop >- else > service "$nfs_service" stop >- fi >- ;; >+ if [ -n "$nfslock_service" ] ; then >+ service "$nfslock_service" stop >+ fi >+ ;; >+ nfslock) >+ if [ -n "$nfslock_service" ] ; then >+ service "$nfslock_service" stop >+ else >+ service "$nfs_service" stop >+ fi >+ ;; > *) >- usage >- esac >+ usage >+ esac > } > > basic_start () > { >- case "$1" in >+ case "$1" in > nfs) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" start >- fi >- service "$nfs_service" start >- ;; >- nfslock) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" start >- else >+ if [ -n "$nfslock_service" ] ; then >+ service "$nfslock_service" start >+ fi > service "$nfs_service" start >- fi >- ;; >+ ;; >+ nfslock) >+ if [ -n "$nfslock_service" ] ; then >+ service "$nfslock_service" start >+ else >+ service "$nfs_service" start >+ fi >+ ;; > *) >- usage >- esac >+ usage >+ esac > } > > ################################################## >@@ -97,32 +97,32 @@ basic_start () > > service_stop () > { >- case "$1" in >+ case "$1" in > nfs) >- echo 0 >"${PROCFS_PATH}/fs/nfsd/threads" >- basic_stop "nfs" >/dev/null 2>&1 || true >- pkill -9 nfsd >- ;; >+ echo 0 >"${PROCFS_PATH}/fs/nfsd/threads" >+ basic_stop "nfs" >/dev/null 2>&1 || true >+ pkill -9 nfsd >+ ;; > nlockmgr) >- basic_stop "nfslock" >/dev/null 2>&1 || true >- ;; >+ basic_stop "nfslock" >/dev/null 2>&1 || true >+ ;; > *) >- usage >- esac >+ usage >+ esac > } > > service_start () > { >- case "$1" in >+ case "$1" in > nfs) >- basic_start "nfs" >- ;; >+ basic_start "nfs" >+ ;; > nlockmgr) >- basic_start "nfslock" >- ;; >+ basic_start "nfslock" >+ ;; > *) >- usage >- esac >+ usage >+ esac > } > > ################################################## >-- >2.20.1 > > >From 184a887844d204460f4d01a8b53e6c50b7a5f058 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 14:50:59 +1100 >Subject: [PATCH 02/11] ctdb-scripts: Rename variable nfslock_service to > nfs_lock_service > >There will be more of these variable for other services so, for >readability, it makes sense for them to start with "nfs_". > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 9981353ab79dce81b698c535977be4a681119d1e) >--- > ctdb/config/nfs-linux-kernel-callout | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index 295989cd0ff..73623d87875 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -14,17 +14,17 @@ nfs_exports_file="${CTDB_NFS_EXPORTS_FILE:-/var/lib/nfs/etab}" > > # Red Hat > nfs_service="nfs" >-nfslock_service="nfslock" >+nfs_lock_service="nfslock" > nfs_config="/etc/sysconfig/nfs" > > # SUSE > #nfs_service="nfsserver" >-#nfslock_service="" >+#nfs_lock_service="" > #nfs_config="/etc/sysconfig/nfs" > > # Debian > #nfs_service="nfs-kernel-server" >-#nfslock_service="" >+#nfs_lock_service="" > #nfs_config="/etc/default/nfs-kernel-server" > > # Override for unit testing >@@ -55,13 +55,13 @@ basic_stop () > case "$1" in > nfs) > service "$nfs_service" stop >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" stop >+ if [ -n "$nfs_lock_service" ] ; then >+ service "$nfs_lock_service" stop > fi > ;; > nfslock) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" stop >+ if [ -n "$nfs_lock_service" ] ; then >+ service "$nfs_lock_service" stop > else > service "$nfs_service" stop > fi >@@ -75,14 +75,14 @@ basic_start () > { > case "$1" in > nfs) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" start >+ if [ -n "$nfs_lock_service" ] ; then >+ service "$nfs_lock_service" start > fi > service "$nfs_service" start > ;; > nfslock) >- if [ -n "$nfslock_service" ] ; then >- service "$nfslock_service" start >+ if [ -n "$nfs_lock_service" ] ; then >+ service "$nfs_lock_service" start > else > service "$nfs_service" start > fi >-- >2.20.1 > > >From 6420042d8eaca6c719d752360fdf991b370ac47c Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 26 Mar 2019 14:49:49 +1100 >Subject: [PATCH 03/11] ctdb-scripts: Add test variable CTDB_NFS_DISTRO_STYLE > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit e72c3c800a50fe746164e319e21180c44d041619) >--- > ctdb/config/nfs-linux-kernel-callout | 46 +++++++++++++++++++--------- > 1 file changed, 32 insertions(+), 14 deletions(-) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index 73623d87875..bd534c41a32 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -12,20 +12,38 @@ set -e > # hook for testing. > nfs_exports_file="${CTDB_NFS_EXPORTS_FILE:-/var/lib/nfs/etab}" > >-# Red Hat >-nfs_service="nfs" >-nfs_lock_service="nfslock" >-nfs_config="/etc/sysconfig/nfs" >- >-# SUSE >-#nfs_service="nfsserver" >-#nfs_lock_service="" >-#nfs_config="/etc/sysconfig/nfs" >- >-# Debian >-#nfs_service="nfs-kernel-server" >-#nfs_lock_service="" >-#nfs_config="/etc/default/nfs-kernel-server" >+# As above, edit the default value below. CTDB_NFS_DISTRO_STYLE is a >+# test variable only. >+nfs_distro_style="${CTDB_NFS_DISTRO_STYLE:-sysvinit-redhat}" >+ >+case "$nfs_distro_style" in >+sysvinit-*) >+ # Defaults >+ nfs_service="nfs" >+ nfs_lock_service="" >+ nfs_config="/etc/sysconfig/nfs" >+ >+ case "$nfs_distro_style" in >+ *-redhat) >+ nfs_lock_service="nfslock" >+ ;; >+ *-suse) >+ nfs_service="nfsserver" >+ ;; >+ *-debian) >+ nfs_service="nfs-kernel-server" >+ nfs_config="/etc/default/nfs-kernel-server" >+ ;; >+ *) >+ echo "Internal error" >+ exit 1 >+ esac >+ ;; >+ >+*) >+ echo "Internal error" >+ exit 1 >+esac > > # Override for unit testing > if [ -z "$PROCFS_PATH" ] ; then >-- >2.20.1 > > >From 01d325e160fdab1ebe12cf9c30e6077b61a25dce Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 16:11:32 +1100 >Subject: [PATCH 04/11] ctdb-scripts: Factor out nfs_load_config() > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 8de0a339b550e7363d265af04ad69f2179af75c6) >--- > ctdb/config/nfs-linux-kernel-callout | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index bd534c41a32..ca7e2b88e96 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -64,6 +64,16 @@ EOF > exit 1 > } > >+################################################## >+ >+nfs_load_config () >+{ >+ _config="${1:-${nfs_config}}" >+ >+ if [ -r "$_config" ] ; then >+ . "$_config" >+ fi >+} > > ################################################## > # Basic service stop and start >@@ -167,9 +177,7 @@ nfs_startup () > nfs_check_thread_count () > { > # Load NFS configuration to get desired number of threads. >- if [ -r "$nfs_config" ] ; then >- . "$nfs_config" >- fi >+ nfs_load_config > > # If $RPCNFSDCOUNT/$USE_KERNEL_NFSD_NUMBER isn't set then we could > # guess the default from the initscript. However, let's just >-- >2.20.1 > > >From 3b70668c6d396ede8ddf22a8e0a61c50a22706d1 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 17:35:44 +1100 >Subject: [PATCH 05/11] ctdb-scripts: Stop/start mount/rquotad/status via NFS > call-out > >When an NFS check restarts a failed service by hand then systemd will >be unable to stop or start this service again because (at least) the >PID file will be wrong. Do this via the NFS Linux kernel call-out >instead. Allow the call-out to use the services instead of doing >manual restarts. Add variables for mount, status and rquotad services >to support this. > >Adding systemd NFS services to the call-out will follow. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 42103b568698d8087d27f0848b402ccb7cfac86b) >--- > ctdb/config/nfs-checks.d/10.status.check | 4 +- > ctdb/config/nfs-checks.d/40.mountd.check | 4 +- > ctdb/config/nfs-checks.d/50.rquotad.check | 4 +- > ctdb/config/nfs-linux-kernel-callout | 82 +++++++++++++++++++++++ > 4 files changed, 88 insertions(+), 6 deletions(-) > >diff --git a/ctdb/config/nfs-checks.d/10.status.check b/ctdb/config/nfs-checks.d/10.status.check >index dfa5c59117e..b8ce1e0ad0b 100644 >--- a/ctdb/config/nfs-checks.d/10.status.check >+++ b/ctdb/config/nfs-checks.d/10.status.check >@@ -2,6 +2,6 @@ > version="1" > restart_every=2 > unhealthy_after=6 >-service_stop_cmd="killall -q -9 rpc.statd" >-service_start_cmd="rpc.statd ${STATD_HA_CALLOUT:+-H} $STATD_HA_CALLOUT ${STATD_HOSTNAME:+-n} $STATD_HOSTNAME ${STATD_PORT:+-p} $STATD_PORT ${STATD_OUTGOING_PORT:+-o} $STATD_OUTGOING_PORT" >+service_stop_cmd="$CTDB_NFS_CALLOUT stop status" >+service_start_cmd="$CTDB_NFS_CALLOUT start status" > service_debug_cmd="program_stack_traces rpc.statd 5" >diff --git a/ctdb/config/nfs-checks.d/40.mountd.check b/ctdb/config/nfs-checks.d/40.mountd.check >index 56b3fd29512..bfe4c277ce9 100644 >--- a/ctdb/config/nfs-checks.d/40.mountd.check >+++ b/ctdb/config/nfs-checks.d/40.mountd.check >@@ -2,6 +2,6 @@ > version="1" > restart_every=2 > unhealthy_after=6 >-service_stop_cmd="killall -q -9 rpc.mountd" >-service_start_cmd="rpc.mountd $RPCMOUNTDOPTS ${MOUNTD_PORT:+-p} $MOUNTD_PORT" >+service_stop_cmd="$CTDB_NFS_CALLOUT stop mountd" >+service_start_cmd="$CTDB_NFS_CALLOUT start mountd" > service_debug_cmd="program_stack_traces rpc.mountd 5" >diff --git a/ctdb/config/nfs-checks.d/50.rquotad.check b/ctdb/config/nfs-checks.d/50.rquotad.check >index b7bd9d2c757..98bd8d98fce 100644 >--- a/ctdb/config/nfs-checks.d/50.rquotad.check >+++ b/ctdb/config/nfs-checks.d/50.rquotad.check >@@ -2,6 +2,6 @@ > version="1" > restart_every=2 > unhealthy_after=6 >-service_stop_cmd="killall -q -9 rpc.rquotad" >-service_start_cmd="rpc.rquotad ${RQUOTAD_PORT:+-p} $RQUOTAD_PORT" >+service_stop_cmd="$CTDB_NFS_CALLOUT stop rquotad" >+service_start_cmd="$CTDB_NFS_CALLOUT start rquotad" > service_debug_cmd="program_stack_traces rpc.rquotad 5" >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index ca7e2b88e96..74f7f0a16b0 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -21,7 +21,11 @@ sysvinit-*) > # Defaults > nfs_service="nfs" > nfs_lock_service="" >+ nfs_mountd_service="" >+ nfs_status_service="" >+ nfs_rquotad_service="" > nfs_config="/etc/sysconfig/nfs" >+ nfs_rquotad_config="$nfs_config" > > case "$nfs_distro_style" in > *-redhat) >@@ -33,6 +37,7 @@ sysvinit-*) > *-debian) > nfs_service="nfs-kernel-server" > nfs_config="/etc/default/nfs-kernel-server" >+ nfs_rquotad_config="/etc/default/quota" > ;; > *) > echo "Internal error" >@@ -134,6 +139,33 @@ service_stop () > nlockmgr) > basic_stop "nfslock" >/dev/null 2>&1 || true > ;; >+ mountd) >+ if [ -n "$nfs_mountd_service" ] ; then >+ service "$nfs_mountd_service" stop >+ return >+ fi >+ >+ # Default to stopping by hand >+ killall -q -9 rpc.mountd >+ ;; >+ rquotad) >+ if [ -n "$nfs_rquotad_service" ] ; then >+ service "$nfs_rquotad_service" stop >+ return >+ fi >+ >+ # Default to stopping by hand >+ killall -q -9 rpc.rquotad >+ ;; >+ status) >+ if [ -n "$nfs_status_service" ] ; then >+ service "$nfs_status_service" stop >+ return >+ fi >+ >+ # Default to stopping by hand >+ killall -q -9 rpc.statd >+ ;; > *) > usage > esac >@@ -148,6 +180,56 @@ service_start () > nlockmgr) > basic_start "nfslock" > ;; >+ mountd) >+ if [ -n "$nfs_mountd_service" ] ; then >+ service "$nfs_mountd_service" start >+ return >+ fi >+ >+ # Default to starting by hand >+ nfs_load_config >+ if [ -z "$RPCMOUNTDOPTS" ] ; then >+ RPCMOUNTDOPTS="${MOUNTD_PORT:+-p }$MOUNTD_PORT" >+ fi >+ # shellcheck disable=SC2086 >+ rpc.mountd $RPCMOUNTDOPTS >+ ;; >+ rquotad) >+ if [ -n "$nfs_rquotad_service" ] ; then >+ service "$nfs_rquotad_service" start >+ return >+ fi >+ >+ # Default to starting by hand >+ nfs_load_config "$nfs_rquotad_config" >+ if [ -z "$RPCRQUOTADOPTS" ] ; then >+ RPCRQUOTADOPTS="${RQUOTAD_PORT:+-p }$RQUOTAD_PORT" >+ fi >+ # shellcheck disable=SC2086 >+ rpc.rquotad $RPCRQUOTADOPTS >+ ;; >+ status) >+ if [ -n "$nfs_status_service" ] ; then >+ service "$nfs_status_service" start >+ return >+ fi >+ >+ # Default to starting by hand >+ nfs_load_config >+ # Red Hat uses STATDARG, Debian uses STATDOPTS >+ opts="${STATDARG:-${STATDOPTS:-''}}" >+ if [ -z "$opts" ] ; then >+ # shellcheck disable=SC2086 >+ set -- \ >+ ${STATD_HA_CALLOUT:+-H} $STATD_HA_CALLOUT \ >+ ${STATD_HOSTNAME:+-n} $STATD_HOSTNAME \ >+ ${STATD_PORT:+-p} $STATD_PORT \ >+ ${STATD_OUTGOING_PORT:+-o} $STATD_OUTGOING_PORT >+ opts="$*" >+ fi >+ # shellcheck disable=SC2086 >+ rpc.statd $opts >+ ;; > *) > usage > esac >-- >2.20.1 > > >From 1516ec1bd060319a8d6d7914e637afe8ae0788f3 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Thu, 21 Mar 2019 15:30:00 +1100 >Subject: [PATCH 06/11] ctdb-scripts: Start NFS quota service if defined > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 708c04071af8d6ddc3bf2bddbde4d5847f440c0e) >--- > ctdb/config/nfs-linux-kernel-callout | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index 74f7f0a16b0..ae1e4d5a7af 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -87,7 +87,12 @@ basic_stop () > { > case "$1" in > nfs) >+ if [ -n "$nfs_rquotad_service" ] ; then >+ service "$nfs_rquotad_service" stop >+ fi >+ > service "$nfs_service" stop >+ > if [ -n "$nfs_lock_service" ] ; then > service "$nfs_lock_service" stop > fi >@@ -111,7 +116,12 @@ basic_start () > if [ -n "$nfs_lock_service" ] ; then > service "$nfs_lock_service" start > fi >+ > service "$nfs_service" start >+ >+ if [ -n "$nfs_rquotad_service" ] ; then >+ service "$nfs_rquotad_service" start >+ fi > ;; > nfslock) > if [ -n "$nfs_lock_service" ] ; then >-- >2.20.1 > > >From e972e437c594fc3b927ba6bee38a620767a0934b Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 17:45:10 +1100 >Subject: [PATCH 07/11] ctdb-scripts: Add systemd services to NFS call-out > >At least Red Hat and Debian appear to use (a variant of?) the upstream >systemd units for NFS, so adding support for these services is >relatively easy. Distributions using Sys-V init can patch the >call-out to use the relevant Sys-V init services. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit a8fafd377ff0cb07ab161e437c5fe024704345eb) >--- > ctdb/config/nfs-linux-kernel-callout | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index ae1e4d5a7af..3d1dc63c590 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -17,6 +17,29 @@ nfs_exports_file="${CTDB_NFS_EXPORTS_FILE:-/var/lib/nfs/etab}" > nfs_distro_style="${CTDB_NFS_DISTRO_STYLE:-sysvinit-redhat}" > > case "$nfs_distro_style" in >+systemd-*) >+ # Defaults >+ nfs_service="nfs-server" >+ nfs_lock_service="rpc-statd" >+ nfs_mountd_service="nfs-mountd" >+ nfs_status_service="rpc-statd" >+ nfs_rquotad_service="rpc-rquotad" >+ nfs_config="/etc/sysconfig/nfs" >+ nfs_rquotad_config="" # Not use with systemd, restart via service >+ >+ case "$nfs_distro_style" in >+ *-redhat|*-suse) >+ : # Defaults only >+ ;; >+ *-debian) >+ nfs_rquotad_service="quotarpc" >+ ;; >+ *) >+ echo "Internal error" >+ exit 1 >+ esac >+ ;; >+ > sysvinit-*) > # Defaults > nfs_service="nfs" >-- >2.20.1 > > >From 42ec4f634c90ba4e8099f20f3b839972fa56980a Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 26 Mar 2019 15:07:43 +1100 >Subject: [PATCH 08/11] ctdb-tests: Update NFS test infrastructure to support > systemd services > >The tests are written around the default of sysvinit-redhat. Add >support for systemd-redhat. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 2833ddcfcb780497264e0f412a9ad6e26a9bc657) >--- > ctdb/tests/eventscripts/scripts/60.nfs.sh | 99 +++++++++++++++++++++-- > 1 file changed, 93 insertions(+), 6 deletions(-) > >diff --git a/ctdb/tests/eventscripts/scripts/60.nfs.sh b/ctdb/tests/eventscripts/scripts/60.nfs.sh >index 15670e76910..0b206399d00 100644 >--- a/ctdb/tests/eventscripts/scripts/60.nfs.sh >+++ b/ctdb/tests/eventscripts/scripts/60.nfs.sh >@@ -5,6 +5,11 @@ setup () > > service_name="nfs" > >+ if [ -z "$CTDB_NFS_DISTRO_STYLE" ] ; then >+ # Currently supported: sysvinit-redhat, systemd-redhat >+ CTDB_NFS_DISTRO_STYLE="sysvinit-redhat" >+ fi >+ > export FAKE_RPCINFO_SERVICES="" > > setup_script_options <<EOF >@@ -20,8 +25,18 @@ EOF > Setting up NFS environment: all RPC services up, NFS managed by CTDB > EOF > >- service "nfs" force-started >- service "nfslock" force-started >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ sysvinit-*) >+ service "nfs" force-started >+ service "nfslock" force-started >+ ;; >+ systemd-*) >+ service "nfs-service" force-started >+ service "nfs-mountd" force-started >+ service "rpc-rquotad" force-started >+ service "rpc-statd" force-started >+ ;; >+ esac > > rpc_services_up \ > "portmapper" "nfs" "mountd" "rquotad" \ >@@ -34,8 +49,18 @@ EOF > Setting up NFS environment: all RPC services down, NFS not managed by CTDB > EOF > >- service "nfs" force-stopped >- service "nfslock" force-stopped >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ sysvinit-*) >+ service "nfs" force-stopped >+ service "nfslock" force-stopped >+ ;; >+ systemd-*) >+ service "nfs-server" force-stopped >+ service "nfs-mountd" force-stopped >+ service "rpc-quotad" force-stopped >+ service "rpc-statd" force-stopped >+ ;; >+ esac > fi > > # This is really nasty. However, when we test NFS we don't >@@ -103,13 +128,73 @@ guess_output () > { > case "$1" in > $CTDB_NFS_CALLOUT\ start\ nlockmgr) >- echo "&Starting nfslock: OK" >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ sysvinit-redhat) >+ echo "&Starting nfslock: OK" >+ ;; >+ systemd-redhat) >+ echo "&Starting rpc-statd: OK" >+ ;; >+ esac > ;; > $CTDB_NFS_CALLOUT\ start\ nfs) >- cat <<EOF >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ sysvinit-redhat) >+ cat <<EOF > &Starting nfslock: OK > &Starting nfs: OK > EOF >+ ;; >+ systemd-redhat) >+ cat <<EOF >+&Starting rpc-statd: OK >+&Starting nfs-server: OK >+&Starting rpc-rquotad: OK >+EOF >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ stop\ mountd) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-*) >+ echo "Stopping nfs-mountd: OK" >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ stop\ rquotad) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-redhat) >+ echo "Stopping rpc-rquotad: OK" >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ stop\ status) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-*) >+ echo "Stopping rpc-statd: OK" >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ start\ mountd) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-*) >+ echo "&Starting nfs-mountd: OK" >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ start\ rquotad) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-redhat) >+ echo "&Starting rpc-rquotad: OK" >+ ;; >+ esac >+ ;; >+ $CTDB_NFS_CALLOUT\ start\ status) >+ case "$CTDB_NFS_DISTRO_STYLE" in >+ systemd-*) >+ echo "&Starting rpc-statd: OK" >+ ;; >+ esac > ;; > *) > : # Nothing >@@ -202,6 +287,8 @@ program $_rpc_service${_ver:+ version }${_ver} is not available" > echo "Trying to restart service \"${_rpc_service}\"..."\ > >>"$_out" > >+ guess_output "$service_stop_cmd" >>"$_out" >+ > if [ -n "$service_debug_cmd" ] ; then > $service_debug_cmd 2>&1 >>"$_out" > fi >-- >2.20.1 > > >From 36256faec0e97f19608b8fb03944e57a5e584198 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 21:19:49 +1100 >Subject: [PATCH 09/11] ctdb-scripts: Allow load_system_config() to take > multiple alternatives > >The situation for NFS config has got more complicated and is probably >broken in statd-callout on Debian-like systems at the moment. Allow >several alternative configuration names to be tried. Stop after the >first that is found and loaded. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit 0d67ea5fcca766734ecc73ad6b0139f7c13a15c5) >--- > ctdb/config/functions | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > >diff --git a/ctdb/config/functions b/ctdb/config/functions >index 7a47c9d8e79..1dc16532890 100755 >--- a/ctdb/config/functions >+++ b/ctdb/config/functions >@@ -33,15 +33,16 @@ fi > > load_system_config () > { >- if [ -z "$1" ] ; then >- return >- fi >- >- if [ -f "${CTDB_SYS_ETCDIR}/sysconfig/$1" ]; then >- . "${CTDB_SYS_ETCDIR}/sysconfig/$1" >- elif [ -f "${CTDB_SYS_ETCDIR}/default/$1" ]; then >- . "${CTDB_SYS_ETCDIR}/default/$1" >- fi >+ for _i ; do >+ >+ if [ -f "${CTDB_SYS_ETCDIR}/sysconfig/${_i}" ]; then >+ . "${CTDB_SYS_ETCDIR}/sysconfig/${_i}" >+ return >+ elif [ -f "${CTDB_SYS_ETCDIR}/default/${_i}" ]; then >+ . "${CTDB_SYS_ETCDIR}/default/${_i}" >+ return >+ fi >+ done > } > > # load_script_options [ component script ] >-- >2.20.1 > > >From 494b67c8abd4628a4d4f122bbcb4007e95cceec8 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Wed, 20 Mar 2019 21:22:43 +1100 >Subject: [PATCH 10/11] ctdb-scripts: Update statd-callout to try several > configuration files > >The alternative seems to be to try something via CTDB_NFS_CALLOUT. >That would be complicated and seems like overkill for something this >simple. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> >(cherry picked from commit a2bd4085896804ee2da811e17f18c78a5bf4e658) >--- > ctdb/config/statd-callout | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout >index bf18b5586b3..b75135bbde5 100755 >--- a/ctdb/config/statd-callout >+++ b/ctdb/config/statd-callout >@@ -20,7 +20,8 @@ die () > exit 1 > } > >-load_system_config "nfs" >+# Try different variables to find config file for NFS_HOSTNAME >+load_system_config "nfs" "nfs-common" > > [ -n "$NFS_HOSTNAME" ] || \ > die "NFS_HOSTNAME is not configured. statd-callout failed" >-- >2.20.1 > > >From 24c683880cd857478607cabb52af95975ca86162 Mon Sep 17 00:00:00 2001 >From: Martin Schwenke <martin@meltin.net> >Date: Tue, 26 Mar 2019 14:15:33 +1100 >Subject: [PATCH 11/11] ctdb-scripts: Do not "correct" number of nfsd threads > when it is 0 > >While 0 may indicate that all threads have exited after being stuck, >it may also indicate that nfsd should not be running due to being shut >down. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13860 > >Signed-off-by: Martin Schwenke <martin@meltin.net> >Reviewed-by: Amitay Isaacs <amitay@samba.org> > >Autobuild-User(master): Martin Schwenke <martins@samba.org> >Autobuild-Date(master): Sun Mar 31 11:47:44 UTC 2019 on sn-devel-144 > >(cherry picked from commit f1a1c300e192d43f5c9faf9450ffbf16341a2661) >--- > ctdb/config/nfs-linux-kernel-callout | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/ctdb/config/nfs-linux-kernel-callout b/ctdb/config/nfs-linux-kernel-callout >index 3d1dc63c590..945a640aa52 100755 >--- a/ctdb/config/nfs-linux-kernel-callout >+++ b/ctdb/config/nfs-linux-kernel-callout >@@ -313,8 +313,10 @@ nfs_check_thread_count () > > # Intentionally not arithmetic comparison - avoids extra errors > # when above read fails in an unexpected way... >- if [ "$_running_threads" != "$_configured_threads" ] ; then >- echo "Attempting to correct number of nfsd threads from ${_running_threads} to ${_configured_threads}" >+ if [ "$_running_threads" != "0" ] && \ >+ [ "$_running_threads" != "$_configured_threads" ] ; then >+ printf 'Attempting to correct number of nfsd threads from %s to %s\n' \ >+ "$_running_threads" "$_configured_threads" > echo "$_configured_threads" >"$_threads_file" > fi > } >-- >2.20.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13860
:
15041
|
15052