cluster: RHEL58 - rgmanager: Fix for reading /proc/mounts in fs.sh

Ryan McCabe rmccabe at fedoraproject.org
Thu Aug 30 13:23:42 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=bdf0650eb61104933d76a4b74adc12c37ac3511a
Commit:        bdf0650eb61104933d76a4b74adc12c37ac3511a
Parent:        790a470007b24c94089d2d97f18f5664c6ddaada
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Wed Aug 29 09:54:56 2012 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Thu Aug 30 09:23:18 2012 -0400

rgmanager: Fix for reading /proc/mounts in fs.sh

This patch fixes a problem with the fs resource agent
that caused status checks to mistakenly fail as a result
of /proc/mounts changing while it was being read.

Patch from John Ruemker <jruemker at redhat.com>

Resolves rhbz#852865

Reviewed-by: Ryan McCabe <rmccabe at redhat.com>
Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/resources/fs.sh |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index a98cddc..7e6898c 100755
--- a/rgmanager/src/resources/fs.sh
+++ b/rgmanager/src/resources/fs.sh
@@ -560,6 +560,8 @@ mountInUse () {
 	dev=$1
 	mp=$2
 
+	typeset proc_mounts=$(mktemp /tmp/fs-$OCF_RESKEY_name.proc.mounts.XXXXXX)
+	cat /proc/mounts > $proc_mounts
 	while read tmp_dev tmp_mp junka junkb junkc junkd; do
 		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
 			return $YES
@@ -568,7 +570,8 @@ mountInUse () {
 		if [ -n "$tmp_mp" -a "$tmp_mp" = "$mp" ]; then
 			return $YES
 		fi
-	done < /proc/mounts
+	done < $proc_mounts
+	rm -f $proc_mounts
 
 	return $NO
 }
@@ -609,6 +612,8 @@ isMounted () {
 
 	ret=$NO
 
+	typeset proc_mounts=$(mktemp /tmp/fs-$OCF_RESKEY_name.proc.mounts.XXXXXX)
+	cat /proc/mounts > $proc_mounts
 	while read tmp_dev tmp_mp junk_a junk_b junk_c junk_d
 	do
 		real_device $tmp_dev
@@ -633,7 +638,8 @@ isMounted () {
 			fi
 			ret=$YES
 		fi
-	done < /proc/mounts
+	done < $proc_mounts
+	rm -f $proc_mounts
 
 	if [ $ret -eq $YES ] && [ $found -ne 0 ]; then
 		ocf_log warn "Device $dev is mounted on $poss_mp instead of $mp"


More information about the cluster-commits mailing list