Whamcloud - gitweb
b=14512
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index 0cdca40..6014d52 100755 (executable)
@@ -5,6 +5,10 @@ set -e
 #         bug  5494 7288 5493
 ALWAYS_EXCEPT="24   27   52 $RECOVERY_SMALL_EXCEPT"
 
+# also long tests: 19, 21a, 21e, 21f, 23, 27                           
+#                                     1     2.5    4    4          (min)"  
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="17    26b    50   51     57" 
+
 PTLDEBUG=${PTLDEBUG:--1}
 LUSTRE=${LUSTRE:-`dirname $0`/..}
 . $LUSTRE/tests/test-framework.sh
@@ -15,32 +19,12 @@ build_test_filter
 
 # Allow us to override the setup if we already have a mounted system by
 # setting SETUP=" " and CLEANUP=" "
-SETUP=${SETUP:-"setup"}
-CLEANUP=${CLEANUP:-"cleanup"}
-
-setup() {
-    [ "$REFORMAT" ] && formatall
-    setupall
-}
-
-cleanup() {
-       cleanupall || { echo "FAILed to clean up"; exit 20; }
-}
+SETUP=${SETUP:-""}
+CLEANUP=${CLEANUP:-""}
 
-if [ ! -z "$EVAL" ]; then
-    eval "$EVAL"
-    exit $?
-fi
-
-if [ "$ONLY" == "cleanup" ]; then
-    sysctl -w lnet.debug=0 || true
-    cleanup
-    exit
-fi
-
-$SETUP
-
-[ "$ONLY" == "setup" ] && exit
+cleanup_and_setup_lustre
+rm -rf $DIR/${TESTSUITE}/[df][0-9]* # bug 13798 new t-f tdir staff
+rm -rf $DIR/[df][0-9]*
 
 test_1() {
     drop_request "mcreate $MOUNT/1"  || return 1
@@ -228,7 +212,7 @@ test_17() {
 run_test 17 "timeout bulk get, don't evict client (2732)"
 
 test_18a() {
-    [ -z ${ost2_svc} ] && echo Skipping, needs 2 osts && return 0
+    [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
 
     do_facet client mkdir -p $MOUNT/$tdir
     f=$MOUNT/$tdir/$tfile
@@ -237,7 +221,7 @@ test_18a() {
     pgcache_empty || return 1
 
     # 1 stripe on ost2
-    lfs setstripe $f $((128 * 1024)) 1 1
+    lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
 
     do_facet client cp /etc/termcap $f
     sync
@@ -262,8 +246,8 @@ test_18b() {
     pgcache_empty || return 1
 
     # shouldn't have to set stripe size of count==1
-    lfs setstripe $f $((128 * 1024)) 0 1
-    lfs setstripe $f2 $((128 * 1024)) 0 1
+    lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
+    lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
 
     do_facet client cp /etc/termcap $f
     sync
@@ -572,16 +556,14 @@ test_24() {       # bug 2248 - eviction fails writeback but app doesn't see it
        rc=$?
        sysctl -w lustre.fail_loc=0x0
        client_reconnect
-       [ $rc -eq 0 ] && error "multiop didn't fail fsync: rc $rc" || true
+       [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
 }
 run_test 24 "fsync error (should return error)"
 
 test_26() {      # bug 5921 - evict dead exports by pinger
 # this test can only run from a client on a separate node.
-       [ "`lsmod | grep obdfilter`" ] && \
-           echo "skipping test 26 (local OST)" && return
-       [ "`lsmod | grep mds`" ] && \
-           echo "skipping test 26 (local MDS)" && return
+       remote_ost || skip "local OST" && return
+       remote_mds || skip "local MDS" && return
        OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
         OST_EXP="`do_facet ost1 cat $OST_FILE`"
        OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
@@ -605,6 +587,7 @@ run_test 26 "evict dead exports"
 test_26b() {      # bug 10140 - evict dead exports by pinger
        client_df
         zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
+        sleep 1 # wait connections being established
        MDS_FILE=$LPROC/mdt/${mds1_svc}/num_exports
         MDS_NEXP1="`do_facet $SINGLEMDS cat $MDS_FILE | cut -d' ' -f2`"
        OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
@@ -626,8 +609,7 @@ test_26b() {      # bug 10140 - evict dead exports by pinger
 run_test 26b "evict dead exports"
 
 test_27() {
-       [ "`lsmod | grep mds`" ] || \
-           { echo "skipping test 27 (non-local MDS)" && return 0; }
+       remote_mds && { skip "remote MDS" && return 0; }
        mkdir -p $DIR/$tdir
        writemany -q -a $DIR/$tdir/$tfile 0 5 &
        CLIENT_PID=$!
@@ -683,7 +665,7 @@ test_50() {
        rc=$?
        echo writemany returned $rc
        #these may fail because of eviction due to slow AST response.
-       return $rc
+       [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
 }
 run_test 50 "failover MDS under load"
 
@@ -711,7 +693,7 @@ test_51() {
        wait $CLIENT_PID 
        rc=$?
        echo writemany returned $rc
-       return $rc
+       [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
 }
 run_test 51 "failover MDS during recovery"
 
@@ -753,7 +735,7 @@ run_test 52 "failover OST under load"
 # test of open reconstruct
 test_53() {
        touch $DIR/$tfile
-       drop_ldlm_reply "./openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
+       drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
                return 2
 }
 run_test 53 "touch: drop rep"
@@ -773,8 +755,7 @@ run_test 54 "back in time"
 
 # bug 11330 - liblustre application death during I/O locks up OST
 test_55() {
-       [ "`lsmod | grep obdfilter`" ] || \
-           { echo "skipping test 55 (non-local OST)" && return 0; }    
+       remote_ost && { skip "remote OST" && return 0; }
 
        mkdir -p $DIR/$tdir
 
@@ -880,5 +861,19 @@ test_58() { # bug 11546
 }
 run_test 58 "Eviction in the middle of open RPC reply processing"
 
-$CLEANUP
-echo "$0: completed"
+test_59() { # bug 10589
+       zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
+#define OBD_FAIL_LDLM_CANCEL_EVICT_RACE  0x311
+       sysctl -w lustre.fail_loc=0x311
+       writes=`dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}'`
+       sysctl -w lustre.fail_loc=0
+       sync
+       zconf_umount `hostname` $DIR2 -f
+       reads=`dd if=$DIR/$tfile of=/dev/null 2>&1 | awk 'BEGIN { FS="+" } /in/ {print $1}'`
+       [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
+}
+run_test 59 "Read cancel race on client eviction"
+
+equals_msg `basename $0`: test complete, cleaning up
+check_and_cleanup_lustre
+[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true