summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2016-09-06 10:01:03 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-09-07 04:49:17 -0700
commit2b2b301d6b8a9781525d938e3896069bcfc60909 (patch)
tree2a01da1a8c17a95d2f1405363ae2c91435777b95
parent7cab35488c19b2357411e0a949eabf2066a5172d (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: 1372728 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/15409 Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
-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