All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Steve Dickson <SteveD@RedHat.com>
Cc: Justin Mitchell <jumitche@rehat.com>, linux-nfs@vger.kernel.org
Subject: [PATCH 2/3] Let systemd know when rpc.statd is needed.
Date: Mon, 03 Dec 2018 11:58:25 +1100	[thread overview]
Message-ID: <154379870498.3215.1051796458035422926.stgit@noble> (raw)
In-Reply-To: <154379862296.3215.11174339731963464375.stgit@noble>

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>
---
 utils/statd/start-statd |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 82715b40c1af..54ced822016a 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 /



  parent reply	other threads:[~2018-12-03  0:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03  0:58 [PATCH 0/3] Three little nfs-utils fixes NeilBrown
2018-12-03  0:58 ` [PATCH 1/3] nfs.conf: allow empty assignments NeilBrown
2018-12-03  0:58 ` [PATCH 3/3] systemd: run statd-notify even when nfs-client isn't enabled NeilBrown
2018-12-03  0:58 ` NeilBrown [this message]
2018-12-10 21:26 ` [PATCH 0/3] Three little nfs-utils fixes Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=154379870498.3215.1051796458035422926.stgit@noble \
    --to=neilb@suse.com \
    --cc=SteveD@RedHat.com \
    --cc=jumitche@rehat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.