From: Ryan McCabe <rmccabe@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Fix for reading /proc/mounts in fs.sh
Date: Wed, 29 Aug 2012 09:57:41 -0400 [thread overview]
Message-ID: <20120829135738.GA89550@redhat.com> (raw)
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@redhat.com>
Resolves rhbz#847125
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
rgmanager/src/resources/fs.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index 9dec8d1..147f246 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"
--
1.7.11.4
reply other threads:[~2012-08-29 13:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120829135738.GA89550@redhat.com \
--to=rmccabe@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).