Whamcloud - gitweb
LU-16042 tests: can not get cache size on Arm64
[fs/lustre-release.git] / lustre / tests / sanity.sh
index dccc614..2338abc 100755 (executable)
@@ -3378,31 +3378,6 @@ test_27R() {
 }
 run_test 27R "test max_stripecount limitation when stripe count is set to -1"
 
-test_27S() {
-       (( $MDS1_VERSION >= $(version_code 2.14.54) )) ||
-               skip "Need MDS version at least 2.14.54"
-       [[ "$(facet_host mds1)" != "$(facet_host ost1)" ]] ||
-               skip "needs different host for mdt1 ost1"
-
-       local count=$(precreated_ost_obj_count 0 0)
-
-       echo "precreate count $count"
-       mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
-       $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "setstripe $tdir failed"
-       #define OBD_FAIL_OSP_GET_LAST_FID       0x2109
-       do_facet mds1 $LCTL set_param fail_loc=0x2109
-       #define OBD_FAIL_OST_GET_LAST_FID       0x252
-       do_facet ost1 $LCTL set_param fail_loc=0x252
-       createmany -o $DIR/$tdir/f $count &
-       pid=$!
-       echo "precreate count $(precreated_ost_obj_count 0 0)"
-       do_facet mds1 $LCTL set_param fail_loc=0
-       do_facet ost1 $LCTL set_param fail_loc=0
-       wait $pid || error "createmany failed"
-       echo "precreate count $(precreated_ost_obj_count 0 0)"
-}
-run_test 27S "don't deactivate OSP on network issue"
-
 test_27T() {
        [ $(facet_host client) == $(facet_host ost1) ] &&
                skip "need ost1 and client on different nodes"
@@ -15656,6 +15631,12 @@ test_155_big_load() {
        free_min_max
        local cache_size=$(do_facet ost$((MAXI+1)) \
                "awk '/cache/ {sum+=\\\$4} END {print sum}' /proc/cpuinfo")
+
+       # LU-16042: can not get the cache size on Arm64 VM here, fallback to a
+       # pre-set value
+       if [ -z "$cache_size" ]; then
+               cache_size=256
+       fi
        local large_file_size=$((cache_size * 2))
 
        echo "OSS cache size: $cache_size KB"
@@ -20744,10 +20725,12 @@ run_test 230v "subdir migrated to the MDT where its parent is located"
 
 test_230w() {
        (( MDSCOUNT > 1 )) || skip "needs >= 2 MDTs"
-       (( MDS1_VERSION >= $(version_code 2.14.53) )) ||
-               skip "Need MDS version at least 2.14.53"
+       (( MDS1_VERSION >= $(version_code 2.15.0) )) ||
+               skip "Need MDS version at least 2.15.0"
 
-       mkdir -p $DIR/$tdir/sub || error "mkdir failed"
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+       createmany -o $DIR/$tdir/f 10 || error "create files failed"
+       createmany -d $DIR/$tdir/d 10 || error "create dirs failed"
 
        $LFS migrate -m 1 -c $MDSCOUNT -d $DIR/$tdir ||
                error "migrate failed"
@@ -20755,8 +20738,10 @@ test_230w() {
        (( $($LFS getdirstripe -c $DIR/$tdir) == MDSCOUNT )) ||
                error "$tdir stripe count mismatch"
 
-       (( $($LFS getdirstripe -c $DIR/$tdir/sub) == 0 )) ||
-               error "$tdir/sub is striped"
+       for i in $(seq 0 9); do
+               (( $($LFS getdirstripe -c $DIR/$tdir/d$i) == 0 )) ||
+                       error "d$i is striped"
+       done
 }
 run_test 230w "non-recursive mode dir migration"
 
@@ -25598,6 +25583,7 @@ test_412() {
 }
 run_test 412 "mkdir on specific MDTs"
 
+TEST413_COUNT=${TEST413_COUNT:-200}
 generate_uneven_mdts() {
        local threshold=$1
        local lmv_qos_maxage
@@ -25655,23 +25641,24 @@ generate_uneven_mdts() {
        local testdir=$DIR/$tdir-fillmdt
        local start
 
-       mkdir -p $testdir
-
        i=0
        while (( diff < threshold )); do
+               mkdir -p $testdir
                # generate uneven MDTs, create till $threshold% diff
                echo -n "weight diff=$diff% must be > $threshold% ..."
-               echo "Fill MDT$min_index with 1000 files: loop $i"
+               echo "Fill MDT$min_index with $TEST413_COUNT files: loop $i"
                testdir=$DIR/$tdir-fillmdt/$i
-               [ -d $testdir ] || $LFS mkdir -i $min_index $testdir ||
+               [ -d $testdir ] && continue
+               $LFS mkdir -i $min_index $testdir ||
                        error "mkdir $testdir failed"
                $LFS setstripe -E 1M -L mdt $testdir ||
                        error "setstripe $testdir failed"
                start=$SECONDS
-               for F in f.{0..999}; do
-                       dd if=/dev/zero of=$testdir/$F bs=64K count=1 > \
+               for ((F=0; F < TEST413_COUNT; F++)); do
+                       dd if=/dev/zero of=$testdir/f.$F bs=128K count=1 > \
                                /dev/null 2>&1 || error "dd $F failed"
                done
+               sync; sleep 1; sync
 
                # wait for QOS to update
                (( SECONDS < start + 1 )) && sleep $((start + 1 - SECONDS))
@@ -26136,13 +26123,56 @@ test_413g() {
 }
 run_test 413g "enforce ROOT default LMV on subdir mount"
 
+test_413h() {
+       (( MDSCOUNT >= 2 )) ||
+               skip "We need at least 2 MDTs for this test"
+
+       (( MDS1_VERSION >= $(version_code 2.15.50.6) )) ||
+               skip "Need server version at least 2.15.50.6"
+
+       local lmv_qos_maxage=$($LCTL get_param -n lmv.*.qos_maxage)
+
+       stack_trap "$LCTL set_param \
+               lmv.*.qos_maxage=$lmv_qos_maxage > /dev/null"
+       $LCTL set_param lmv.*.qos_maxage=1
+
+       local depth=5
+       local rr_depth=4
+       local dir=$DIR/$tdir/l1/l2/l3/l4/l5
+       local count=$((MDSCOUNT * 20))
+
+       generate_uneven_mdts 50
+
+       mkdir -p $dir || error "mkdir $dir failed"
+       stack_trap "rm -rf $dir"
+       $LFS setdirstripe -D -c 1 -i -1 --max-inherit=$depth \
+               --max-inherit-rr=$rr_depth $dir
+
+       for ((d=0; d < depth + 2; d++)); do
+               log "dir=$dir:"
+               for ((sub=0; sub < count; sub++)); do
+                       mkdir $dir/d$sub
+               done
+               $LFS getdirstripe -i $dir/d* | sort | uniq -c | sort -nr
+               local num=($($LFS getdirstripe -i $dir/d* | sort | uniq -c))
+               # subdirs within $rr_depth should be created round-robin
+               if (( d < rr_depth )); then
+                       (( ${num[0]} != count )) ||
+                               error "all objects created on MDT ${num[1]}"
+               fi
+
+               dir=$dir/d0
+       done
+}
+run_test 413h "don't stick to parent for round-robin dirs"
+
 test_413z() {
        local pids=""
        local subdir
        local pid
 
        for subdir in $(\ls -1 -d $DIR/d413*-fillmdt/*); do
-               unlinkmany $subdir/f. 1000 &
+               unlinkmany $subdir/f. $TEST413_COUNT &
                pids="$pids $!"
        done
 
@@ -28323,34 +28353,6 @@ test_820() {
 }
 run_test 820 "update max EA from open intent"
 
-test_822() {
-       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
-
-       save_lustre_params mds1 \
-               "osp.$FSNAME-OST*-osc-MDT0000.max_create_count" > $p
-       do_facet $SINGLEMDS "$LCTL set_param -n \
-                       osp.$FSNAME-OST*MDT0000.max_create_count=0"
-       do_facet $SINGLEMDS "$LCTL set_param -n \
-                       osp.$FSNAME-OST0000*MDT0000.max_create_count=20000"
-
-       # wait for statfs update to clear OS_STATFS_NOPRECREATE
-       local maxage=$(do_facet mds1 $LCTL get_param -n \
-                      osp.$FSNAME-OST0000*MDT0000.maxage)
-       sleep $((maxage + 1))
-
-       #define OBD_FAIL_NET_ERROR_RPC          0x532
-       do_facet mds1 "$LCTL set_param fail_loc=0x80000532 fail_val=5"
-
-       stack_trap "restore_lustre_params < $p; rm $p"
-
-       local count=$(do_facet $SINGLEMDS "lctl get_param -n \
-                     osp.$FSNAME-OST0000*MDT0000.create_count")
-       for i in $(seq 1 $count); do
-               touch $DIR/$tfile.${i} || error "touch failed"
-       done
-}
-run_test 822 "test precreate failure"
-
 test_823() {
        local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
        local OST_MAX_PRECREATE=20000