Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 32dc73f5e8ed4a4266985905770a8ff4eee84dbe
Parent: d258ba6948f1eeda3f813190b9da2728985978cd
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Apr 20 18:52:05 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Apr 20 18:52:05 2010 -0400
rgmanager: Minor cleanups for file system agents
- don't double-check if the mount point exists; once
is enough
- report an error if creation of the mount point fails
Resolves: rhbz#581533
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/clusterfs.sh | 22 +++++++---------------
rgmanager/src/resources/fs.sh.in | 20 ++++++--------------
rgmanager/src/resources/netfs.sh | 8 +++++++-
3 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index bb0acfd..f90f865 100644
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -534,7 +534,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
else
ocf_log info "\
startFilesystem: Creating mount point $mp for device $dev"
- mkdir -p $mp
+ mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#
@@ -593,20 +599,6 @@ Cannot mount $dev on $mp, the device or mount point is already in
use!"
esac
#
- # Make sure the mount point exists.
- #
- if [ ! -d $mp ]; then
- rm -f $mp # rm in case its a plain file
- mkdir -p $mp # create the mount point
- ret_val=$?
- if [ $ret_val -ne 0 ]; then
- ocf_log err \
- "'mkdir -p $mp' failed, error=$ret_val"
- return $FAIL
- fi
- fi
-
- #
# Get the mount options, if they exist.
#
mount_options=""
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 5a6348b..ffa721f 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -816,6 +816,12 @@ startFilesystem: Mount point $mp exists but is not a directory"
ocf_log err "\
startFilesystem: Creating mount point $mp for device $dev"
mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#
@@ -874,20 +880,6 @@ Cannot mount $dev on $mp, the device or mount point is already in
use!"
esac
#
- # Make sure the mount point exists.
- #
- if [ ! -d $mp ]; then
- rm -f $mp # rm in case its a plain file
- mkdir -p $mp # create the mount point
- ret_val=$?
- if [ $ret_val -ne 0 ]; then
- ocf_log err \
- "'mkdir -p $mp' failed, error=$ret_val"
- return $FAIL
- fi
- fi
-
- #
# Get the mount options, if they exist.
#
mount_options=""
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
index b85027a..bb749f7 100644
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -386,7 +386,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
else
ocf_log info "\
startFilesystem: Creating mount point $mp for $fullpath"
- mkdir -p $mp
+ mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#