Whamcloud - gitweb
Land b1_4_smallfix onto b1_4 (20041125_1716)
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index b79d32d..837f328 100755 (executable)
@@ -2,12 +2,12 @@
 
 set -e
 
-#         bug 2732 2986 2762 2766
-ALWAYS_EXCEPT="17   20b  16   18"
+#         bug  2986 
+ALWAYS_EXCEPT="20b"
 
 
 LUSTRE=${LUSTRE:-`dirname $0`/..}
-UPCALL=${UPCALL:-$PWD/recovery-small-upcall.sh}
+
 . $LUSTRE/tests/test-framework.sh
 
 init_test_env $@
@@ -26,7 +26,7 @@ CLEANUP=${CLEANUP:-"cleanup"}
 make_config() {
     rm -f $XMLCONFIG
     add_mds mds --dev $MDSDEV --size $MDSSIZE
-    add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
+    add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
        --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
     add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
     add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
@@ -73,6 +73,8 @@ fi
 REFORMAT=--reformat $SETUP
 unset REFORMAT
 
+[ "$ONLY" == "setup" ] && exit
+
 test_1() {
     drop_request "mcreate $MOUNT/1"  || return 1
     drop_reint_reply "mcreate $MOUNT/2"    || return 2
@@ -146,7 +148,7 @@ test_10() {
 run_test 10 "finish request on server after client eviction (bug 1521)"
 
 #bug 2460
-# wake up a thead waiting for completion after eviction
+# wake up a thread waiting for completion after eviction
 test_11(){
     do_facet client multiop $MOUNT/$tfile Ow  || return 1
     do_facet client multiop $MOUNT/$tfile or  || return 2
@@ -159,7 +161,7 @@ test_11(){
 
     do_facet client munlink $MOUNT/$tfile  || return 4
 }
-run_test 11 "wake up a thead waiting for completion after eviction (b=2460)"
+run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
 
 #b=2494
 test_12(){
@@ -207,9 +209,23 @@ test_15() {
 }
 run_test 15 "failed open (-ENOMEM)"
 
+READ_AHEAD=`cat /proc/fs/lustre/llite/*/max_read_ahead_mb | head -n 1`
+stop_read_ahead() {
+   for f in /proc/fs/lustre/llite/*/max_read_ahead_mb; do 
+      echo 0 > $f
+   done
+}
+
+start_read_ahead() {
+   for f in /proc/fs/lustre/llite/*/max_read_ahead_mb; do 
+      echo $READ_AHEAD > $f
+   done
+}
+
 test_16() {
     do_facet client cp /etc/termcap $MOUNT
     sync
+    stop_read_ahead
 
 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
     sysctl -w lustre.fail_loc=0x80000504
@@ -218,20 +234,25 @@ test_16() {
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  && return 1
     sysctl -w lustre.fail_loc=0
     # give recovery a chance to finish (shouldn't take long)
-    sleep 1
+    sleep $TIMEOUT
     do_facet client "cmp /etc/termcap $MOUNT/termcap"  || return 2
+    start_read_ahead
 }
 run_test 16 "timeout bulk put, evict client (2732)"
 
 test_17() {
-#define OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
-    # will get evicted here
+    # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
+    # client will get evicted here
     sysctl -w lustre.fail_loc=0x80000503
-    do_facet client cp /etc/termcap $MOUNT && return 1
+    do_facet client cp /etc/termcap $DIR/$tfile
 
-    do_facet client "cmp /etc/termcap $MOUNT/termcap"  && return 1
+    sleep $TIMEOUT
     sysctl -w lustre.fail_loc=0
-    do_facet client "cmp /etc/termcap $MOUNT/termcap"  || return 2
+    do_facet client "df $DIR"
+    # expect cmp to fail
+    do_facet client "cmp /etc/termcap $DIR/$tfile"  && return 1
+    do_facet client "rm $DIR/$tfile" || return 2
+    return 0
 }
 run_test 17 "timeout bulk get, evict client (2732)"
 
@@ -297,6 +318,8 @@ test_19a() {
     drop_ldlm_cancel "chmod 0777 $f"  || echo evicted
 
     do_facet client checkstat -v -p 0777 $f  || echo evicted
+    # let the client reconnect
+    sleep 5
     do_facet client "munlink $f"
 }
 run_test 19a "test expired_lock_main on mds (2867)"
@@ -319,7 +342,7 @@ test_20a() {        # bug 2983 - ldlm_handle_enqueue cleanup
        mkdir -p $DIR/$tdir
        multiop $DIR/$tdir/${tfile} O_wc &
        MULTI_PID=$!
-       usleep 500
+       sleep 1
        cancel_lru_locks OSC
 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
        do_facet ost sysctl -w lustre.fail_loc=0x80000308
@@ -341,4 +364,19 @@ test_20b() {       # bug 2986 - ldlm_handle_enqueue error during open
 }
 run_test 20b "ldlm_handle_enqueue error (should return error)"
 
+test_21() {    # bug 3267 - eviction fails writeback but app doesn't see it
+       mkdir -p $DIR/$tdir
+       cancel_lru_locks OSC
+       multiop $DIR/$tdir/$tfile Owyw_yc &
+       MULTI_PID=$!
+       usleep 500
+# OBD_FAIL_PTLRPC_BULK_PUT_NET|OBD_FAIL_ONCE
+       sysctl -w lustre.fail_loc=0x80000503
+       kill -USR1 $MULTI_PID
+       wait $MULTI_PID
+       rc=$?
+       [ $rc -eq 0 ] && error "multiop didn't fail fsync: rc $rc" || true
+}
+run_test 21 "fsync error (should return error)" 
+
 $CLEANUP