Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
index 2dc816b..7b7a978 100755 (executable)
@@ -23,6 +23,7 @@ SETUP=${SETUP:-""}
 CLEANUP=${CLEANUP:-""}
 
 cleanup_and_setup_lustre
+assert_DIR
 rm -rf $DIR/[df][0-9]*
 
 SAMPLE_NAME=recovery-small.junk
@@ -123,7 +124,7 @@ run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
 #b=2494
 test_12(){
     $LCTL mark multiop $MOUNT/$tfile OS_c 
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x115"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
     clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
     multiop_bg_pause $MOUNT/$tfile OS_c || return 1
     PID=$!
@@ -140,9 +141,9 @@ test_13() {
     mkdir $MOUNT/readdir || return 1
     touch $MOUNT/readdir/newentry || return
 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000104"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
     ls $MOUNT/readdir || return 3
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0"
     rm -rf $MOUNT/readdir || return 4
 }
 run_test 13 "mdc_readpage restart test (bug 1138)"
@@ -152,14 +153,14 @@ test_14() {
     mkdir $MOUNT/readdir
     touch $MOUNT/readdir/newentry
 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000106"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
     ls $MOUNT/readdir || return 1
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 }
 run_test 14 "mdc_readpage resend test (bug 1138)"
 
 test_15() {
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000128"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
     touch $DIR/$tfile && return 1
     return 0
 }
@@ -180,11 +181,11 @@ test_16() {
     stop_read_ahead
 
 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
-    do_facet ost1 "sysctl -w lustre.fail_loc=0x80000504"
+    do_facet ost1 "lctl set_param fail_loc=0x80000504"
     cancel_lru_locks osc
     # OST bulk will time out here, client resends
     do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 1
-    do_facet ost1 sysctl -w lustre.fail_loc=0
+    do_facet ost1 lctl set_param fail_loc=0
     # give recovery a chance to finish (shouldn't take long)
     sleep $TIMEOUT
     do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 2
@@ -195,13 +196,13 @@ run_test 16 "timeout bulk put, don't evict client (2732)"
 test_17() {
     # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
     # OST bulk will time out here, client retries
-    do_facet ost1 sysctl -w lustre.fail_loc=0x80000503
+    do_facet ost1 lctl set_param fail_loc=0x80000503
     # need to ensure we send an RPC
     do_facet client cp /etc/termcap $DIR/$tfile
     sync
 
     sleep $TIMEOUT
-    do_facet ost1 sysctl -w lustre.fail_loc=0
+    do_facet ost1 lctl set_param fail_loc=0
     do_facet client "df $DIR"
     # expect cmp to succeed, client resent bulk
     do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
@@ -280,7 +281,7 @@ test_18c() {
 
     # OBD_FAIL_OST_CONNECT_NET2
     # lost reply to connect request
-    do_facet ost1 sysctl -w lustre.fail_loc=0x80000225
+    do_facet ost1 lctl set_param fail_loc=0x80000225
     # force reconnect
     df $MOUNT > /dev/null 2>&1
     sleep 2
@@ -326,7 +327,7 @@ test_20a() {        # bug 2983 - ldlm_handle_enqueue cleanup
        MULTI_PID=$!
        cancel_lru_locks osc
 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
-       do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
+       do_facet ost1 lctl set_param fail_loc=0x80000308
        kill -USR1 $MULTI_PID
        wait $MULTI_PID
        rc=$?
@@ -339,7 +340,7 @@ test_20b() {        # bug 2986 - ldlm_handle_enqueue error during open
        lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
        cancel_lru_locks osc
 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
-       do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
+       do_facet ost1 lctl set_param fail_loc=0x80000308
        dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
                error "didn't fail open enqueue" || true
 }
@@ -351,18 +352,18 @@ test_21a() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        close_pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
        multiop $DIR/$tdir-2/f Oc &
        open_pid=$!
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
        kill -USR1 $close_pid
        cancel_lru_locks mdc
        wait $close_pid || return 1
        wait $open_pid || return 2
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
        $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
@@ -377,11 +378,11 @@ test_21b() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        close_pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
        mcreate $DIR/$tdir-2/f &
        open_pid=$!
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        kill -USR1 $close_pid
        cancel_lru_locks mdc
@@ -400,19 +401,19 @@ test_21c() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        close_pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
        mcreate $DIR/$tdir-2/f &
        open_pid=$!
        sleep 3
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
        kill -USR1 $close_pid
        cancel_lru_locks mdc
        wait $close_pid || return 1
        wait $open_pid || return 2
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
@@ -426,16 +427,16 @@ test_21d() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
        multiop $DIR/$tdir-2/f Oc &
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
        kill -USR1 $pid
        cancel_lru_locks mdc
        wait $pid || return 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
@@ -450,10 +451,10 @@ test_21e() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
        touch $DIR/$tdir-2/f &
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        kill -USR1 $pid
        cancel_lru_locks mdc
@@ -472,16 +473,16 @@ test_21f() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
        touch $DIR/$tdir-2/f &
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
        kill -USR1 $pid
        cancel_lru_locks mdc
        wait $pid || return 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
@@ -495,16 +496,16 @@ test_21g() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
        touch $DIR/$tdir-2/f &
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
        kill -USR1 $pid
        cancel_lru_locks mdc
        wait $pid || return 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
@@ -518,17 +519,17 @@ test_21h() {
        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
        pid=$!
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
        touch $DIR/$tdir-2/f &
        touch_pid=$!
        sleep 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
        cancel_lru_locks mdc
        kill -USR1 $pid
        wait $pid || return 1
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
        wait $touch_pid || return 2
 
@@ -543,7 +544,7 @@ test_22() {
     f1=$DIR/${tfile}-1
     f2=$DIR/${tfile}-2
     
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
     multiop $f2 Oc &
     close_pid=$!
 
@@ -551,7 +552,7 @@ test_22() {
     multiop $f1 msu || return 1
 
     cancel_lru_locks mdc
-    do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0"
 
     wait $close_pid || return 2
     rm -rf $f2 || return 4
@@ -582,7 +583,7 @@ test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
        kill -USR1 $MULTI_PID
        wait $MULTI_PID
        rc=$?
-       sysctl -w lustre.fail_loc=0x0
+       lctl set_param fail_loc=0x0
        client_reconnect
        [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
 }
@@ -597,7 +598,7 @@ test_26a() {      # was test_26 bug 5921 - evict dead exports by pinger
        OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
        echo starting with $OST_NEXP1 OST exports
 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
-       do_facet client sysctl -w lustre.fail_loc=0x505
+       do_facet client lctl set_param fail_loc=0x505
        # evictor takes up to 2.25x to evict.  But if there's a 
        # race to start the evictor from various obds, the loser
        # might have to wait for the next ping.
@@ -606,7 +607,7 @@ test_26a() {      # was test_26 bug 5921 - evict dead exports by pinger
         OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
        OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
        echo ending with $OST_NEXP2 OST exports
-       do_facet client sysctl -w lustre.fail_loc=0x0
+       do_facet client lctl set_param fail_loc=0x0
         [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
        return 0
 }
@@ -645,10 +646,10 @@ test_27() {
        FAILURE_MODE="SOFT"
        facet_failover $SINGLEMDS
 #define OBD_FAIL_OSC_SHUTDOWN            0x407
-       sysctl -w lustre.fail_loc=0x80000407
+       lctl set_param fail_loc=0x80000407
        # need to wait for reconnect
        echo -n waiting for fail_loc
-       while [ `sysctl -n lustre.fail_loc` -eq -2147482617 ]; do
+       while [ `lctl get_param -n fail_loc` -eq -2147482617 ]; do
            sleep 1
            echo -n .
        done
@@ -664,7 +665,7 @@ test_28() {      # bug 6086 - error adding new clients
        do_facet client mcreate $MOUNT/$tfile       || return 1
        drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
        #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
-       do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x8000012f"
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
        # fail once (evicted), reconnect fail (fail_loc), ok
        df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
        rm -f $MOUNT/$tfile
@@ -726,6 +727,7 @@ test_51() {
 run_test 51 "failover MDS during recovery"
 
 test_52_guts() {
+       do_facet client "mkdir -p $DIR/$tdir"
        do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
        CLIENT_PID=$!
        echo writemany pid $CLIENT_PID
@@ -803,7 +805,7 @@ test_55() {
        echo "(dd_pid=$DDPID, time=$count)successful"
 
         #define OBD_FAIL_OST_DROP_REQ            0x21d
-       do_facet ost sysctl -w lustre.fail_loc=0x0000021d
+       do_facet ost lctl set_param fail_loc=0x0000021d
        # second dd will be never finished
        dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4  &        
        DDPID=$!
@@ -822,7 +824,7 @@ test_55() {
        echo "(dd_pid=$DDPID, time=$count)successful"
 
        #Recover fail_loc and dd will finish soon
-       do_facet ost sysctl -w lustre.fail_loc=0
+       do_facet ost lctl set_param fail_loc=0
        count=0
        echo  "step3: testing ......"
        while [ true ]; do
@@ -842,9 +844,9 @@ run_test 55 "ost_brw_read/write drops timed-out read/write request"
 test_56() { # b=11277
 #define OBD_FAIL_MDS_RESEND      0x136
         touch $DIR/$tfile
-        do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000136"
+        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
         stat $DIR/$tfile
-        do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
+        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
         rm -f $DIR/$tfile
 }
 run_test 56 "do not allow reconnect to busy exports"
@@ -861,12 +863,12 @@ test_57() { # bug 10866
         pid=$!
         sleep 1
 #define OBD_FAIL_LPROC_REMOVE            0xB00
-        sysctl -w lustre.fail_loc=0x80000B00
+        lctl set_param fail_loc=0x80000B00
         zconf_umount `hostname` $DIR
-        sysctl -w lustre.fail_loc=0x80000B00
+        lctl set_param fail_loc=0x80000B00
         fail_abort $SINGLEMDS
         kill -9 $pid
-        sysctl -w lustre.fail_loc=0
+        lctl set_param fail_loc=0
         mount_client $DIR
         do_facet client "df $DIR"
 }
@@ -876,11 +878,11 @@ test_58() { # bug 11546
 #define OBD_FAIL_MDC_ENQUEUE_PAUSE        0x801
         touch $MOUNT/$tfile
         ls -la $MOUNT/$tfile
-        sysctl -w lustre.fail_loc=0x80000801
+        lctl set_param fail_loc=0x80000801
         cp $MOUNT/$tfile /dev/null &
         pid=$!
         sleep 1
-        sysctl -w lustre.fail_loc=0
+        lctl set_param fail_loc=0
         drop_bl_callback rm -f $MOUNT/$tfile
         wait $pid
         do_facet client "df $DIR"
@@ -891,11 +893,11 @@ test_59() { # bug 10589
        zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
        echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE  0x311
-       sysctl -w lustre.fail_loc=0x311
+       lctl set_param fail_loc=0x311
        writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
        [ $? = 0 ] || error "dd write failed"
        writes=$(echo $writes | awk  -F '+' '/out/ {print $1}')
-       sysctl -w lustre.fail_loc=0
+       lctl set_param fail_loc=0
        sync
        zconf_umount `hostname` $MOUNT2 -f
        reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)