Whamcloud - gitweb
b=13499
authorgrev <grev>
Thu, 20 Sep 2007 03:05:33 +0000 (03:05 +0000)
committergrev <grev>
Thu, 20 Sep 2007 03:05:33 +0000 (03:05 +0000)
i=Adilger

Wait recovery complete before AFTERUSED is checked.

lustre/tests/replay-single.sh
lustre/tests/test-framework.sh

index 610aa03..86f53e0 100755 (executable)
@@ -443,7 +443,7 @@ test_20b() { # bug 10480
 
     fail mds                            # start orphan recovery
     df -P $DIR || df -P $DIR || true    # reconnect
-    sleep 2
+    wait_mds_recovery_done || error "MDS recovery not done"
 
     AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
     log "before $BEFOREUSED, after $AFTERUSED"
index 2223235..f761979 100644 (file)
@@ -371,6 +371,24 @@ wait_for() {
     wait_for_host $HOST
 }
 
+wait_mds_recovery_done () {
+    local timeout=`do_facet mds cat /proc/sys/lustre/timeout`
+#define OBD_RECOVERY_TIMEOUT (obd_timeout * 5 / 2)
+# as we are in process of changing obd_timeout in different ways
+# let's set MAX longer than that
+    MAX=$(( timeout * 4 ))
+    WAIT=0
+    while [ $WAIT -lt $MAX ]; do
+        STATUS=`do_facet mds grep status /proc/fs/lustre/mds/*-MDT*/recovery_status`
+        echo $STATUS | grep COMPLETE && return 0
+        sleep 5
+        WAIT=$((WAIT + 5))
+        echo "Waiting $(($MAX - $WAIT)) secs for MDS recovery done"
+    done
+    echo "MDS recovery not done in $MAX sec"
+    return 1            
+}
+
 client_df() {
     # not every config has many clients
     if [ -n "$CLIENTS" ]; then