summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2016-09-02 09:33:16 -0400
committerNiels de Vos <ndevos@redhat.com>2016-09-05 04:18:59 -0700
commit9c057750310b7e296624746bfeb909690320a2b3 (patch)
tree66a20c3c87320664ca6309632e64926682b86d7f
parent6289a0a0f0ec855a1971fdf4954d81645111e2f0 (diff)
common-ha: ganesha_mon: line 137: [: too many arguments ]" messages
ensure that there are always valid, non-null arguments to /bin/test Here there be dragons. Very racy, but if the races lose, they lose in a way that's consistent with what we're testing for anyway, namely that the ganesha.nfsd process is gone. Change-Id: I88b770dd874ffa8576711f8009f27122a4fb0130 BUG: 1363595 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/15390 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--extras/ganesha/ocf/ganesha_mon14
1 files changed, 9 insertions, 5 deletions
diff --git a/extras/ganesha/ocf/ganesha_mon b/extras/ganesha/ocf/ganesha_mon
index 7d0eb6b9cb8..7d2c268d412 100644
--- a/extras/ganesha/ocf/ganesha_mon
+++ b/extras/ganesha/ocf/ganesha_mon
@@ -125,17 +125,21 @@ ganesha_mon_stop()
ganesha_mon_monitor()
{
local host=$(hostname -s)
- local pid_file="/var/run/ganesha.nfsd.pid"
+ local pid_file="/var/run/ganesha.pid"
+ local rhel6_pid_file="/var/run/ganesha.nfsd.pid"
+ local proc_pid="/proc/"
# RHEL6 /etc/init.d/nfs-ganesha adds -p /var/run/ganesha.nfsd.pid
# RHEL7 systemd does not. Would be nice if all distros used the
# same pid file.
- if [ -e /usr/lib/systemd/system/nfs-ganesha.service ]; then
- pid_file="/var/run/ganesha.pid"
+ if [ -e ${rhel6_pid_file} ]; then
+ pid_file=${rhel6_pid_file}
+ fi
+ if [ -e ${pid_file} ]; then
+ proc_pid="${proc_pid}$(cat ${pid_file})"
fi
- if [ -e ${pid_file} -a \
- -d /proc/$(cat ${pid_file} ) ]; then
+ if [ "x${proc_pid}" != "x/proc/" -a -d ${proc_pid} ]; then
attrd_updater -n ${OCF_RESKEY_ganesha_active} -v 1
if [ $? -ne 0 ]; then