From e1e5dd6aa49ba49aa2dc58cccf18eff960e1b901 Mon Sep 17 00:00:00 2001
From: yury <yury>
Date: Sun, 23 Nov 2008 12:27:39 +0000
Subject: [PATCH] b=17690 r=shadow

- fixes in test_59b
---
 lustre/tests/replay-single.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh
index 113ba91873..b72249ffec 100755
--- a/lustre/tests/replay-single.sh
+++ b/lustre/tests/replay-single.sh
@@ -1429,16 +1429,28 @@ run_test 59 "test log_commit_thread vs filter_destroy race"
 
 # bug 17323
 test_59b() {
+    do_facet $SINGLEMDS "lctl set_param debug=+rpctrace"
     mkdir -p $DIR/$tdir
     createmany -o $DIR/$tdir/$tfile-%d 2000
     sync
 #define OBD_FAIL_OBD_LOG_CANCEL_REP      0x606
     do_facet $SINGLEMDS "lctl set_param fail_loc=0x606"
     unlinkmany $DIR/$tdir/$tfile-%d 2000
-    sleep 60
+
+    # make sure that all llcds left ost and nothing left cached
+    sync
+    sleep 10
     do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
-    do_facet $SINGLEMDS $LCTL dk | grep -q "RESENT cancel req" || return 1
+
+    # sleep 2 obd_timeouts from ost to make sure that we get resents.
+    local timeout=$(do_facet ost1 lctl get_param -n timeout)
+    timeout=$((timeout * 2))
+    log "Sleep $timeout"
+    sleep $timeout
+    do_facet $SINGLEMDS $LCTL dk | grep -q "RESENT cancel req"
+    local res=$?
     rmdir $DIR/$tdir
+    return $res
 }
 run_test 59b "resent handle in llog_origin_handle_cancel"
 
-- 
GitLab