Whamcloud - gitweb
LU-2194 tests: Wait for reconnect in recovery-small/19
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index bd261b3..d1e51f8 100755 (executable)
@@ -418,7 +418,7 @@ test_19a() {
        do_facet client "munlink $DIR/$tfile"
 
        # let the client reconnect
-       sleep 5
+       client_reconnect
        EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state | \
            awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
 
@@ -438,7 +438,7 @@ test_19b() {
        do_facet client munlink $DIR/$tfile
 
        # let the client reconnect
-       sleep 5
+       client_reconnect
        EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state | \
            awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
 
@@ -446,6 +446,36 @@ test_19b() {
 }
 run_test 19b "test expired_lock_main on ost (2867)"
 
+test_19c() {
+       local BEFORE=`date +%s`
+
+       mount_client $DIR2
+       $LCTL set_param ldlm.namespaces.*.early_lock_cancel=0
+
+       mkdir -p $DIR1/$tfile
+       stat $DIR1/$tfile
+
+#define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x516
+       do_facet mds $LCTL set_param fail_loc=0x80000516
+
+       touch $DIR2/$tfile/file1 &
+       PID1=$!
+       # let touch to get blocked on the server
+       sleep 2
+
+       wait $PID1
+       $LCTL set_param ldlm.namespaces.*.early_lock_cancel=1
+       umount_client $DIR2
+
+       # let the client reconnect
+       sleep 5
+       EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
+          awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
+
+       [ -z "$EVICT" ] || [[ $EVICT -le $BEFORE ]] || error "eviction happened"
+}
+run_test 19c "check reconnect and lock resend do not trigger expired_lock_main"
+
 test_20a() {   # bug 2983 - ldlm_handle_enqueue cleanup
        remote_ost_nodsh && skip "remote OST with nodsh" && return 0