From: anserper Date: Thu, 18 Dec 2008 23:32:38 +0000 (+0000) Subject: b=16890 X-Git-Tag: v1_8_0_110~382 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=0642c83bfb0447e26e2e084b21a7dd73a6573705;p=fs%2Flustre-release.git b=16890 i=Girish Shilamkar introduce resetquota for shortness --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 7834df3..1f27d4d 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -160,13 +160,24 @@ run_test_with_stat() { fi } +# +# clear quota limits for a user or a group +# usage: resetquota -u username +# resetquota -g groupname + +resetquota() { + [ "$#" != 2 ] && error "resetquota: wrong number of arguments: $#" + [ "$1" != "-u" -a "$1" != "-g" ] && error "resetquota: wrong specifier $1 passed" + $LFS setquota "$1" "$2" -b 0 -B 0 -i 0 -I 0 $MOUNT || error "resetquota failed" +} + # set quota test_0() { $LFS quotaoff -ug $DIR $LFS quotacheck -ug $DIR - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR + resetquota -g $TSTUSR lctl set_param debug="+quota" do_facet mds "lctl set_param debug=+quota" @@ -212,7 +223,7 @@ test_1_sub() { [ $OST0_QUOTA_USED -ne 0 ] && \ ($SHOW_QUOTA_USER; error "quota deleted isn't released") $SHOW_QUOTA_USER - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR # test for group log "--------------------------------------" @@ -243,7 +254,7 @@ test_1_sub() { [ $OST0_QUOTA_USED -ne 0 ] && \ ($SHOW_QUOTA_USER; error "quota deleted isn't released") $SHOW_QUOTA_GROUP - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -g $TSTUSR } # block hard limit (normal use and out of quota) @@ -298,7 +309,7 @@ test_2_sub() { [ $MDS_QUOTA_USED -ne 0 ] && \ ($SHOW_QUOTA_USER; error "quota deleted isn't released") $SHOW_QUOTA_USER - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR # test for group log "--------------------------------------" @@ -326,7 +337,7 @@ test_2_sub() { [ $MDS_QUOTA_USED -ne 0 ] && \ ($SHOW_QUOTA_USER; error "quota deleted isn't released") $SHOW_QUOTA_GROUP - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -g $TSTUSR } # file hard limit (normal use and out of quota) @@ -436,7 +447,7 @@ test_3() { $LFS setquota -u $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR test_block_soft $TESTFILE $GRACE - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR echo " Group quota (soft limit: $LIMIT kbytes grace: $GRACE seconds)" TESTFILE=$DIR/$tdir/$tfile-1 @@ -448,7 +459,7 @@ test_3() { $LFS setquota -g $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR test_block_soft $TESTFILE $GRACE - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -g $TSTUSR } run_test_with_stat 3 "Block soft limit (start timer, timer goes off, stop timer) ===" @@ -521,7 +532,7 @@ test_4a() { # was test_4 $SHOW_QUOTA_USER test_file_soft $TESTFILE $LIMIT $GRACE - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR echo " Group quota (soft limit: $LIMIT files grace: $GRACE seconds)" $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR @@ -530,7 +541,7 @@ test_4a() { # was test_4 TESTFILE=$DIR/$tdir/$tfile-1 test_file_soft $TESTFILE $LIMIT $GRACE - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -g $TSTUSR # cleanup $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR @@ -595,8 +606,8 @@ test_5() { unlinkmany $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR + resetquota -g $TSTUSR } run_test_with_stat 5 "Chown & chgrp successfully even out of block/file quota ===" @@ -662,8 +673,8 @@ test_6() { rm -f $FILEA sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR + resetquota -g $TSTUSR return 0 } run_test_with_stat 6 "Block quota acquire & release =========" @@ -716,7 +727,7 @@ test_7() echo " limits on $OST0_UUID = $OST0_LIMIT" # cleanup - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR } run_test_with_stat 7 "Quota recovery (only block limit) ======" @@ -1011,7 +1022,7 @@ test_12() { rm -f $TESTFILE $TESTFILE2 sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR } run_test_with_stat 12 "test a deadlock between quota and journal ===" @@ -1075,7 +1086,7 @@ test_13() { rm -f $TESTFILE $TESTFILE.2 sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR } run_test_with_stat 13 "test multiple clients write block quota ===" @@ -1124,7 +1135,7 @@ test_14a() { # was test_14 b=12223 -- setting quota on root # do the check dmesg | tail | grep "\-122" |grep llog_obd_origin_add && error "err -122 not found in dmesg" - $LFS setquota -u root -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u root #check_if_quota_zero u root # clean @@ -1215,7 +1226,7 @@ test_14b(){ echo "...real is $l" [ "$l" -eq "${CURSPACE[$i]}" ] || error "curspace mismatch" rm $DIR/$tdir/quota15_$i || error "could not remove quota15_$i" - $LFS setquota -u quota15_$i -b 0 -B 0 -i 0 -I 0 $DIR || error "lfs setquota clear failed" + resetquota -u quota15_$i done } run_test_with_stat 14b "setting 30 quota entries in quota v1 file before conversion ===" @@ -1231,14 +1242,14 @@ test_15(){ TOTAL_LIMIT="`$LFS quota -v -u $TSTUSR $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $4 }'`" [ $TOTAL_LIMIT -eq $LIMIT ] || error " (user)total limits = $TOTAL_LIMIT; limit = $LIMIT, failed!" echo " (user)total limits = $TOTAL_LIMIT; limit = $LIMIT, successful!" - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR # test for group $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR TOTAL_LIMIT="`$LFS quota -v -g $TSTUSR $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $4 }'`" [ $TOTAL_LIMIT -eq $LIMIT ] || error " (group)total limits = $TOTAL_LIMIT; limit = $LIMIT, failed!" echo " (group)total limits = $TOTAL_LIMIT; limit = $LIMIT, successful!" - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -g $TSTUSR $LFS quotaoff -ug $DIR quota_set_version 1 $LFS quotacheck -ug $DIR || error "quotacheck failed" @@ -1287,7 +1298,7 @@ test_16_tub() { rm -f $TESTFILE sync; sleep 3; sync; - $LFS setquota -$1 $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -$1 $TSTUSR } # test without adjusting qunit @@ -1362,8 +1373,8 @@ test_17() { set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2)) - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR + resetquota -g $TSTUSR return $RC } @@ -1417,7 +1428,7 @@ test_18() { rm -f $TESTFILE sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2)) @@ -1468,7 +1479,7 @@ test_18a() { rm -f $TESTFILE sync; sleep 3; sync; - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2)) @@ -1535,7 +1546,7 @@ test_18bc_sub() { [ $testfile_size -ne $((BLK_SZ * 1024 * 100)) ] && \ error "expect $((BLK_SZ * 1024 * 100)), got ${testfile_size}. Verifying file failed!" $SHOW_QUOTA_USER - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR rm -rf $TESTFILE sync; sleep 1; sync } @@ -1608,7 +1619,7 @@ test_19() { # cleanup rm -f $TESTFILE - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2)) @@ -1633,9 +1644,7 @@ test_20() grep -E '^ *'$MOUNT' *[0-9]+\** *'${LVAL[0]}' *'${LVAL[1]}' *[0-9]+\** *'${LVAL[2]}' *'${LVAL[3]}) \ || error "lfs quota output is unexpected" - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 \ - $MOUNT || error "could not reset quota limits" - + resetquota -u $TSTUSR } run_test_with_stat 20 "test if setquota specifiers work properly (15754)" @@ -1710,8 +1719,8 @@ test_21() { set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2)) - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT - $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR + resetquota -g $TSTUSR return $RC } @@ -1779,7 +1788,7 @@ test_23_sub() { [ $OST0_QUOTA_USED -ne 0 ] && \ ($SHOW_QUOTA_USER; error "quota deleted isn't released") $SHOW_QUOTA_USER - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $DIR + resetquota -u $TSTUSR } @@ -1803,7 +1812,7 @@ test_24() { # cleanup rm -f $TESTFILE - $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I 0 $MOUNT + resetquota -u $TSTUSR set_blk_unitsz $((128 * 1024)) set_blk_tunesz $((128 * 1024 / 2))