summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-12-05 13:43:12 -0500
committerSteve Dickson <steved@redhat.com>2018-12-10 13:38:35 -0500
commit4090cc55b7ecc8ef1cfdc5b46f8151ad4a96166a (patch)
treea4a6f3d45d65c6cd4180fa714b77aacd2fcc732b
parentb9fc99d5790283a02d27bebe911122698bee7f08 (diff)
downloadnfs-utils-4090cc55b7ecc8ef1cfdc5b46f8151ad4a96166a.tar.gz
Let systemd know when rpc.statd is needed
A recent change to set IgnoreOnIsolate for rpc-statd isn't quite sufficient (though it doesn't hurt). While rpc-statd does remain when systemctl isolate multi-user is run, its dependencies don't remain, so rpcbind might get killed, which makes rpc.statd rather useless. The reason this is all an issue is that systemd doesn't know that rpc-statd is needed - mount.nfs explicitly starts it rather than having a dependency start it. This can be rectified by explicitly telling systemd about the dependency using "systemctl add-wants". This can be done in the start-statd script, at the same time that rpc-statd is started. As --runtime dependency is used so that it doesn't persist across reboots. A new dependency will be created on next boot if an NFSv3 filesystem is mounted. With this in place, both rpc.statd and rpcbind remain. Actually, rpcbind.service is stopped, but rpcbind.socket remains, and when anything tries to contact rpcbind, rpcbind.service is automatically started and it re-reads its saved state. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rwxr-xr-xutils/statd/start-statd7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 82715b4..54ced82 100755
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -20,7 +20,12 @@ fi
# First try systemd if it's installed.
if [ -d /run/systemd/system ]; then
# Quit only if the call worked.
- systemctl start rpc-statd.service && exit
+ if systemctl start rpc-statd.service; then
+ # Ensure systemd knows not to stop rpc.statd or its dependencies
+ # on 'systemctl isolate ..'
+ systemctl add-wants --runtime remote-fs.target rpc-statd.service
+ exit 0
+ fi
fi
cd /