From c35975aa2c0819482e29ca6e391f5a9f15dbcea9 Mon Sep 17 00:00:00 2001 From: Lon Hohberger <lhh@redhat.com> Date: Wed, 10 Feb 2010 12:11:33 -0500 Subject: [PATCH] rgmanager: isAlive error logging for file systems This change adapts two different patch sets, one contributed by Nick Downs. It fixes: - isAlive logging for all file systems - file naming during isAlive checks for cluster file systems Resolves: rhbz#562237 Signed-off-by: Lon Hohberger <lhh@redhat.com> --- rgmanager/src/resources/clusterfs.sh | 15 +++++++++++---- rgmanager/src/resources/fs.sh | 13 ++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh index 0e18f28..250978e 100755 --- a/rgmanager/src/resources/clusterfs.sh +++ b/rgmanager/src/resources/clusterfs.sh @@ -444,8 +444,9 @@ Device $dev is mounted on $tmp_mp instead of $mp" # isAlive() { + declare errcode declare mount_point - declare file=".writable_test" + declare file=".writable_test.$(hostname)" declare rw if [ $# -ne 1 ]; then @@ -464,8 +465,10 @@ isAlive() # depth 10 test (read test) ls $mount_point > /dev/null 2> /dev/null - if [ $? -ne 0 ]; then - return $NO + errcode=$? + if [ $errcode -ne 0 ]; then + ocf_log err "clusterfs:${OCF_RESKEY_name}: isAlive failed read test on [$mount_point]. Return code: $errcode" + return $NO fi [ $OCF_CHECK_LEVEL -lt 20 ] && return $YES @@ -488,7 +491,11 @@ isAlive() fi done touch $file > /dev/null 2> /dev/null - [ $? -ne 0 ] && return $NO + errcode=$? + if [ $errcode -ne 0 ]; then + ocf_log err "clusterfs:${OCF_RESKEY_name}: isAlive failed write test on [$mount_point]. Return code: $errcode" + return $NO + fi rm -f $file > /dev/null 2> /dev/null fi diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh index 03cd59a..8214079 100755 --- a/rgmanager/src/resources/fs.sh +++ b/rgmanager/src/resources/fs.sh @@ -635,6 +635,7 @@ isMounted () { # isAlive() { + declare errcode declare mount_point declare file=".writable_test" declare rw @@ -655,8 +656,10 @@ isAlive() # depth 10 test (read test) ls $mount_point > /dev/null 2> /dev/null - if [ $? -ne 0 ]; then - return $NO + errcode=$? + if [ $errcode -ne 0 ]; then + ocf_log err "fs:${OCF_RESKEY_name}: isAlive failed read test on [$mount_point]. Return code: $errcode" + return $NO fi [ $OCF_CHECK_LEVEL -lt 20 ] && return $YES @@ -679,7 +682,11 @@ isAlive() fi done touch $file > /dev/null 2> /dev/null - [ $? -ne 0 ] && return $NO + errcode=$? + if [ $errcode -ne 0 ]; then + ocf_log err "fs:${OCF_RESKEY_name}: isAlive failed write test on [$mount_point]. Return code: $errcode" + return $NO + fi rm -f $file > /dev/null 2> /dev/null fi -- 1.6.2.5