From 2b2b301d6b8a9781525d938e3896069bcfc60909 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Tue, 6 Sep 2016 10:01:03 -0400 Subject: 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 Reviewed-on: http://review.gluster.org/15409 Reviewed-by: Niels de Vos CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Smoke: Gluster Build System --- extras/ganesha/ocf/ganesha_mon | 14 +++++++++----- 1 file 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 -- cgit