Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / tests / replay-single.sh
index efc2f0a..b6222e0 100755 (executable)
@@ -460,12 +460,6 @@ test_20a() {       # was test_20
 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
 
 test_20b() { # bug 10480
-    # XXX increase the debug level temporary 
-    DEBUG_SAVED=$PTLDEBUG
-    DEBUG_MB_SAVED=$DEBUG_SIZE
-    PTLDEBUG=0x33f1404
-    DEBUG_SIZE=150
-    do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE"
     BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
 
     dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
@@ -483,17 +477,29 @@ test_20b() { # bug 10480
     df -P $DIR || df -P $DIR || true    # reconnect
     wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
 
-    # FIXME just because recovery is done doesn't mean we've finished
-    # orphan cleanup.  Fake it with a sleep for now...
-    sleep 10
+    # just because recovery is done doesn't mean we've finished
+    # orphan cleanup. Wait for llogs to get synchronized.
+    echo waiting for orphan cleanup...
+    while [ true ]; do
+            local -a sync=($(do_facet ost "$LCTL get_param obdfilter.*.mds_sync" | awk -F= ' {print $2}'))
+            local con=1
+            for ((i=0; i<${#sync[@]}; i++)); do
+                    [ ${sync[$i]} -eq 0 ] && continue
+                    # there is a not finished MDS-OST synchronization
+                    con=0
+                    break;
+            done
+            [ ${con} -eq 1 ] && break
+            sleep 1
+    done
+
+    # let the statfs cache to get old enough.
+    sleep 1
+
     AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
     log "before $BEFOREUSED, after $AFTERUSED"
     [ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \
         error "after $AFTERUSED > before $BEFOREUSED"
-    # XXX decrease it back
-    PTLDEBUG=$DEBUG_SAVED
-    DEBUG_SIZE=$DEBUG_MB_SAVED
-    do_nodes $(comma_list $(nodes_list)) "$LCTL set_param debug=$PTLDEBUG; $LCTL set_param debug_mb=$DEBUG_SIZE"
     return 0
 }
 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"