Whamcloud - gitweb
LU-687 clio: retry if fault page was truncated
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 18b91e4..052a207 100644 (file)
@@ -4171,13 +4171,12 @@ set_checksums()
        return 0
 }
 
-export ORIG_CSUM_TYPE=""
+export ORIG_CSUM_TYPE="`lctl get_param -n osc/*osc-[^mM]*/checksum_type |
+                        sed 's/.*\[\(.*\)\].*/\1/g' | head -n1`"
 CKSUM_TYPES=${CKSUM_TYPES:-"crc32 adler"}
+[ "$ORIG_CSUM_TYPE" = "crc32c" ] && CKSUM_TYPES="$CKSUM_TYPES crc32c"
 set_checksum_type()
 {
-       [ "$ORIG_CSUM_TYPE" ] || \
-               ORIG_CSUM_TYPE=`lctl get_param -n osc/*osc-[^mM]*/checksum_type |
-                                sed 's/.*\[\(.*\)\].*/\1/g' | head -n1`
        lctl set_param -n osc.*osc-[^mM]*.checksum_type $1
        log "set checksum type to $1"
        return 0
@@ -5090,7 +5089,7 @@ test_104a() {
        OSC=`lctl get_param -n devices | awk '/-osc-/ {print $4}' | head -n 1`
        lctl --device %$OSC deactivate
        lfs df || error "lfs df with deactivated OSC failed"
-       lctl --device %$OSC recover
+       lctl --device %$OSC activate
        lfs df || error "lfs df with reactivated OSC failed"
        rm -f $DIR/$tfile
 }
@@ -7629,8 +7628,10 @@ test_180a() {
         fi
 
         local osc=$($LCTL dl | grep -v mdt | awk '$3 == "osc" {print $4; exit}')
-        local host=$(awk '/current_connection:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
-        local target=$(awk '/target:/ {print $2}' /proc/fs/lustre/osc/$osc/import)
+        local host=$(lctl get_param -n osc.$osc.import |
+                             awk '/current_connection:/ {print $2}' )
+        local target=$(lctl get_param -n osc.$osc.import |
+                             awk '/target:/ {print $2}' )
         target=${target%_UUID}
 
         [[ -n $target ]]  && { setup_obdecho_osc $host $target || rc=1; } || rc=1
@@ -8260,25 +8261,37 @@ test_220() { #LU-325
        echo "OST still has $count objects"
 
        free=$((count + last_id - next_id))
-       echo "create $free files..."
+       echo "create $((free - next_id)) files @next_id..."
        createmany -o $DIR/$tdir/f $next_id $free || return 3
 
-       local last_id=$(do_facet mds${MDSIDX} lctl get_param -n \
+       local last_id2=$(do_facet mds${MDSIDX} lctl get_param -n \
                        osc.$mdtosc_proc1.prealloc_last_id)
-       local next_id=$(do_facet mds${MDSIDX} lctl get_param -n \
+       local next_id2=$(do_facet mds${MDSIDX} lctl get_param -n \
                        osc.$mdtosc_proc1.prealloc_next_id)
 
-       echo "after creation, last_id=$last_id, next_id=$next_id"
+       echo "after creation, last_id=$last_id2, next_id=$next_id2"
        $LFS df -i
 
        echo "cleanup..."
 
        do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $OST || return 4
        do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME || return 5
+       echo "unlink $((free - next_id)) files @ $next_id..."
        unlinkmany $DIR/$tdir/f $next_id $free || return 3
 }
 run_test 220 "the preallocated objects in MDS still can be used if ENOSPC is returned by OST with enough disk space"
 
+test_221() {
+        cp `which date` $MOUNT
+
+        #define OBD_FAIL_LLITE_FAULT_TRUNC_RACE  0x1401
+        $LCTL set_param fail_loc=0x80001401
+
+        $MOUNT/date > /dev/null
+        rm -f $MOUNT/date
+}
+run_test 221 "make sure fault and truncate race to not cause OOM"
+
 #
 # tests that do cleanup/setup should be run at the end
 #