cluster: RHEL511 - fs.sh: Avoid failures caused by /tmp being full

Ryan McCabe rmccabe at fedoraproject.org
Wed Sep 18 02:26:39 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=0efa69dbc533017d02dea73646841c97fca91525
Commit:        0efa69dbc533017d02dea73646841c97fca91525
Parent:        c5a838ac74d1099ade298f1cca602e8f7bd7a283
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Tue Sep 17 22:22:13 2013 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Tue Sep 17 22:22:13 2013 -0400

fs.sh: Avoid failures caused by /tmp being full

This patch prevents fs.sh resource agent failures when /tmp is full
by eliminating the need to write a temporary file to /tmp while
parsing /proc/mounts.

This same fix has been made upstream and in RHEL6 in the filesystem
resource agent for the codepath that is hit when 'findmnt' is
either not available or not used.

Resolves: rhbz#997546

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

diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index e55e77f..5dc7000 100755
--- a/rgmanager/src/resources/fs.sh
+++ b/rgmanager/src/resources/fs.sh
@@ -560,8 +560,6 @@ mountInUse () {
 	dev=$1
 	mp=$2
 
-	typeset proc_mounts=$(mktemp /tmp/fs.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
@@ -570,8 +568,7 @@ mountInUse () {
 		if [ -n "$tmp_mp" -a "$tmp_mp" = "$mp" ]; then
 			return $YES
 		fi
-	done < $proc_mounts
-	rm -f $proc_mounts
+	done < <(cat /proc/mounts)
 
 	return $NO
 }
@@ -612,8 +609,6 @@ isMounted () {
 
 	ret=$NO
 
-	typeset proc_mounts=$(mktemp /tmp/fs.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
@@ -638,8 +633,7 @@ isMounted () {
 			fi
 			ret=$YES
 		fi
-	done < $proc_mounts
-	rm -f $proc_mounts
+	done < <(cat /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