From c75c5f63a7ff32f29f288a61e28effbe898b1889 Mon Sep 17 00:00:00 2001
From: ericm <ericm>
Date: Fri, 10 Oct 2008 17:26:49 +0000
Subject: [PATCH] branch: b1_6 AT test sleep use current AT service time.
 b=16990 o=Brian Behlendorf <behlendorf1@llnl.gov> r=nathan r=ericm

---
 lustre/tests/replay-single.sh | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh
index 0575df8268..c8a8cb51f9 100755
--- a/lustre/tests/replay-single.sh
+++ b/lustre/tests/replay-single.sh
@@ -1438,15 +1438,20 @@ test_65a() #bug 3055
     $LCTL dk > /dev/null
     debugsave
     lctl set_param debug="+other"
-    # slow down a request
-    do_facet mds lctl set_param fail_val=30000
+    # Slow down a request to the current service time, this is critical
+    # because previous tests may have caused this value to increase.
+    REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
+               awk '/portal 12/ {print $5}'`
+    REQ_DELAY=$((${REQ_DELAY} + 5))
+
+    do_facet mds lctl set_param fail_val=$((${REQ_DELAY} * 1000))
 #define OBD_FAIL_PTLRPC_PAUSE_REQ        0x50a
     do_facet mds lctl set_param fail_loc=0x8000050a
     createmany -o $DIR/$tfile 10 > /dev/null
     unlinkmany $DIR/$tfile 10 > /dev/null
     # check for log message
     $LCTL dk | grep "Early reply #" || error "No early reply" 
-    # client should show 30s estimates
+    # client should show REQ_DELAY estimates
     lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
     sleep 9
     lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
@@ -1460,8 +1465,13 @@ test_65b() #bug 3055
     debugsave
     lctl set_param debug="+other"
     $LCTL dk > /dev/null
-    # slow down bulk i/o
-    do_facet ost1 lctl set_param fail_val=30
+    # Slow down a request to the current service time, this is critical
+    # because previous tests may have caused this value to increase.
+    REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
+               awk '/portal 6/ {print $5}'`
+    REQ_DELAY=$((${REQ_DELAY} + 5))
+
+    do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
 #define OBD_FAIL_OST_BRW_PAUSE_PACK      0x224
     do_facet ost1 lctl set_param fail_loc=0x224
 
@@ -1474,7 +1484,7 @@ test_65b() #bug 3055
     # check for log message
     $LCTL dk | grep "Early reply #" || error "No early reply"
     debugrestore
-    # client should show 30s estimates
+    # client should show REQ_DELAY estimates
     lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
 }
 run_test 65b "AT: verify early replies on packed reply / bulk"
-- 
GitLab