X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity-quota.sh;h=0492c793d4fa6f0cf5848623f428a5acf62389cd;hb=39dd7e0e437d0bc6ba70710d57fce12e8fd98832;hp=5b8cf28646c1ea31733251825613558f2f582285;hpb=e7f3c2955a426bbe3e39b32208056b9ab8667190;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 5b8cf28..0492c79 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -52,12 +52,10 @@ DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio} [ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0 -unset ENABLE_QUOTA - remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0 -[ "$SLOW" = "no" ] && EXCEPT_SLOW="9 10 11 18b 21 29" +[ "$SLOW" = "no" ] && EXCEPT_SLOW="9 10 11 18b 21" QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log} @@ -66,11 +64,15 @@ QUOTALOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log} DIR=${DIR:-$MOUNT} DIR2=${DIR2:-$MOUNT2} +QUOTA_AUTO_OLD=$QUOTA_AUTO +export QUOTA_AUTO=0 + check_and_setup_lustre if [ x"$(som_check)" = x"enabled" ]; then echo "Som is enabled, Quota is temporary conflicts with it" check_and_cleanup_lustre + export QUOTA_AUTO=$QUOTA_AUTO_OLD exit 0 fi @@ -336,8 +338,10 @@ test_1_sub() { $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error g $TSTUSR "(grp) write failure, but expect success" etime=`date +%s` delta=$((etime - stime)) - rate=$((BLK_SZ * LIMIT / 2 / delta / 1024)) - [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (group): $rate KB/sec" + if [ $delta -gt 0 ]; then + rate=$((BLK_SZ * LIMIT / 2 / delta / 1024)) + [ $rate -gt 1024 ] || error "SLOW IO for $TSTUSR (group): $rate KB/sec" + fi log " Done" log " Write out of block quota ..." # this time maybe cache write, ignore it's failure @@ -720,7 +724,7 @@ run_test_with_stat 5 "Chown & chgrp successfully even out of block/file quota == # block quota acquire & release test_6() { if [ $OSTCOUNT -lt 2 ]; then - skip "$OSTCOUNT < 2, too few osts" + skip_env "$OSTCOUNT < 2, too few osts" return 0; fi @@ -1038,7 +1042,7 @@ test_12() { chmod 0777 $DIR/$tdir [ "$(grep $DIR2 /proc/mounts)" ] || mount_client $DIR2 || \ - { skip "Need lustre mounted on $MOUNT2 " && retutn 0; } + { skip_env "Need lustre mounted on $MOUNT2 " && retutn 0; } LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 10)) # 10 bunits each sever TESTFILE="$DIR/$tdir/$tfile-0" @@ -1065,17 +1069,24 @@ test_12() { DDPID=$! echo " step2: testing ......" - count=0 - while [ true ]; do - if ! ps -p ${DDPID1} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 64 ]; then + local last_size=$(stat -c %s $TESTFILE2) + local stall_secs=0 + local start_secs=$SECONDS + while [ -d /proc/${DDPID1} ]; do + local size=$(stat -c %s $TESTFILE2) + if [ $size -eq $last_size ]; then + stall_secs=$[stall_secs+1] + else + stall_secs=0 + fi + if [ $stall_secs -gt 30 ]; then lustre_fail ost 0 - quota_error u $TSTUSR2 "dd should be finished!" + quota_error u $TSTUSR2 "giving up: dd stalled (i.e. made no progress) for 30 seconds!" fi + last_size=$size sleep 1 done - echo "(dd_pid=$DDPID1, time=$count)successful" + echo "(dd_pid=$DDPID1, time=$((SECONDS-start_secs)))successful" #Recover fail_loc and dd will finish soon lustre_fail ost 0 @@ -2051,36 +2062,12 @@ test_28() { } run_test_with_stat 28 "test for consistency for qunit when setquota (18574) ===========" -test_30() -{ - local output - local LIMIT=1024 - local TESTFILE="$DIR/$tdir/$tfile" - local GRACE=10 - - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - - $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR - $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR - $RUNAS dd if=/dev/zero of=$TESTFILE bs=1024 count=$((LIMIT * 2)) || true - cancel_lru_locks osc - sleep 5 - $LFS setquota -u $TSTUSR -B 0 $DIR - output=`$SHOW_QUOTA_USER | grep $MOUNT | awk '{ print $5 }' | tr -d s` - [ "$output" -le "$((GRACE - 5))" ] || error "grace times were reset or unexpectedly high latency" - rm -f $TESTFILE - resetquota -u $TSTUSR - $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR -} -run_test_with_stat 30 "hard limit updates should not reset grace times ================" - test_29() { local BLK_LIMIT=$((100 * 1024 * 1024)) # 100G local timeout local pid - local resends + local origin_resends if at_is_enabled; then timeout=$(at_max_get client) @@ -2090,15 +2077,16 @@ test_29() lctl set_param timeout=10 fi - resends=$(lctl get_param -n mdc.${FSNAME}-*.quota_resend_count | head -1) + origin_resends=$(lctl get_param -n mdc.${FSNAME}-*.quota_resend_count | head -1) + lctl set_param -n mdc.${FSNAME}-*.quota_resend_count 0 #define OBD_FAIL_MDS_QUOTACTL_NET 0x12e lustre_fail mds 0x12e $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR & pid=$! - echo "sleeping for $((10 * resends + 5)) seconds" - sleep $((10 * resends + 5)) + echo "sleeping for $((10 * 2)) seconds" + sleep $((10 * 2)) ps -p $pid && error "lfs hadn't finished by timeout" wait $pid && error "succeeded, but should have failed" @@ -2110,10 +2098,36 @@ test_29() lctl set_param timeout=$timeout fi + lctl set_param -n mdc.${FSNAME}-*.quota_resend_count $origin_resends resetquota -u $TSTUSR } run_test_with_stat 29 "unhandled quotactls must not hang lustre client (19778) ========" +test_30() +{ + local output + local LIMIT=1024 + local TESTFILE="$DIR/$tdir/$tfile" + local GRACE=10 + + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + + $LFS setquota -t -u --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR + $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR + $RUNAS dd if=/dev/zero of=$TESTFILE bs=1024 count=$((LIMIT * 2)) || true + cancel_lru_locks osc + sleep 5 + $LFS setquota -u $TSTUSR -B 0 $DIR + $SHOW_QUOTA_USER + output=`$SHOW_QUOTA_USER | grep $MOUNT | awk '{ print $5 }' | tr -d s` + [ "$output" -le "$((GRACE - 5))" ] || error "grace times were reset or unexpectedly high latency" + rm -f $TESTFILE + resetquota -u $TSTUSR + $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR +} +run_test_with_stat 30 "hard limit updates should not reset grace times ================" + # turn off quota quota_fini() { @@ -2126,5 +2140,6 @@ log "cleanup: ======================================================" cd $ORIG_PWD check_and_cleanup_lustre echo '=========================== finished ===============================' +export QUOTA_AUTO=$QUOTA_AUTO_OLD [ -f "$QUOTALOG" ] && cat $QUOTALOG && grep -q FAIL $QUOTALOG && exit 1 || true echo "$0: completed"