[Gluster-devel] [PATCH BUG:3085] Make backupvolfile-server option actually work.

Jeff Darcy jdarcy at redhat.com
Fri Jun 24 17:26:57 UTC 2011


>From b5e1a48a067ac1f72b7655f5f13bf46d9bde8334 Mon Sep 17 00:00:00 2001

The problem was that glusterfs would return zero (success) as soon as it
forked, before we really knew whether the mount using the primary
volfile server had actually succeeded or failed.  This code actually
checks for the appearance of the volume in our mount table, and retries
using the backup volfile server if it doesn't show up in a reasonable
amount of time.

It's hacky, and I know something better is coming along, but this issue
comes up daily in the IRC channel and not everyone wants to set up RRNDS
for something that a script should be able to handle.  Whoever added the
backupvolfile-server option probably meant for it to help in these
cases, but it wasn't working.

Signed-off-by: Jeff Darcy <jdarcy at redhat.com>
---
 xlators/mount/fuse/utils/mount.glusterfs.in |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in
b/xlators/mount/fuse/utils/mount.glusterfs.in
index e429eca..aca43a9 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -123,13 +123,25 @@ start_glusterfs ()
     err=0;
     $cmd_line;

+    found=0
+    for i in $(seq 0 10); do
+	sleep 3
+	mount | cut -d" " -f3 | grep "^$mount_point$"
+	if [ $? = 0 ]; then
+	    echo "There it is!"
+	    found=1
+	    break
+        fi
+	echo "Still not there..."
+    done
+
     # retry the failover
-    if [ $? != "0" ]; then
-        err=1;
+    if [ $found = 0 ]; then
+	echo "Trying backupvolfile_server"
         if [ -n "$cmd_line1" ]; then
             cmd_line1=$(echo "$cmd_line1 $mount_point");
             $cmd_line1
-            if [ $? != "0"]; then
+            if [ $? != "0" ]; then
                 err=1;
             fi
         fi
-- 
1.7.3.4




More information about the Gluster-devel mailing list