diff options
author | Amar Tumballi <amar@gluster.com> | 2011-07-08 02:56:03 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-12 05:37:39 -0700 |
commit | 9866f23b9b0ceb8be876600be9832987b8646540 (patch) | |
tree | cc2228e7d11f4507f4ea28ba92dd0182d9db268e /xlators/mount | |
parent | 44f57f49309116de175a9c91c84fb7b8999a05ad (diff) |
mount.glusterfs: fix to handle the error cases better
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3085 (backupvolfile-server option doesn't work)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3085
Diffstat (limited to 'xlators/mount')
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 6b683dc91..01a403c0a 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -27,8 +27,6 @@ _init () LOG_DEBUG=DEBUG; LOG_TRACE=TRACE; - # set default log level to INFO - log_level=$LOG_INFO; prefix="@prefix@"; exec_prefix=@exec_prefix@; cmd_line=$(echo "@sbindir@/glusterfs"); @@ -67,7 +65,9 @@ start_glusterfs () ;; esac fi - cmd_line=$(echo "$cmd_line --log-level=$log_level"); + if [ -n "$log_level" ]; then + cmd_line=$(echo "$cmd_line --log-level=$log_level"); + fi if [ -n "$read_only" ]; then cmd_line=$(echo "$cmd_line --read-only"); @@ -127,13 +127,28 @@ start_glusterfs () err=0; $cmd_line; + + inode=$(stat -c %i $mount_point 2>/dev/null); + + # this is required if the stat returns error + if [ -z "$inode" ]; then + inode="0"; + fi + # retry the failover - if [ $? != "0" ]; then + # if [ $? != "0" ]; then # <--- TODO: Once glusterfs returns proper error code, change it. + if [ $inode -ne 1 ]; then err=1; if [ -n "$cmd_line1" ]; then cmd_line1=$(echo "$cmd_line1 $mount_point"); $cmd_line1 - if [ $? != "0"]; then + + inode=$(stat -c %i $mount_point 2>/dev/null); + # this is required if the stat returns error + if [ -z "$inode" ]; then + inode="0"; + fi + if [ $inode -ne 1]; then err=1; fi fi @@ -243,7 +258,6 @@ main () if grep -q " $mount_point fuse" /etc/mtab; then echo -n "$0: according to mtab, GlusterFS is already mounted on " echo "$mount_point" - sleep 1; exit 0; fi @@ -261,8 +275,6 @@ main () } start_glusterfs; - - sleep 3; } _init "$@" && main "$@"; |