All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host.
Date: Thu, 17 Dec 2015 15:27:34 +1100	[thread overview]
Message-ID: <20151217042734.7581.45571.stgit@noble> (raw)
In-Reply-To: <20151217042613.7581.1566.stgit@noble>

If rpc.statd is running but slow to respond, mount.nfs will
run "start-statd" which might start a new statd.  This is not a good
ideas as can result in lots of rpc.statds.

So inf start-statd check the pid file and if rpc.statd seems to be
running, exit with success.

(also "cd /" before running rpc.statd, just in case).

Signed-off-by: NeilBrown <neilb@suse.com>
---
 utils/statd/start-statd |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 14369e515cb2..19e6eb21d044 100755
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -6,11 +6,19 @@
 # site.
 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
 
+if [ -s /var/run/rpc.statd.pid ] &&
+       [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] &&
+       kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1
+then
+    # statd already running - must have been slow to respond.
+    exit 0
+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
 fi
 
+cd /
 # Fall back to launching it ourselves.
 exec rpc.statd --no-notify



  parent reply	other threads:[~2015-12-17  4:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  4:27 [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive NeilBrown
2015-12-17  4:27 ` [PATCH 1/2] mount.nfs: trust the exit status of "start_statd" NeilBrown
2015-12-17  4:27 ` NeilBrown [this message]
2016-01-16 21:58 ` [PATCH nfs-utils 0/2] Fix problems caused by rpc.statd being unresponsive 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=20151217042734.7581.45571.stgit@noble \
    --to=neilb@suse.com \
    --cc=SteveD@redhat.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.