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

Ryan McCabe rmccabe at fedoraproject.org
Wed Sep 18 13:58:52 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=d0c5a3be2b15eedfc4c964d91f71a5d51c238fb2
Commit:        d0c5a3be2b15eedfc4c964d91f71a5d51c238fb2
Parent:        7c1eff97fde6b899904a97e366380a470c3f50a3
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Tue Sep 17 22:22:13 2013 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Wed Sep 18 09:58:35 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#1009245

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