From 9866f23b9b0ceb8be876600be9832987b8646540 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 8 Jul 2011 02:56:03 +0000 Subject: mount.glusterfs: fix to handle the error cases better Signed-off-by: Amar Tumballi Signed-off-by: Anand Avati BUG: 3085 (backupvolfile-server option doesn't work) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3085 --- xlators/mount/fuse/utils/mount.glusterfs.in | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'xlators/mount/fuse') 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 "$@"; -- cgit