[PATCH 2/2] start-statd: don't run multiple rpc.statds on the one host.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux