Whamcloud - gitweb
Land b1_4_smallfix onto b1_4 (20041125_1716)
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index 3007a0b..837f328 100755 (executable)
@@ -2,7 +2,7 @@
 
 set -e
 
-#         bug  2986
+#         bug  2986 
 ALWAYS_EXCEPT="20b"
 
 
@@ -12,73 +12,58 @@ LUSTRE=${LUSTRE:-`dirname $0`/..}
 
 init_test_env $@
 
-. ${CONFIG:=$LUSTRE/tests/cfg/lmv.sh}
+. ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
 
 build_test_filter
 
-assert_env MDSCOUNT
 
 # Allow us to override the setup if we already have a mounted system by
 # setting SETUP=" " and CLEANUP=" "
 SETUP=${SETUP:-"setup"}
 CLEANUP=${CLEANUP:-"cleanup"}
 
-gen_config() {
-    rm -f $XMLCONFIG
-
-    if [ "$MDSCOUNT" -gt 1 ]; then
-        add_lmv lmv1_svc
-        for mds in `mds_list`; do
-            MDSDEV=$TMP/${mds}-`hostname`
-            add_mds $mds --dev $MDSDEV --size $MDSSIZE  --lmv lmv1_svc
-        done
-        add_lov_to_lmv lov1 lmv1_svc --stripe_sz $STRIPE_BYTES \
-           --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
-       MDS=lmv1
-    else
-        add_mds mds1 --dev $MDSDEV --size $MDSSIZE
-        add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES \
-           --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
-       MDS=mds1_svc
-
-    fi
 
+make_config() {
+    rm -f $XMLCONFIG
+    add_mds mds --dev $MDSDEV --size $MDSSIZE
+    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
-    add_client client ${MDS} --lov lov1 --path $MOUNT
+    add_client client mds --lov lov1 --path $MOUNT
 }
 
 setup() {
-    gen_config
+    make_config
     start ost --reformat $OSTLCONFARGS 
     start ost2 --reformat $OSTLCONFARGS 
     [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
-    for mds in `mds_list`; do
-       start $mds --reformat $MDSLCONFARGS
-    done
-
+    start mds $MDSLCONFARGS --reformat
     grep " $MOUNT " /proc/mounts || zconf_mount `hostname`  $MOUNT
 }
 
 cleanup() {
     zconf_umount `hostname` $MOUNT
-    for mds in `mds_list`; do
-       stop $mds ${FORCE} $MDSLCONFARGS
-    done
+    stop mds ${FORCE} $MDSLCONFARGS
     stop ost2 ${FORCE} --dump cleanup.log
     stop ost ${FORCE} --dump cleanup.log
 }
 
+replay() {
+    do_mds "sync"
+    do_mds 'echo -e "device \$mds1\\nprobe\\nnotransno\\nreadonly" | lctl'
+    do_client "$1" &
+    shutdown_mds -f
+    start_mds
+    wait
+    do_client "df -h $MOUNT" # trigger failover, if we haven't already
+}
+
 if [ ! -z "$EVAL" ]; then
     eval "$EVAL"
     exit $?
 fi
 
-if [ "$ONLY" == "setup" ]; then
-    setup
-    exit
-fi
-
 if [ "$ONLY" == "cleanup" ]; then
     sysctl -w portals.debug=0 || true
     cleanup
@@ -88,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
@@ -161,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
@@ -174,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(){
@@ -222,15 +209,16 @@ 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/*/read_ahead; do 
+   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/*/read_ahead; do 
-      echo 1 > $f
+   for f in /proc/fs/lustre/llite/*/max_read_ahead_mb; do 
+      echo $READ_AHEAD > $f
    done
 }
 
@@ -376,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