Blame SOURCES/nfs-utils-1.3.0-start-statd-once.patch

e19a30
diff -up nfs-utils-1.3.0/utils/statd/start-statd.orig nfs-utils-1.3.0/utils/statd/start-statd
e19a30
--- nfs-utils-1.3.0/utils/statd/start-statd.orig	2016-04-14 14:16:47.608999000 -0400
e19a30
+++ nfs-utils-1.3.0/utils/statd/start-statd	2016-04-26 11:04:26.019962000 -0400
e19a30
@@ -1,4 +1,4 @@
e19a30
-#!/bin/bash -p
e19a30
+#!/bin/sh
e19a30
 # nfsmount calls this script when mounting a filesystem with locking
e19a30
 # enabled, but when statd does not seem to be running (based on
e19a30
 # /var/run/rpc.statd.pid).
e19a30
@@ -6,11 +6,19 @@
e19a30
 # site.
e19a30
 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
e19a30
 
e19a30
+if [ -s /var/run/rpc.statd.pid ] &&
e19a30
+       [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] &&
e19a30
+       kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1
e19a30
+then
e19a30
+    # statd already running - must have been slow to respond.
e19a30
+    exit 0
e19a30
+fi
e19a30
 # First try systemd if it's installed.
e19a30
 if [ -d /run/systemd/system ]; then
e19a30
-	# Quit only if the call worked.
e19a30
-	systemctl start rpc-statd.service && exit
e19a30
+    # Quit only if the call worked.
e19a30
+    systemctl start rpc-statd.service && exit
e19a30
 fi
e19a30
 
e19a30
+cd /
e19a30
 # Fall back to launching it ourselves.
e19a30
 exec rpc.statd --no-notify