From: brian Date: Fri, 25 Sep 2009 15:49:57 +0000 (+0000) Subject: De-tabbify -- since I last touched it and didn't include tabs in my own X-Git-Tag: v1_8_2_01~1^2~72 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9584228e01263e91d4fb4f79062b3b86b834e54a;p=fs%2Flustre-release.git De-tabbify -- since I last touched it and didn't include tabs in my own patch -- per our coding standards. --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 9f627b9..bb78b3b 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -28,7 +28,7 @@ case `uname -r` in esac [ "$ALWAYS_EXCEPT$EXCEPT" ] && \ - echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`" + echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT`" TMP=${TMP:-/tmp} @@ -38,8 +38,8 @@ TSTID2=${TSTID2:-60001} TSTUSR=${TSTUSR:-"quota_usr"} TSTUSR2=${TSTUSR2:-"quota_2usr"} BLK_SZ=1024 -BUNIT_SZ=${BUNIT_SZ:-1024} # min block quota unit(kB) -IUNIT_SZ=${IUNIT_SZ:-10} # min inode quota unit +BUNIT_SZ=${BUNIT_SZ:-1024} # min block quota unit(kB) +IUNIT_SZ=${IUNIT_SZ:-10} # min inode quota unit MAX_DQ_TIME=604800 MAX_IQ_TIME=604800 @@ -89,61 +89,61 @@ eval ONLY_99=true # set_blk_tunables(btune_sz) set_blk_tunesz() { - local btune=$(($1 * BLK_SZ)) - # set btune size on all obdfilters - do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_btune_sz=$btune" - # set btune size on mds - do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_btune_sz=$btune" + local btune=$(($1 * BLK_SZ)) + # set btune size on all obdfilters + do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_btune_sz=$btune" + # set btune size on mds + do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_btune_sz=$btune" } # set_blk_unitsz(bunit_sz) set_blk_unitsz() { - local bunit=$(($1 * BLK_SZ)) - # set bunit size on all obdfilters - do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_bunit_sz=$bunit" - # set bunit size on mds - do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_bunit_sz=$bunit" + local bunit=$(($1 * BLK_SZ)) + # set bunit size on all obdfilters + do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_bunit_sz=$bunit" + # set bunit size on mds + do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_bunit_sz=$bunit" } # set_file_tunesz(itune_sz) set_file_tunesz() { - local itune=$1 - # set itune size on all obdfilters - do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_itune_sz=$itune" - # set itune size on mds - do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_itune_sz=$itune" + local itune=$1 + # set itune size on all obdfilters + do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_itune_sz=$itune" + # set itune size on mds + do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_itune_sz=$itune" } # set_file_unitsz(iunit_sz) set_file_unitsz() { - local iunit=$1 - # set iunit size on all obdfilters - do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_iunit_sz=$iunit" - # set iunit size on mds - do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_iunit_sz=$iunit" + local iunit=$1 + # set iunit size on all obdfilters + do_facet ost1 "lctl set_param lquota.${FSNAME}-OST*.quota_iunit_sz=$iunit" + # set iunit size on mds + do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.quota_iunit_sz=$iunit" } lustre_fail() { local fail_node=$1 - local fail_loc=$2 - local fail_val=${3:-0} - - if [ $fail_node == "mds" ] || [ $fail_node == "mds_ost" ]; then - if [ $((fail_loc & 0x10000000)) -ne 0 -a $fail_val -gt 0 ] || \ - [ $((fail_loc)) -eq 0 ]; then - do_facet mds "lctl set_param fail_val=$fail_val" - fi - do_facet mds "lctl set_param fail_loc=$fail_loc" - fi - if [ $fail_node == "ost" ] || [ $fail_node == "mds_ost" ]; then - for num in `seq $OSTCOUNT`; do - if [ $((fail_loc & 0x10000000)) -ne 0 -a $fail_val -gt 0 ] || \ - [ $((fail_loc)) -eq 0 ]; then - do_facet ost$num "lctl set_param fail_val=$fail_val" - fi - do_facet ost$num "lctl set_param fail_loc=$fail_loc" - done - fi + local fail_loc=$2 + local fail_val=${3:-0} + + if [ $fail_node == "mds" ] || [ $fail_node == "mds_ost" ]; then + if [ $((fail_loc & 0x10000000)) -ne 0 -a $fail_val -gt 0 ] || \ + [ $((fail_loc)) -eq 0 ]; then + do_facet mds "lctl set_param fail_val=$fail_val" + fi + do_facet mds "lctl set_param fail_loc=$fail_loc" + fi + if [ $fail_node == "ost" ] || [ $fail_node == "mds_ost" ]; then + for num in `seq $OSTCOUNT`; do + if [ $((fail_loc & 0x10000000)) -ne 0 -a $fail_val -gt 0 ] || \ + [ $((fail_loc)) -eq 0 ]; then + do_facet ost$num "lctl set_param fail_val=$fail_val" + fi + do_facet ost$num "lctl set_param fail_loc=$fail_loc" + done + fi } RUNAS="runas -u $TSTID -g $TSTID" @@ -154,21 +154,21 @@ FAIL_ON_ERROR=true check_runas_id $TSTID2 $TSTID2 $RUNAS2 FAIL_ON_ERROR=false run_test_with_stat() { - (($# != 2)) && error "the number of arguments is wrong" - - do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.stats=0" > /dev/null - for j in `seq $OSTCOUNT`; do - do_facet ost$j "lctl set_param lquota.${FSNAME}-OST*.stats=0" > /dev/null - done - run_test "$@" - if [ ${STAT:-"yes"} != "no" -a -z "$LAST_SKIPPED" ]; then - echo "statistics info begin ***************************************" - do_facet mds "lctl get_param lquota.${FSNAME}-MDT*.stats" - for j in `seq $OSTCOUNT`; do - do_facet ost$j "lctl get_param lquota.${FSNAME}-OST*.stats" - done - echo "statistics info end ***************************************" - fi + (($# != 2)) && error "the number of arguments is wrong" + + do_facet mds "lctl set_param lquota.${FSNAME}-MDT*.stats=0" > /dev/null + for j in `seq $OSTCOUNT`; do + do_facet ost$j "lctl set_param lquota.${FSNAME}-OST*.stats=0" > /dev/null + done + run_test "$@" + if [ ${STAT:-"yes"} != "no" -a -z "$LAST_SKIPPED" ]; then + echo "statistics info begin ***************************************" + do_facet mds "lctl get_param lquota.${FSNAME}-MDT*.stats" + for j in `seq $OSTCOUNT`; do + do_facet ost$j "lctl get_param lquota.${FSNAME}-OST*.stats" + done + echo "statistics info end ***************************************" + fi } # @@ -182,9 +182,9 @@ resetquota() { count=0 if at_is_enabled; then - timeout=$(at_max_get mds) + timeout=$(at_max_get mds) else - timeout=$(lctl get_param -n timeout) + timeout=$(lctl get_param -n timeout) fi while [ $((count++)) -lt $timeout ]; do @@ -236,12 +236,12 @@ quota_show_check() { LOCAL_BF=$1 LOCAL_UG=$2 LOCAL_ID=$3 - PATTERN="`echo $DIR | sed 's/\//\\\\\//g'`" + PATTERN="`echo $DIR | sed 's/\//\\\\\//g'`" $LFS quota -v -$LOCAL_UG $LOCAL_ID $DIR if [ "$LOCAL_BF" == "a" -o "$LOCAL_BF" == "b" ]; then - USAGE="`$LFS quota -$LOCAL_UG $LOCAL_ID $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $2 }'`" + USAGE="`$LFS quota -$LOCAL_UG $LOCAL_ID $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $2 }'`" if [ -z $USAGE ]; then quota_error $LOCAL_UG $LOCAL_ID "System is error when query quota for block ($LOCAL_UG:$LOCAL_ID)." else @@ -250,7 +250,7 @@ quota_show_check() { fi if [ "$LOCAL_BF" == "a" -o "$LOCAL_BF" == "f" ]; then - USAGE="`$LFS quota -$LOCAL_UG $LOCAL_ID $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $5 }'`" + USAGE="`$LFS quota -$LOCAL_UG $LOCAL_ID $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $5 }'`" if [ -z $USAGE ]; then quota_error $LOCAL_UG $LOCAL_ID "System is error when query quota for file ($LOCAL_UG:$LOCAL_ID)." else @@ -261,63 +261,63 @@ quota_show_check() { # set quota test_0() { - $LFS quotaoff -ug $DIR - $LFS quotacheck -ug $DIR + $LFS quotaoff -ug $DIR + $LFS quotacheck -ug $DIR - resetquota -u $TSTUSR - resetquota -g $TSTUSR + resetquota -u $TSTUSR + resetquota -g $TSTUSR - lctl set_param debug="+quota" - do_facet mds "lctl set_param debug=+quota" - for num in `seq $OSTCOUNT`; do - do_facet ost$num "lctl set_param debug=+quota" - done + lctl set_param debug="+quota" + do_facet mds "lctl set_param debug=+quota" + for num in `seq $OSTCOUNT`; do + do_facet ost$num "lctl set_param debug=+quota" + done } run_test_with_stat 0 "Set quota =============================" # test for specific quota limitation, qunit, qtune $1=block_quota_limit test_1_sub() { LIMIT=$1 - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir TESTFILE="$DIR/$tdir/$tfile-0" - wait_delete_completed + wait_delete_completed # test for user log " User quota (limit: $LIMIT kbytes)" $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - sleep 3 - quota_show_check b u $TSTUSR + sleep 3 + quota_show_check b u $TSTUSR $LFS setstripe $TESTFILE -c 1 chown $TSTUSR.$TSTUSR $TESTFILE log " Write ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error u $TSTUSR "(usr) write failure, but expect success" + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error u $TSTUSR "(usr) write failure, but expect success" log " Done" log " Write out of block quota ..." - # this time maybe cache write, ignore it's failure + # this time maybe cache write, ignore it's failure $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) seek=$(($LIMIT/2)) || true - # flush cache, ensure noquota flag is setted on client + # flush cache, ensure noquota flag is setted on client cancel_lru_locks osc - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$LIMIT && quota_error u $TSTUSR "(usr) write success, but expect EDQUOT" + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$LIMIT && quota_error u $TSTUSR "(usr) write success, but expect EDQUOT" rm -f $TESTFILE - sync; sleep 1; sync; - OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` - OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` - echo $OST0_QUOTA_USED - [ $OST0_QUOTA_USED -ne 0 ] && \ - ($SHOW_QUOTA_USER; quota_error u $TSTUSR "(usr) quota deleted isn't released") - $SHOW_QUOTA_USER + sync; sleep 1; sync; + OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` + OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + echo $OST0_QUOTA_USED + [ $OST0_QUOTA_USED -ne 0 ] && \ + ($SHOW_QUOTA_USER; quota_error u $TSTUSR "(usr) quota deleted isn't released") + $SHOW_QUOTA_USER resetquota -u $TSTUSR # test for group - log "--------------------------------------" + log "--------------------------------------" log " Group quota (limit: $LIMIT kbytes)" $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - sleep 3 + sleep 3 quota_show_check b g $TSTUSR TESTFILE="$DIR/$tdir/$tfile-1" @@ -325,41 +325,41 @@ test_1_sub() { chown $TSTUSR.$TSTUSR $TESTFILE log " Write ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error g $TSTUSR "(grp) write failure, but expect success" + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) || quota_error g $TSTUSR "(grp) write failure, but expect success" log " Done" log " Write out of block quota ..." - # this time maybe cache write, ignore it's failure + # this time maybe cache write, ignore it's failure $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT/2)) seek=$(($LIMIT/2)) || true cancel_lru_locks osc - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$LIMIT && quota_error g $TSTUSR "(grp) write success, but expect EDQUOT" + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$LIMIT && quota_error g $TSTUSR "(grp) write success, but expect EDQUOT" - # cleanup + # cleanup rm -f $TESTFILE - sync; sleep 1; sync; - OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` - OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` - echo $OST0_QUOTA_USED - [ $OST0_QUOTA_USED -ne 0 ] && \ - ($SHOW_QUOTA_GROUP; quota_error g $TSTUSR "(grp) quota deleted isn't released") - $SHOW_QUOTA_GROUP + sync; sleep 1; sync; + OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` + OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + echo $OST0_QUOTA_USED + [ $OST0_QUOTA_USED -ne 0 ] && \ + ($SHOW_QUOTA_GROUP; quota_error g $TSTUSR "(grp) quota deleted isn't released") + $SHOW_QUOTA_GROUP resetquota -g $TSTUSR } # block hard limit (normal use and out of quota) test_1() { - for i in `seq 1 $cycle`; do - # define blk_qunit is between 1M and 4M - blk_qunit=$(( $RANDOM % 3072 + 1024 )) - blk_qtune=$(( $RANDOM % $blk_qunit )) - # other osts and mds will occupy at 1M blk quota - b_limit=$(( ($RANDOM - 16384) / 8 + $OSTCOUNT * $blk_qunit * 4 )) - set_blk_tunesz $blk_qtune - set_blk_unitsz $blk_qunit - echo "cycle: $i(total $cycle) bunit:$blk_qunit, btune:$blk_qtune, blimit:$b_limit" - test_1_sub $b_limit - echo "==================================================" - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + for i in `seq 1 $cycle`; do + # define blk_qunit is between 1M and 4M + blk_qunit=$(( $RANDOM % 3072 + 1024 )) + blk_qtune=$(( $RANDOM % $blk_qunit )) + # other osts and mds will occupy at 1M blk quota + b_limit=$(( ($RANDOM - 16384) / 8 + $OSTCOUNT * $blk_qunit * 4 )) + set_blk_tunesz $blk_qtune + set_blk_unitsz $blk_qunit + echo "cycle: $i(total $cycle) bunit:$blk_qunit, btune:$blk_qtune, blimit:$b_limit" + test_1_sub $b_limit + echo "==================================================" + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) done } run_test_with_stat 1 "Block hard limit (normal use and out of quota) ===" @@ -367,118 +367,118 @@ run_test_with_stat 1 "Block hard limit (normal use and out of quota) ===" # test for specific quota limitation, qunit, qtune $1=block_quota_limit test_2_sub() { LIMIT=$1 - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir TESTFILE="$DIR/$tdir/$tfile-0" - wait_delete_completed + wait_delete_completed # test for user log " User quota (limit: $LIMIT files)" $LFS setquota -u $TSTUSR -b 0 -B 0 -i 0 -I $LIMIT $DIR - sleep 3 + sleep 3 quota_show_check f u $TSTUSR - log " Create $LIMIT files ..." - $RUNAS createmany -m ${TESTFILE} $LIMIT || \ - quota_error u $TSTUSR "(usr) create failure, but expect success" - log " Done" - log " Create out of file quota ..." - $RUNAS touch ${TESTFILE}_xxx && \ - quota_error u $TSTUSR "(usr) touch success, but expect EDQUOT" - - unlinkmany ${TESTFILE} $LIMIT - rm -f ${TESTFILE}_xxx - sync; sleep 1; sync; - - MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` - MDS_QUOTA_USED=`$LFS quota -o $MDS_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` - echo $MDS_QUOTA_USED - [ $MDS_QUOTA_USED -ne 0 ] && \ - ($SHOW_QUOTA_USER; quota_error u $TSTUSR "(usr) quota deleted isn't released") - $SHOW_QUOTA_USER - resetquota -u $TSTUSR + log " Create $LIMIT files ..." + $RUNAS createmany -m ${TESTFILE} $LIMIT || \ + quota_error u $TSTUSR "(usr) create failure, but expect success" + log " Done" + log " Create out of file quota ..." + $RUNAS touch ${TESTFILE}_xxx && \ + quota_error u $TSTUSR "(usr) touch success, but expect EDQUOT" + + unlinkmany ${TESTFILE} $LIMIT + rm -f ${TESTFILE}_xxx + sync; sleep 1; sync; + + MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` + MDS_QUOTA_USED=`$LFS quota -o $MDS_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + echo $MDS_QUOTA_USED + [ $MDS_QUOTA_USED -ne 0 ] && \ + ($SHOW_QUOTA_USER; quota_error u $TSTUSR "(usr) quota deleted isn't released") + $SHOW_QUOTA_USER + resetquota -u $TSTUSR # test for group - log "--------------------------------------" + log "--------------------------------------" log " Group quota (limit: $LIMIT FILE)" $LFS setquota -g $TSTUSR -b 0 -B 0 -i 0 -I $LIMIT $DIR - sleep 3 + sleep 3 quota_show_check f g $TSTUSR TESTFILE=$DIR/$tdir/$tfile-1 - log " Create $LIMIT files ..." - $RUNAS createmany -m ${TESTFILE} $LIMIT || \ - quota_error g $TSTUSR "(grp) create failure, but expect success" - log " Done" - log " Create out of file quota ..." - $RUNAS touch ${TESTFILE}_xxx && \ - quota_error g $TSTUSR "(grp) touch success, but expect EDQUOT" - - unlinkmany ${TESTFILE} $LIMIT - rm -f ${TESTFILE}_xxx - sync; sleep 1; sync; - - MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` - MDS_QUOTA_USED=`$LFS quota -o $MDS_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` - echo $MDS_QUOTA_USED - [ $MDS_QUOTA_USED -ne 0 ] && \ - ($SHOW_QUOTA_GROUP; quota_error g $TSTUSR "(grp) quota deleted isn't released") - $SHOW_QUOTA_GROUP + log " Create $LIMIT files ..." + $RUNAS createmany -m ${TESTFILE} $LIMIT || \ + quota_error g $TSTUSR "(grp) create failure, but expect success" + log " Done" + log " Create out of file quota ..." + $RUNAS touch ${TESTFILE}_xxx && \ + quota_error g $TSTUSR "(grp) touch success, but expect EDQUOT" + + unlinkmany ${TESTFILE} $LIMIT + rm -f ${TESTFILE}_xxx + sync; sleep 1; sync; + + MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` + MDS_QUOTA_USED=`$LFS quota -o $MDS_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + echo $MDS_QUOTA_USED + [ $MDS_QUOTA_USED -ne 0 ] && \ + ($SHOW_QUOTA_GROUP; quota_error g $TSTUSR "(grp) quota deleted isn't released") + $SHOW_QUOTA_GROUP resetquota -g $TSTUSR } # file hard limit (normal use and out of quota) test_2() { - for i in `seq 1 $cycle`; do - if [ $i -eq 1 ]; then - ino_qunit=52 - ino_qtune=41 - i_limit=11 - else - # define ino_qunit is between 10 and 100 - ino_qunit=$(( $RANDOM % 90 + 10 )) - ino_qtune=$(( $RANDOM % $ino_qunit )) + for i in `seq 1 $cycle`; do + if [ $i -eq 1 ]; then + ino_qunit=52 + ino_qtune=41 + i_limit=11 + else + # define ino_qunit is between 10 and 100 + ino_qunit=$(( $RANDOM % 90 + 10 )) + ino_qtune=$(( $RANDOM % $ino_qunit )) # RANDOM's maxium is 32767 - i_limit=$(( $RANDOM % 990 + 10 )) - fi + i_limit=$(( $RANDOM % 990 + 10 )) + fi set_file_tunesz $ino_qtune - set_file_unitsz $ino_qunit - echo "cycle: $i(total $cycle) iunit:$ino_qunit, itune:$ino_qtune, ilimit:$i_limit" - test_2_sub $i_limit - echo "==================================================" - set_file_unitsz 5120 - set_file_tunesz 2560 + set_file_unitsz $ino_qunit + echo "cycle: $i(total $cycle) iunit:$ino_qunit, itune:$ino_qtune, ilimit:$i_limit" + test_2_sub $i_limit + echo "==================================================" + set_file_unitsz 5120 + set_file_tunesz 2560 done } run_test_with_stat 2 "File hard limit (normal use and out of quota) ===" test_block_soft() { - TESTFILE=$1 - TIMER=$(($2 * 3 / 2)) - OFFSET=0 + TESTFILE=$1 + TIMER=$(($2 * 3 / 2)) + OFFSET=0 - wait_delete_completed + wait_delete_completed - echo " Write to exceed soft limit" - RUNDD="$RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ" - $RUNDD count=$((BUNIT_SZ+1)) || \ - quota_error a $TSTUSR "write failure, but expect success" - OFFSET=$((OFFSET + BUNIT_SZ + 1)) + echo " Write to exceed soft limit" + RUNDD="$RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ" + $RUNDD count=$((BUNIT_SZ+1)) || \ + quota_error a $TSTUSR "write failure, but expect success" + OFFSET=$((OFFSET + BUNIT_SZ + 1)) cancel_lru_locks osc - $SHOW_QUOTA_USER - $SHOW_QUOTA_GROUP - $SHOW_QUOTA_INFO_USER - $SHOW_QUOTA_INFO_GROUP + $SHOW_QUOTA_USER + $SHOW_QUOTA_GROUP + $SHOW_QUOTA_INFO_USER + $SHOW_QUOTA_INFO_GROUP - echo " Write before timer goes off" - $RUNDD count=$BUNIT_SZ seek=$OFFSET || \ - quota_error a $TSTUSR "write failure, but expect success" - OFFSET=$((OFFSET + BUNIT_SZ)) + echo " Write before timer goes off" + $RUNDD count=$BUNIT_SZ seek=$OFFSET || \ + quota_error a $TSTUSR "write failure, but expect success" + OFFSET=$((OFFSET + BUNIT_SZ)) cancel_lru_locks osc - echo " Done" + echo " Done" echo " Sleep $TIMER seconds ..." sleep $TIMER @@ -488,162 +488,162 @@ test_block_soft() { $SHOW_QUOTA_INFO_USER $SHOW_QUOTA_INFO_GROUP - echo " Write after timer goes off" - # maybe cache write, ignore. - $RUNDD count=$BUNIT_SZ seek=$OFFSET || true - OFFSET=$((OFFSET + BUNIT_SZ)) + echo " Write after timer goes off" + # maybe cache write, ignore. + $RUNDD count=$BUNIT_SZ seek=$OFFSET || true + OFFSET=$((OFFSET + BUNIT_SZ)) cancel_lru_locks osc - $RUNDD count=$BUNIT_SZ seek=$OFFSET && \ - quota_error a $TSTUSR "write success, but expect EDQUOT" + $RUNDD count=$BUNIT_SZ seek=$OFFSET && \ + quota_error a $TSTUSR "write success, but expect EDQUOT" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP $SHOW_QUOTA_INFO_USER $SHOW_QUOTA_INFO_GROUP - echo " Unlink file to stop timer" - rm -f $TESTFILE - sync; sleep 1; sync - echo " Done" + echo " Unlink file to stop timer" + rm -f $TESTFILE + sync; sleep 1; sync + echo " Done" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP $SHOW_QUOTA_INFO_USER $SHOW_QUOTA_INFO_GROUP - echo " Write ..." - $RUNDD count=$BUNIT_SZ || quota_error a $TSTUSR "write failure, but expect success" - echo " Done" + echo " Write ..." + $RUNDD count=$BUNIT_SZ || quota_error a $TSTUSR "write failure, but expect success" + echo " Done" - # cleanup - rm -f $TESTFILE - sync; sleep 3; sync; + # cleanup + rm -f $TESTFILE + sync; sleep 3; sync; } # block soft limit (start timer, timer goes off, stop timer) test_3() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir # 1 bunit on mds and 1 bunit on every ost - LIMIT=$(( $BUNIT_SZ * ($OSTCOUNT + 1) )) - GRACE=10 + LIMIT=$(( $BUNIT_SZ * ($OSTCOUNT + 1) )) + GRACE=10 - echo " User quota (soft limit: $LIMIT kbytes grace: $GRACE seconds)" - TESTFILE=$DIR/$tdir/$tfile-0 + echo " User quota (soft limit: $LIMIT kbytes grace: $GRACE seconds)" + TESTFILE=$DIR/$tdir/$tfile-0 - $LFS setstripe $TESTFILE -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE - $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 + $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 - test_block_soft $TESTFILE $GRACE - resetquota -u $TSTUSR + test_block_soft $TESTFILE $GRACE + resetquota -u $TSTUSR - echo " Group quota (soft limit: $LIMIT kbytes grace: $GRACE seconds)" - TESTFILE=$DIR/$tdir/$tfile-1 + echo " Group quota (soft limit: $LIMIT kbytes grace: $GRACE seconds)" + TESTFILE=$DIR/$tdir/$tfile-1 - $LFS setstripe $TESTFILE -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE - $LFS setquota -t -g --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR - $LFS setquota -g $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR + $LFS setquota -t -g --block-grace $GRACE --inode-grace $MAX_IQ_TIME $DIR + $LFS setquota -g $TSTUSR -b $LIMIT -B 0 -i 0 -I 0 $DIR - test_block_soft $TESTFILE $GRACE - resetquota -g $TSTUSR + test_block_soft $TESTFILE $GRACE + resetquota -g $TSTUSR } run_test_with_stat 3 "Block soft limit (start timer, timer goes off, stop timer) ===" test_file_soft() { - TESTFILE=$1 - LIMIT=$2 - TIMER=$(($3 * 3 / 2)) - - wait_delete_completed - - echo " Create files to exceed soft limit" - $RUNAS createmany -m ${TESTFILE}_ $((LIMIT + 1)) || \ - quota_error a $TSTUSR "create failure, but expect success" - sync; sleep 1; sync - echo " Done" - - echo " Create file before timer goes off" - $RUNAS touch ${TESTFILE}_before || \ - quota_error a $TSTUSR "failed create before timer expired, but expect success" - sync; sleep 1; sync - echo " Done" - - echo " Sleep $TIMER seconds ..." - sleep $TIMER - - $SHOW_QUOTA_USER - $SHOW_QUOTA_GROUP - $SHOW_QUOTA_INFO_USER - $SHOW_QUOTA_INFO_GROUP - - echo " Create file after timer goes off" - # the least of inode qunit is 2, so there are at most 3(qunit:2+qtune:1) + TESTFILE=$1 + LIMIT=$2 + TIMER=$(($3 * 3 / 2)) + + wait_delete_completed + + echo " Create files to exceed soft limit" + $RUNAS createmany -m ${TESTFILE}_ $((LIMIT + 1)) || \ + quota_error a $TSTUSR "create failure, but expect success" + sync; sleep 1; sync + echo " Done" + + echo " Create file before timer goes off" + $RUNAS touch ${TESTFILE}_before || \ + quota_error a $TSTUSR "failed create before timer expired, but expect success" + sync; sleep 1; sync + echo " Done" + + echo " Sleep $TIMER seconds ..." + sleep $TIMER + + $SHOW_QUOTA_USER + $SHOW_QUOTA_GROUP + $SHOW_QUOTA_INFO_USER + $SHOW_QUOTA_INFO_GROUP + + echo " Create file after timer goes off" + # the least of inode qunit is 2, so there are at most 3(qunit:2+qtune:1) # inode quota left here - $RUNAS touch ${TESTFILE}_after ${TESTFILE}_after1 ${TESTFILE}_after2 || true - sync; sleep 1; sync - $RUNAS touch ${TESTFILE}_after3 && \ - quota_error a $TSTUSR "create after timer expired, but expect EDQUOT" - sync; sleep 1; sync - - $SHOW_QUOTA_USER - $SHOW_QUOTA_GROUP - $SHOW_QUOTA_INFO_USER - $SHOW_QUOTA_INFO_GROUP - - echo " Unlink files to stop timer" - find `dirname $TESTFILE` -name "`basename ${TESTFILE}`*" | xargs rm -f - echo " Done" - - echo " Create file" - $RUNAS touch ${TESTFILE}_xxx || \ - quota_error a $TSTUSR "touch after timer stop failure, but expect success" - sync; sleep 1; sync - echo " Done" - - # cleanup - rm -f ${TESTFILE}_xxx - sync; sleep 3; sync; + $RUNAS touch ${TESTFILE}_after ${TESTFILE}_after1 ${TESTFILE}_after2 || true + sync; sleep 1; sync + $RUNAS touch ${TESTFILE}_after3 && \ + quota_error a $TSTUSR "create after timer expired, but expect EDQUOT" + sync; sleep 1; sync + + $SHOW_QUOTA_USER + $SHOW_QUOTA_GROUP + $SHOW_QUOTA_INFO_USER + $SHOW_QUOTA_INFO_GROUP + + echo " Unlink files to stop timer" + find `dirname $TESTFILE` -name "`basename ${TESTFILE}`*" | xargs rm -f + echo " Done" + + echo " Create file" + $RUNAS touch ${TESTFILE}_xxx || \ + quota_error a $TSTUSR "touch after timer stop failure, but expect success" + sync; sleep 1; sync + echo " Done" + + # cleanup + rm -f ${TESTFILE}_xxx + sync; sleep 3; sync; } # file soft limit (start timer, timer goes off, stop timer) -test_4a() { # was test_4 - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - LIMIT=$(($IUNIT_SZ * 10)) # 10 iunits on mds - TESTFILE=$DIR/$tdir/$tfile-0 +test_4a() { # was test_4 + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + LIMIT=$(($IUNIT_SZ * 10)) # 10 iunits on mds + TESTFILE=$DIR/$tdir/$tfile-0 - GRACE=5 + GRACE=5 - echo " User quota (soft limit: $LIMIT files grace: $GRACE seconds)" - $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR - $LFS setquota -u $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR + echo " User quota (soft limit: $LIMIT files grace: $GRACE seconds)" + $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR + $LFS setquota -u $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR quota_show_check f u $TSTUSR - test_file_soft $TESTFILE $LIMIT $GRACE - resetquota -u $TSTUSR + test_file_soft $TESTFILE $LIMIT $GRACE + 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 - $LFS setquota -g $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR + echo " Group quota (soft limit: $LIMIT files grace: $GRACE seconds)" + $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace $GRACE $DIR + $LFS setquota -g $TSTUSR -b 0 -B 0 -i $LIMIT -I 0 $DIR quota_show_check f g $TSTUSR - TESTFILE=$DIR/$tdir/$tfile-1 + TESTFILE=$DIR/$tdir/$tfile-1 - test_file_soft $TESTFILE $LIMIT $GRACE - resetquota -g $TSTUSR + test_file_soft $TESTFILE $LIMIT $GRACE + resetquota -g $TSTUSR - # cleanup - $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR - $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR + # cleanup + $LFS setquota -t -u --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR + $LFS setquota -t -g --block-grace $MAX_DQ_TIME --inode-grace $MAX_IQ_TIME $DIR } run_test_with_stat 4a "File soft limit (start timer, timer goes off, stop timer) ===" -test_4b() { # was test_4a +test_4b() { # was test_4a GR_STR1="1w3d" GR_STR2="1000s" GR_STR3="5s" @@ -651,7 +651,7 @@ test_4b() { # was test_4a GR_STR5="5c" GR_STR6="1111111111111111" - wait_delete_completed + wait_delete_completed # test of valid grace strings handling echo " Valid grace strings test" @@ -673,94 +673,94 @@ run_test_with_stat 4b "Grace time strings handling ===" # chown & chgrp (chown & chgrp successfully even out of block/file quota) test_5() { - mkdir -p $DIR/$tdir - BLIMIT=$(( $BUNIT_SZ * $((OSTCOUNT + 1)) * 10)) # 10 bunits on each server - ILIMIT=$(( $IUNIT_SZ * 10 )) # 10 iunits on mds + mkdir -p $DIR/$tdir + BLIMIT=$(( $BUNIT_SZ * $((OSTCOUNT + 1)) * 10)) # 10 bunits on each server + ILIMIT=$(( $IUNIT_SZ * 10 )) # 10 iunits on mds - wait_delete_completed + wait_delete_completed - echo " Set quota limit (0 $BLIMIT 0 $ILIMIT) for $TSTUSR.$TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $BLIMIT -i 0 -I $ILIMIT $DIR - $LFS setquota -g $TSTUSR -b 0 -B $BLIMIT -i 0 -I $ILIMIT $DIR + echo " Set quota limit (0 $BLIMIT 0 $ILIMIT) for $TSTUSR.$TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $BLIMIT -i 0 -I $ILIMIT $DIR + $LFS setquota -g $TSTUSR -b 0 -B $BLIMIT -i 0 -I $ILIMIT $DIR quota_show_check a u $TSTUSR quota_show_check a g $TSTUSR - echo " Create more than $ILIMIT files and more than $BLIMIT kbytes ..." - createmany -m $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) || \ - error "touch failure, expect success" - dd if=/dev/zero of=$DIR/$tdir/$tfile-0_1 bs=$BLK_SZ count=$((BLIMIT+1)) || error "write failure, expect success" + echo " Create more than $ILIMIT files and more than $BLIMIT kbytes ..." + createmany -m $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) || \ + error "touch failure, expect success" + dd if=/dev/zero of=$DIR/$tdir/$tfile-0_1 bs=$BLK_SZ count=$((BLIMIT+1)) || error "write failure, expect success" - echo " Chown files to $TSTUSR.$TSTUSR ..." - for i in `seq 0 $ILIMIT`; do - chown $TSTUSR.$TSTUSR $DIR/$tdir/$tfile-0_$i || \ - quota_error a $TSTUSR "chown failure, but expect success" - done + echo " Chown files to $TSTUSR.$TSTUSR ..." + for i in `seq 0 $ILIMIT`; do + chown $TSTUSR.$TSTUSR $DIR/$tdir/$tfile-0_$i || \ + quota_error a $TSTUSR "chown failure, but expect success" + done - # cleanup - unlinkmany $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) - sync; sleep 3; sync; + # cleanup + unlinkmany $DIR/$tdir/$tfile-0_ $((ILIMIT + 1)) + sync; sleep 3; sync; - resetquota -u $TSTUSR - resetquota -g $TSTUSR + resetquota -u $TSTUSR + resetquota -g $TSTUSR } 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" - return 0; - fi + if [ $OSTCOUNT -lt 2 ]; then + skip "$OSTCOUNT < 2, too few osts" + return 0; + fi - wait_delete_completed + wait_delete_completed - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir - LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1) * 5)) # 5 bunits per server - FILEA="$DIR/$tdir/$tfile-0_a" - FILEB="$DIR/$tdir/$tfile-0_b" + LIMIT=$((BUNIT_SZ * (OSTCOUNT + 1) * 5)) # 5 bunits per server + FILEA="$DIR/$tdir/$tfile-0_a" + FILEB="$DIR/$tdir/$tfile-0_b" - echo " Set block limit $LIMIT kbytes to $TSTUSR.$TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + echo " Set block limit $LIMIT kbytes to $TSTUSR.$TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR quota_show_check b u $TSTUSR quota_show_check b g $TSTUSR - echo " Create filea on OST0 and fileb on OST1" - $LFS setstripe $FILEA -i 0 -c 1 - $LFS setstripe $FILEB -i 1 -c 1 - chown $TSTUSR.$TSTUSR $FILEA - chown $TSTUSR.$TSTUSR $FILEB + echo " Create filea on OST0 and fileb on OST1" + $LFS setstripe $FILEA -i 0 -c 1 + $LFS setstripe $FILEB -i 1 -c 1 + chown $TSTUSR.$TSTUSR $FILEA + chown $TSTUSR.$TSTUSR $FILEB - echo " Exceed quota limit ..." + echo " Exceed quota limit ..." RUNDD="$RUNAS dd if=/dev/zero of=$FILEA bs=$BLK_SZ" $RUNDD count=$((LIMIT - BUNIT_SZ * OSTCOUNT)) || \ - quota_error a $TSTUSR "write filea failure, but expect success" + quota_error a $TSTUSR "write filea failure, but expect success" cancel_lru_locks osc $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP $RUNDD seek=$LIMIT count=$((BUNIT_SZ * OSTCOUNT)) && \ - quota_error a $TSTUSR "write filea success, but expect EDQUOT" + quota_error a $TSTUSR "write filea success, but expect EDQUOT" cancel_lru_locks osc - echo " Write to OST1 return EDQUOT" - # this write maybe cache write, ignore it's failure + echo " Write to OST1 return EDQUOT" + # this write maybe cache write, ignore it's failure RUNDD="$RUNAS dd if=/dev/zero of=$FILEB bs=$BLK_SZ" $RUNDD count=$(($BUNIT_SZ * 2)) || true cancel_lru_locks osc $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP $RUNDD count=$((BUNIT_SZ * 2)) seek=$((BUNIT_SZ *2)) && \ - quota_error a $TSTUSR "write fileb success, but expect EDQUOT" + quota_error a $TSTUSR "write fileb success, but expect EDQUOT" - echo " Remove filea to let OST0 release quota" - rm -f $FILEA + echo " Remove filea to let OST0 release quota" + rm -f $FILEA if at_is_enabled; then - timeout=$(at_max_get mds) + timeout=$(at_max_get mds) else - timeout=$(lctl get_param -n timeout) + timeout=$(lctl get_param -n timeout) fi count=$((timeout / 5)) OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` @@ -768,7 +768,7 @@ test_6() { while [ $((count--)) -gt 0 ]; do sync && sleep 5 - OST0_QUOTA_HOLD=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'` + OST0_QUOTA_HOLD=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'` if [ -z $OST0_QUOTA_HOLD ]; then error "System is error when query quota for block (U:$TSTUSR)." else @@ -784,7 +784,7 @@ test_6() { while [ $((count--)) -gt 0 ]; do sync && sleep 5 - OST0_QUOTA_HOLD=`$LFS quota -o $OST0_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'` + OST0_QUOTA_HOLD=`$LFS quota -o $OST0_UUID -g $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'` if [ -z $OST0_QUOTA_HOLD ]; then error "System is error when query quota for block (G:$TSTUSR)." else @@ -797,95 +797,95 @@ test_6() { [ ! $count -gt 0 ] && error "Release quota for block timeout (G:$TSTUSR)." $SHOW_QUOTA_GROUP - echo " Write to OST1" - $RUNDD count=$((LIMIT - BUNIT_SZ * OSTCOUNT)) || \ - quota_error a $TSTUSR "write fileb failure, expect success" - echo " Done" + echo " Write to OST1" + $RUNDD count=$((LIMIT - BUNIT_SZ * OSTCOUNT)) || \ + quota_error a $TSTUSR "write fileb failure, expect success" + echo " Done" - # cleanup - rm -f $FILEB - sync; sleep 3; sync; + # cleanup + rm -f $FILEB + sync; sleep 3; sync; - resetquota -u $TSTUSR - resetquota -g $TSTUSR - return 0 + resetquota -u $TSTUSR + resetquota -g $TSTUSR + return 0 } run_test_with_stat 6 "Block quota acquire & release =========" # quota recovery (block quota only by now) test_7() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir - wait_delete_completed + wait_delete_completed - LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) )) - TESTFILE="$DIR/$tdir/$tfile-0" + LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) )) + TESTFILE="$DIR/$tdir/$tfile-0" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - $LFS setstripe $TESTFILE -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE - echo " Write to OST0..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ || \ - quota_error u $TSTUSR "write failure, but expect success" + echo " Write to OST0..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ || \ + quota_error u $TSTUSR "write failure, but expect success" - #define OBD_FAIL_OBD_DQACQ 0x604 - lustre_fail mds 0x604 - echo " Remove files on OST0" - rm -f $TESTFILE - lustre_fail mds 0 + #define OBD_FAIL_OBD_DQACQ 0x604 + lustre_fail mds 0x604 + echo " Remove files on OST0" + rm -f $TESTFILE + lustre_fail mds 0 - echo " Trigger recovery..." - OSC0_UUID="`$LCTL dl | awk '$3 ~ /osc/ { print $1 }'`" - for i in $OSC0_UUID; do - $LCTL --device $i activate || error "activate osc failed!" - done + echo " Trigger recovery..." + OSC0_UUID="`$LCTL dl | awk '$3 ~ /osc/ { print $1 }'`" + for i in $OSC0_UUID; do + $LCTL --device $i activate || error "activate osc failed!" + done - # sleep a while to wait for recovery done - sleep 20 + # sleep a while to wait for recovery done + sleep 20 - # check limits - PATTERN="`echo $DIR | sed 's/\//\\\\\//g'`" - TOTAL_LIMIT="`$LFS quota -v -u $TSTUSR $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $4 }'`" - [ $TOTAL_LIMIT -eq $LIMIT ] || error "total limits not recovery!" - echo " total limits = $TOTAL_LIMIT" + # check limits + PATTERN="`echo $DIR | sed 's/\//\\\\\//g'`" + TOTAL_LIMIT="`$LFS quota -v -u $TSTUSR $DIR | awk '/^.*'$PATTERN'.*[[:digit:]+][[:space:]+]/ { print $4 }'`" + [ $TOTAL_LIMIT -eq $LIMIT ] || error "total limits not recovery!" + echo " total limits = $TOTAL_LIMIT" OST0_UUID=`do_facet ost1 "$LCTL dl | grep -m1 obdfilter" | awk '{print $((NF-1))}'` [ -z "$OST0_UUID" ] && OST0_UUID=`do_facet ost1 "$LCTL dl | grep -m1 obdfilter" | awk '{print $((NF-1))}'` - OST0_LIMIT="`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'`" - [ $OST0_LIMIT -eq $BUNIT_SZ ] || error "high limits not released!" - echo " limits on $OST0_UUID = $OST0_LIMIT" + OST0_LIMIT="`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $3 }'`" + [ $OST0_LIMIT -eq $BUNIT_SZ ] || error "high limits not released!" + echo " limits on $OST0_UUID = $OST0_LIMIT" - # cleanup - resetquota -u $TSTUSR + # cleanup + resetquota -u $TSTUSR } run_test_with_stat 7 "Quota recovery (only block limit) ======" # run dbench with quota enabled test_8() { - mkdir -p $DIR/$tdir - BLK_LIMIT=$((100 * 1024 * 1024)) # 100G - FILE_LIMIT=1000000 + mkdir -p $DIR/$tdir + BLK_LIMIT=$((100 * 1024 * 1024)) # 100G + FILE_LIMIT=1000000 - wait_delete_completed + wait_delete_completed - echo " Set enough high limit for user: $TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR - echo " Set enough high limit for group: $TSTUSR" - $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR + echo " Set enough high limit for user: $TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR + echo " Set enough high limit for group: $TSTUSR" + $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR - chmod 0777 $DIR/$tdir - local duration="" - [ "$SLOW" = "no" ] && duration=" -t 120" - $RUNAS bash rundbench -D $DIR/$tdir 3 $duration || quota_error a $TSTUSR "dbench failed!" + chmod 0777 $DIR/$tdir + local duration="" + [ "$SLOW" = "no" ] && duration=" -t 120" + $RUNAS bash rundbench -D $DIR/$tdir 3 $duration || quota_error a $TSTUSR "dbench failed!" rm -rf $DIR/$tdir - sync; sleep 3; sync; + sync; sleep 3; sync; - return 0 + return 0 } run_test_with_stat 8 "Run dbench with quota enabled ===========" @@ -902,23 +902,23 @@ check_whether_skip () { OST0_SIZE=`$LFS df $DIR | awk '/\[OST:0\]/ {print $4}'` log "OST0_SIZE: $OST0_SIZE required: $OST0_MIN" if [ $OST0_SIZE -lt $OST0_MIN ]; then - echo "WARN: OST0 has less than $OST0_MIN free, skip this test." - return 0 + echo "WARN: OST0 has less than $OST0_MIN free, skip this test." + return 0 else - return 1 + return 1 fi } test_9() { - check_whether_skip && return 0 + check_whether_skip && return 0 - wait_delete_completed + wait_delete_completed - set_blk_tunesz 512 - set_blk_unitsz 1024 + set_blk_tunesz 512 + set_blk_unitsz 1024 - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir TESTFILE="$DIR/$tdir/$tfile-0" BLK_LIMIT=$((100 * KB * KB)) # 100G @@ -934,28 +934,28 @@ test_9() { quota_show_check a g $TSTUSR echo " Set stripe" - $LFS setstripe $TESTFILE -c 1 + $LFS setstripe $TESTFILE -c 1 touch $TESTFILE chown $TSTUSR.$TSTUSR $TESTFILE log " Write the big file of 4.5G ..." $RUNAS dd if=/dev/zero of=$TESTFILE bs=$blksize count=$((size_file / blksize)) || \ - quota_error a $TSTUSR "(usr) write 4.5G file failure, but expect success" + quota_error a $TSTUSR "(usr) write 4.5G file failure, but expect success" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP log " delete the big file of 4.5G..." $RUNAS rm -f $TESTFILE - sync; sleep 3; sync; + sync; sleep 3; sync; $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP RC=$? - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) return $RC } @@ -963,59 +963,59 @@ run_test_with_stat 9 "run for fixing bug10707(64bit) ===========" # run for fixing bug10707, it need a big room. test for 32bit test_10() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - check_whether_skip && return 0 + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + check_whether_skip && return 0 - wait_delete_completed + wait_delete_completed - set_blk_tunesz 512 - set_blk_unitsz 1024 + set_blk_tunesz 512 + set_blk_unitsz 1024 - # make qd_count 32 bit - lustre_fail mds_ost 0xA00 + # make qd_count 32 bit + lustre_fail mds_ost 0xA00 - TESTFILE="$DIR/$tdir/$tfile-0" + TESTFILE="$DIR/$tdir/$tfile-0" - BLK_LIMIT=$((100 * KB * KB)) # 100G - FILE_LIMIT=1000000 + BLK_LIMIT=$((100 * KB * KB)) # 100G + FILE_LIMIT=1000000 - log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for user: $TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR - log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for group: $TSTUSR" - $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR + log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for user: $TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR + log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for group: $TSTUSR" + $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $DIR quota_show_check a u $TSTUSR quota_show_check a g $TSTUSR - echo " Set stripe" - $LFS setstripe $TESTFILE -c 1 - touch $TESTFILE - chown $TSTUSR.$TSTUSR $TESTFILE + echo " Set stripe" + $LFS setstripe $TESTFILE -c 1 + touch $TESTFILE + chown $TSTUSR.$TSTUSR $TESTFILE log " Write the big file of 4.5 G ..." $RUNAS dd if=/dev/zero of=$TESTFILE bs=$blksize count=$((size_file / blksize)) || \ - quota_error a $TSTUSR "(usr) write 4.5 G file failure, but expect success" + quota_error a $TSTUSR "(usr) write 4.5 G file failure, but expect success" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP log " delete the big file of 4.5 G..." $RUNAS rm -f $TESTFILE - sync; sleep 3; sync; + sync; sleep 3; sync; $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP - RC=$? + RC=$? - # make qd_count 64 bit - lustre_fail mds_ost 0 + # make qd_count 64 bit + lustre_fail mds_ost 0 - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) - return $RC + return $RC } run_test_with_stat 10 "run for fixing bug10707(32bit) ===========" @@ -1043,36 +1043,36 @@ test_11() { local sleep=20 local i=1 while [ $i -le $REPS ]; do - echo "test: cycle($i of $REPS) start at $(date)" - mkdir -p $TESTDIR && chmod 777 $TESTDIR - echo -n " create a file for uid " - for j in `seq 1 30`; do - echo -n "$j " + echo "test: cycle($i of $REPS) start at $(date)" + mkdir -p $TESTDIR && chmod 777 $TESTDIR + echo -n " create a file for uid " + for j in `seq 1 30`; do + echo -n "$j " # 30MB per dd for a total of 900MB (if space even permits) - runas -u $j dd if=/dev/zero of=$TESTDIR/$tfile bs=$blksize count=15 > /dev/null 2>&1 & - done - echo "" - PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l) + runas -u $j dd if=/dev/zero of=$TESTDIR/$tfile bs=$blksize count=15 > /dev/null 2>&1 & + done + echo "" + PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l) LAST_USED=0 - while [ $PROCS -gt 0 ]; do - sleep 20 - SECS=$((SECS + sleep)) - PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l) - USED=$(du -s $TESTDIR | awk '{print $1}') - PCT=$(($USED * 100 / $block_limit)) - echo "${i}/${REPS} ${PCT}% p${PROCS} t${SECS} " - if [ $USED -le $LAST_USED ]; then - kill -9 $(ps -ef | grep "dd if /dev/zero of $TESTDIR" | grep -v grep | awk '{ print $2 }') - i=$REPS - RV=2 - break - fi + while [ $PROCS -gt 0 ]; do + sleep 20 + SECS=$((SECS + sleep)) + PROCS=$(ps -ef | grep -v grep | grep "dd if /dev/zero of $TESTDIR" | wc -l) + USED=$(du -s $TESTDIR | awk '{print $1}') + PCT=$(($USED * 100 / $block_limit)) + echo "${i}/${REPS} ${PCT}% p${PROCS} t${SECS} " + if [ $USED -le $LAST_USED ]; then + kill -9 $(ps -ef | grep "dd if /dev/zero of $TESTDIR" | grep -v grep | awk '{ print $2 }') + i=$REPS + RV=2 + break + fi LAST_USED=$USED - done - echo " removing the test files..." - rm -f $TESTDIR/$tfile - echo "cycle $i done at $(date)" - i=$[$i+1] + done + echo " removing the test files..." + rm -f $TESTDIR/$tfile + echo "cycle $i done at $(date)" + i=$[$i+1] done echo "Test took $SECS sec" @@ -1091,37 +1091,37 @@ run_test_with_stat 11 "run for fixing bug10912 ===========" # test a deadlock between quota and journal b=11693 test_12() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir - [ "$(grep $DIR2 /proc/mounts)" ] || mount_client $DIR2 || \ - { skip "Need lustre mounted on $MOUNT2 " && retutn 0; } + [ "$(grep $DIR2 /proc/mounts)" ] || mount_client $DIR2 || \ + { skip "Need lustre mounted on $MOUNT2 " && retutn 0; } - LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 10)) # 10 bunits each sever - TESTFILE="$DIR/$tdir/$tfile-0" - TESTFILE2="$DIR2/$tdir/$tfile-1" + LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 10)) # 10 bunits each sever + TESTFILE="$DIR/$tdir/$tfile-0" + TESTFILE2="$DIR2/$tdir/$tfile-1" - wait_delete_completed + wait_delete_completed - echo " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + echo " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - $LFS setstripe $TESTFILE -i 0 -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE - $LFS setstripe $TESTFILE2 -i 0 -c 1 + $LFS setstripe $TESTFILE -i 0 -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE2 -i 0 -c 1 chown $TSTUSR2.$TSTUSR2 $TESTFILE2 - #define OBD_FAIL_OST_HOLD_WRITE_RPC 0x21f - #define OBD_FAIL_SOME 0x10000000 /* fail N times */ - lustre_fail ost $((0x0000021f | 0x10000000)) 1 + #define OBD_FAIL_OST_HOLD_WRITE_RPC 0x21f + #define OBD_FAIL_SOME 0x10000000 /* fail N times */ + lustre_fail ost $((0x0000021f | 0x10000000)) 1 - echo " step1: write out of block quota ..." - $RUNAS2 dd if=/dev/zero of=$TESTFILE2 bs=$BLK_SZ count=102400 & - DDPID1=$! - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT*2)) & - DDPID=$! + echo " step1: write out of block quota ..." + $RUNAS2 dd if=/dev/zero of=$TESTFILE2 bs=$BLK_SZ count=102400 & + DDPID1=$! + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(($LIMIT*2)) & + DDPID=$! - echo " step2: testing ......" + echo " step2: testing ......" local last_size=$(stat -c %s $TESTFILE2) local stall_secs=0 local start_secs=$SECONDS @@ -1141,22 +1141,22 @@ test_12() { done echo "(dd_pid=$DDPID1, time=$((SECONDS-start_secs)))successful" - #Recover fail_loc and dd will finish soon - lustre_fail ost 0 - - echo " step3: testing ......" - count=0 - while [ true ]; do - if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 150 ]; then - quota_error u $TSTUSR "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID, time=$count)successful" - - rm -f $TESTFILE $TESTFILE2 + #Recover fail_loc and dd will finish soon + lustre_fail ost 0 + + echo " step3: testing ......" + count=0 + while [ true ]; do + if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt 150 ]; then + quota_error u $TSTUSR "dd should be finished!" + fi + sleep 1 + done + echo "(dd_pid=$DDPID, time=$count)successful" + + rm -f $TESTFILE $TESTFILE2 sync; sleep 3; sync; resetquota -u $TSTUSR @@ -1165,120 +1165,120 @@ run_test_with_stat 12 "test a deadlock between quota and journal ===" # test multiple clients write block quota b=11693 test_13() { - mkdir -p $DIR/$tdir - wait_delete_completed + mkdir -p $DIR/$tdir + wait_delete_completed - # one OST * 10 + (mds + other OSTs) - LIMIT=$((BUNIT_SZ * 10 + (BUNIT_SZ * OSTCOUNT))) - TESTFILE="$DIR/$tdir/$tfile" + # one OST * 10 + (mds + other OSTs) + LIMIT=$((BUNIT_SZ * 10 + (BUNIT_SZ * OSTCOUNT))) + TESTFILE="$DIR/$tdir/$tfile" - echo " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + echo " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR quota_show_check b u $TSTUSR - $LFS setstripe $TESTFILE -i 0 -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE - $LFS setstripe $TESTFILE.2 -i 0 -c 1 + $LFS setstripe $TESTFILE -i 0 -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE.2 -i 0 -c 1 chown $TSTUSR.$TSTUSR $TESTFILE.2 - echo " step1: write out of block quota ..." - # one bunit will give mds - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$[($LIMIT - $BUNIT_SZ) / 2] & - DDPID=$! - $RUNAS dd if=/dev/zero of=$TESTFILE.2 bs=$BLK_SZ count=$[($LIMIT - $BUNIT_SZ) / 2] & - DDPID1=$! - - echo " step2: testing ......" - count=0 - while [ true ]; do - if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 64 ]; then - quota_error u $TSTUSR "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID, time=$count)successful" - - count=0 - while [ true ]; do - if ! ps -p ${DDPID1} > /dev/null 2>&1 ; then break; fi - count=$[count+1] - if [ $count -gt 64 ]; then - quota_error u $TSTUSR "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID1, time=$count)successful" - - sync; sleep 5; sync; - - echo " step3: checking ......" - fz=`stat -c %s $TESTFILE` - fz2=`stat -c %s $TESTFILE.2` - $SHOW_QUOTA_USER - [ $((fz + fz2)) -lt $((BUNIT_SZ * BLK_SZ * 10)) ] && \ + echo " step1: write out of block quota ..." + # one bunit will give mds + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$[($LIMIT - $BUNIT_SZ) / 2] & + DDPID=$! + $RUNAS dd if=/dev/zero of=$TESTFILE.2 bs=$BLK_SZ count=$[($LIMIT - $BUNIT_SZ) / 2] & + DDPID1=$! + + echo " step2: testing ......" + count=0 + while [ true ]; do + if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt 64 ]; then + quota_error u $TSTUSR "dd should be finished!" + fi + sleep 1 + done + echo "(dd_pid=$DDPID, time=$count)successful" + + count=0 + while [ true ]; do + if ! ps -p ${DDPID1} > /dev/null 2>&1 ; then break; fi + count=$[count+1] + if [ $count -gt 64 ]; then + quota_error u $TSTUSR "dd should be finished!" + fi + sleep 1 + done + echo "(dd_pid=$DDPID1, time=$count)successful" + + sync; sleep 5; sync; + + echo " step3: checking ......" + fz=`stat -c %s $TESTFILE` + fz2=`stat -c %s $TESTFILE.2` + $SHOW_QUOTA_USER + [ $((fz + fz2)) -lt $((BUNIT_SZ * BLK_SZ * 10)) ] && \ quota_error u $TSTUSR "files too small $fz + $fz2 < $((BUNIT_SZ * BLK_SZ * 10))" - rm -f $TESTFILE $TESTFILE.2 - sync; sleep 3; sync; + rm -f $TESTFILE $TESTFILE.2 + sync; sleep 3; sync; - resetquota -u $TSTUSR + resetquota -u $TSTUSR } run_test_with_stat 13 "test multiple clients write block quota ===" check_if_quota_zero(){ line=`$LFS quota -v -$1 $2 $DIR | wc -l` - for i in `seq 3 $line`; do - if [ $i -eq 3 ]; then - field="3 4 6 7" - else - field="3 5" - fi - for j in $field; do - tmp=`$LFS quota -v -$1 $2 $DIR | sed -n ${i}p | + for i in `seq 3 $line`; do + if [ $i -eq 3 ]; then + field="3 4 6 7" + else + field="3 5" + fi + for j in $field; do + tmp=`$LFS quota -v -$1 $2 $DIR | sed -n ${i}p | awk '{print $'"$j"'}'` - [ -n "$tmp" ] && [ $tmp -ne 0 ] && $LFS quota -v -$1 $2 $DIR && \ - error "quota on $2 isn't clean" - done - done - echo "pass check_if_quota_zero" + [ -n "$tmp" ] && [ $tmp -ne 0 ] && $LFS quota -v -$1 $2 $DIR && \ + error "quota on $2 isn't clean" + done + done + echo "pass check_if_quota_zero" } -test_14a() { # was test_14 b=12223 -- setting quota on root - TESTFILE="$DIR/$tdir/$tfile" +test_14a() { # was test_14 b=12223 -- setting quota on root + TESTFILE="$DIR/$tdir/$tfile" # reboot the lustre sync; sleep 5; sync cleanup_and_setup_lustre test_0 - mkdir -p $DIR/$tdir - - # out of root's file and block quota - $LFS setquota -u root -b 10 -B 10 -i 10 -I 10 $DIR - createmany -m ${TESTFILE} 20 || \ - quota_error u root "unexpected: user(root) create files failly!" - dd if=/dev/zero of=$TESTFILE bs=4k count=4096 || \ - quota_error u root "unexpected: user(root) write files failly!" - chmod 666 $TESTFILE - $RUNAS dd if=/dev/zero of=${TESTFILE} seek=4096 bs=4k count=4096 && \ - quota_error u root "unexpected: user(quota_usr) write a file successfully!" - - # trigger the llog - chmod 777 $DIR - for i in `seq 1 10`; do $RUNAS touch ${TESTFILE}a_$i; done - for i in `seq 1 10`; do $RUNAS rm -f ${TESTFILE}a_$i; done - - # do the check - dmesg | tail | grep "\-122" |grep llog_obd_origin_add && error "err -122 not found in dmesg" - resetquota -u root - #check_if_quota_zero u root - - # clean - unlinkmany ${TESTFILE} 15 - rm -f $TESTFILE - sync; sleep 3; sync; + mkdir -p $DIR/$tdir + + # out of root's file and block quota + $LFS setquota -u root -b 10 -B 10 -i 10 -I 10 $DIR + createmany -m ${TESTFILE} 20 || \ + quota_error u root "unexpected: user(root) create files failly!" + dd if=/dev/zero of=$TESTFILE bs=4k count=4096 || \ + quota_error u root "unexpected: user(root) write files failly!" + chmod 666 $TESTFILE + $RUNAS dd if=/dev/zero of=${TESTFILE} seek=4096 bs=4k count=4096 && \ + quota_error u root "unexpected: user(quota_usr) write a file successfully!" + + # trigger the llog + chmod 777 $DIR + for i in `seq 1 10`; do $RUNAS touch ${TESTFILE}a_$i; done + for i in `seq 1 10`; do $RUNAS rm -f ${TESTFILE}a_$i; done + + # do the check + dmesg | tail | grep "\-122" |grep llog_obd_origin_add && error "err -122 not found in dmesg" + resetquota -u root + #check_if_quota_zero u root + + # clean + unlinkmany ${TESTFILE} 15 + rm -f $TESTFILE + sync; sleep 3; sync; } run_test_with_stat 14a "test setting quota on root ===" @@ -1391,169 +1391,169 @@ run_test_with_stat 15 "set block quota more than 4T ===" # $1=u/g $2=with qunit adjust or not test_16_tub() { - LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 4)) - TESTFILE="$DIR/$tdir/$tfile" - mkdir -p $DIR/$tdir + LIMIT=$(( $BUNIT_SZ * $(($OSTCOUNT + 1)) * 4)) + TESTFILE="$DIR/$tdir/$tfile" + mkdir -p $DIR/$tdir - wait_delete_completed + wait_delete_completed - echo " User quota (limit: $LIMIT kbytes)" - if [ $1 == "u" ]; then - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + echo " User quota (limit: $LIMIT kbytes)" + if [ $1 == "u" ]; then + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR quota_show_check b u $TSTUSR - else - $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + else + $LFS setquota -g $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR quota_show_check b g $TSTUSR - fi - - $LFS setstripe $TESTFILE -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE - - echo " Write ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((BUNIT_SZ * 4)) || \ - quota_error a $TSTUSR "(usr) write failure, but expect success" - echo " Done" - echo " Write out of block quota ..." - # this time maybe cache write, ignore it's failure - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) || true - # flush cache, ensure noquota flag is setted on client + fi + + $LFS setstripe $TESTFILE -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE + + echo " Write ..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((BUNIT_SZ * 4)) || \ + quota_error a $TSTUSR "(usr) write failure, but expect success" + echo " Done" + echo " Write out of block quota ..." + # this time maybe cache write, ignore it's failure + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) || true + # flush cache, ensure noquota flag is setted on client cancel_lru_locks osc - if [ $2 -eq 1 ]; then - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) || \ - quota_error a $TSTUSR "(write failure, but expect success" - else - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) && \ - quota_error a $TSTUSR "(write success, but expect EDQUOT" - fi - - rm -f $TESTFILE - sync; sleep 3; sync; - resetquota -$1 $TSTUSR + if [ $2 -eq 1 ]; then + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) || \ + quota_error a $TSTUSR "(write failure, but expect success" + else + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$BUNIT_SZ seek=$((BUNIT_SZ * 4)) && \ + quota_error a $TSTUSR "(write success, but expect EDQUOT" + fi + + rm -f $TESTFILE + sync; sleep 3; sync; + resetquota -$1 $TSTUSR } # test without adjusting qunit test_16 () { - set_blk_tunesz $((BUNIT_SZ * 2)) - set_blk_unitsz $((BUNIT_SZ * 4)) - for i in u g; do - for j in 0 1; do + set_blk_tunesz $((BUNIT_SZ * 2)) + set_blk_unitsz $((BUNIT_SZ * 4)) + for i in u g; do + for j in 0 1; do # define OBD_FAIL_QUOTA_WITHOUT_CHANGE_QS 0xA01 - echo " grp/usr: $i, adjust qunit: $j" - echo "-------------------------------" - [ $j -eq 1 ] && lustre_fail mds_ost 0 - [ $j -eq 0 ] && lustre_fail mds_ost 0xA01 - test_16_tub $i $j - done - done - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + echo " grp/usr: $i, adjust qunit: $j" + echo "-------------------------------" + [ $j -eq 1 ] && lustre_fail mds_ost 0 + [ $j -eq 0 ] && lustre_fail mds_ost 0xA01 + test_16_tub $i $j + done + done + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } run_test_with_stat 16 "test without adjusting qunit" # run for fixing bug14526, failed returned quota reqs shouldn't ruin lustre. test_17() { - set_blk_tunesz 512 - set_blk_unitsz 1024 + set_blk_tunesz 512 + set_blk_unitsz 1024 - wait_delete_completed + wait_delete_completed #define OBD_FAIL_QUOTA_RET_QDATA | OBD_FAIL_ONCE - lustre_fail ost 0x80000A02 + lustre_fail ost 0x80000A02 - TESTFILE="$DIR/$tdir/$tfile-a" - TESTFILE2="$DIR/$tdir/$tfile-b" - mkdir -p $DIR/$tdir + TESTFILE="$DIR/$tdir/$tfile-a" + TESTFILE2="$DIR/$tdir/$tfile-b" + mkdir -p $DIR/$tdir - BLK_LIMIT=$((100 * 1024)) # 100M + BLK_LIMIT=$((100 * 1024)) # 100M - log " Set enough high limit(block:$BLK_LIMIT) for user: $TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR - log " Set enough high limit(block:$BLK_LIMIT) for group: $TSTUSR" - $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR + log " Set enough high limit(block:$BLK_LIMIT) for user: $TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR + log " Set enough high limit(block:$BLK_LIMIT) for group: $TSTUSR" + $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I 0 $DIR quota_show_check b u $TSTUSR quota_show_check b g $TSTUSR - touch $TESTFILE - chown $TSTUSR.$TSTUSR $TESTFILE - touch $TESTFILE2 - chown $TSTUSR.$TSTUSR $TESTFILE2 + touch $TESTFILE + chown $TSTUSR.$TSTUSR $TESTFILE + touch $TESTFILE2 + chown $TSTUSR.$TSTUSR $TESTFILE2 - log " Write the test file1 ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(( 10 * 1024 )) \ - || quota_error a $TSTUSR "write 10M file failure" + log " Write the test file1 ..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(( 10 * 1024 )) \ + || quota_error a $TSTUSR "write 10M file failure" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP - log " write the test file2 ..." - $RUNAS dd if=/dev/zero of=$TESTFILE2 bs=$BLK_SZ count=$(( 10 * 1024 )) \ - || quota_error a $TSTUSR "write 10M file failure" + log " write the test file2 ..." + $RUNAS dd if=/dev/zero of=$TESTFILE2 bs=$BLK_SZ count=$(( 10 * 1024 )) \ + || quota_error a $TSTUSR "write 10M file failure" $SHOW_QUOTA_USER $SHOW_QUOTA_GROUP - rm -f $TESTFILE $TESTFILE2 - RC=$? - sync; sleep 3; sync; + rm -f $TESTFILE $TESTFILE2 + RC=$? + sync; sleep 3; sync; - # make qd_count 64 bit - lustre_fail ost 0 + # make qd_count 64 bit + lustre_fail ost 0 - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) - resetquota -u $TSTUSR - resetquota -g $TSTUSR + resetquota -u $TSTUSR + resetquota -g $TSTUSR - return $RC + return $RC } run_test_with_stat 17 "run for fixing bug14526 ===========" # test when mds takes a long time to handle a quota req so that # the ost has dropped it, the ost still could work well b=14840 test_18() { - LIMIT=$((100 * 1024 * 1024)) # 100G - TESTFILE="$DIR/$tdir/$tfile" - mkdir -p $DIR/$tdir + LIMIT=$((100 * 1024 * 1024)) # 100G + TESTFILE="$DIR/$tdir/$tfile" + mkdir -p $DIR/$tdir - wait_delete_completed + wait_delete_completed - set_blk_tunesz 512 - set_blk_unitsz 1024 + set_blk_tunesz 512 + set_blk_unitsz 1024 - log " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT + log " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT quota_show_check b u $TSTUSR - $LFS setstripe $TESTFILE -i 0 -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE + $LFS setstripe $TESTFILE -i 0 -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE - #define OBD_FAIL_MDS_BLOCK_QUOTA_REQ 0x13c - lustre_fail mds 0x13c + #define OBD_FAIL_MDS_BLOCK_QUOTA_REQ 0x13c + lustre_fail mds 0x13c - log " step1: write 100M block ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((1024 * 100)) & - DDPID=$! + log " step1: write 100M block ..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((1024 * 100)) & + DDPID=$! sleep 5 lustre_fail mds 0 - echo " step2: testing ......" - count=0 - if at_is_enabled; then - timeout=$(at_max_get mds) - else - timeout=$(lctl get_param -n timeout) - fi - while [ true ]; do - if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt $((4 * $timeout)) ]; then - quota_error u $TSTUSR "count=$count dd should be finished!" - fi - sleep 1 - done + echo " step2: testing ......" + count=0 + if at_is_enabled; then + timeout=$(at_max_get mds) + else + timeout=$(lctl get_param -n timeout) + fi + while [ true ]; do + if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt $((4 * $timeout)) ]; then + quota_error u $TSTUSR "count=$count dd should be finished!" + fi + sleep 1 + done log "(dd_pid=$DDPID, time=$count, timeout=$timeout)" sync cancel_lru_locks mdc @@ -1561,67 +1561,67 @@ test_18() { testfile_size=$(stat -c %s $TESTFILE) [ $testfile_size -ne $((BLK_SZ * 1024 * 100)) ] && \ - quota_error u $TSTUSR "expect $((BLK_SZ * 1024 * 100)), got ${testfile_size}. Verifying file failed!" + quota_error u $TSTUSR "expect $((BLK_SZ * 1024 * 100)), got ${testfile_size}. Verifying file failed!" $SHOW_QUOTA_USER rm -f $TESTFILE sync - resetquota -u $TSTUSR - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + resetquota -u $TSTUSR + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } run_test_with_stat 18 "run for fixing bug14840 ===========" # test when mds drops a quota req, the ost still could work well b=14840 test_18a() { LIMIT=$((100 * 1024 * 1024)) # 100G - TESTFILE="$DIR/$tdir/$tfile-a" - mkdir -p $DIR/$tdir + TESTFILE="$DIR/$tdir/$tfile-a" + mkdir -p $DIR/$tdir - wait_delete_completed + wait_delete_completed - set_blk_tunesz 512 - set_blk_unitsz 1024 + set_blk_tunesz 512 + set_blk_unitsz 1024 - log " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT + log " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT quota_show_check b u $TSTUSR - $LFS setstripe $TESTFILE -i 0 -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE - - #define OBD_FAIL_MDS_DROP_QUOTA_REQ | OBD_FAIL_ONCE 0x8000013d - lustre_fail mds 0x8000013d - - log " step1: write 100M block ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((1024 * 100)) & - DDPID=$! - - echo " step2: testing ......" - count=0 - if at_is_enabled; then - timeout=$(at_max_get mds) - else - timeout=$(lctl get_param -n timeout) - fi - while [ true ]; do - if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt $((3 * $timeout)) ]; then - lustre_fail mds 0 - quota_error u $TSTUSR "count=$count dd should be finished!" - fi - sleep 1 - done + $LFS setstripe $TESTFILE -i 0 -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE + + #define OBD_FAIL_MDS_DROP_QUOTA_REQ | OBD_FAIL_ONCE 0x8000013d + lustre_fail mds 0x8000013d + + log " step1: write 100M block ..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$((1024 * 100)) & + DDPID=$! + + echo " step2: testing ......" + count=0 + if at_is_enabled; then + timeout=$(at_max_get mds) + else + timeout=$(lctl get_param -n timeout) + fi + while [ true ]; do + if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt $((3 * $timeout)) ]; then + lustre_fail mds 0 + quota_error u $TSTUSR "count=$count dd should be finished!" + fi + sleep 1 + done log "(dd_pid=$DDPID, time=$count, timeout=$timeout)" lustre_fail mds 0 - rm -f $TESTFILE - sync + rm -f $TESTFILE + sync - resetquota -u $TSTUSR - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + resetquota -u $TSTUSR + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } run_test_with_stat 18a "run for fixing bug14840 ===========" @@ -1648,18 +1648,18 @@ test_18bc_sub() { timeout=$(sysctl -n lustre.timeout) - if [ $type = "directio" ]; then - log " write 100M block(directio) ..." - $RUNAS $DIRECTIO write $TESTFILE 0 100 $((BLK_SZ * 1024)) & - else - log " write 100M block(normal) ..." - $RUNAS dd if=/dev/zero of=$TESTFILE bs=$((BLK_SZ * 1024)) count=100 & - fi + if [ $type = "directio" ]; then + log " write 100M block(directio) ..." + $RUNAS $DIRECTIO write $TESTFILE 0 100 $((BLK_SZ * 1024)) & + else + log " write 100M block(normal) ..." + $RUNAS dd if=/dev/zero of=$TESTFILE bs=$((BLK_SZ * 1024)) count=100 & + fi DDPID=$! do_facet mds "$LCTL conf_param ${FSNAME}-MDT*.mdt.quota_type=ug" - log "failing mds for $((2 * timeout)) seconds" + log "failing mds for $((2 * timeout)) seconds" fail mds $((2 * timeout)) # check if quotaon successful @@ -1672,12 +1672,12 @@ test_18bc_sub() { count=0 if at_is_enabled; then - timeout=$(at_max_get mds) + timeout=$(at_max_get mds) else - timeout=$(lctl get_param -n timeout) + timeout=$(lctl get_param -n timeout) fi while [ true ]; do - if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi + if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi if [ $((++count % (2 * timeout) )) -eq 0 ]; then log "it took $count second" fi @@ -1690,88 +1690,88 @@ test_18bc_sub() { testfile_size=$(stat -c %s $TESTFILE) [ $testfile_size -ne $((BLK_SZ * 1024 * 100)) ] && \ - quota_error u $TSTUSR "expect $((BLK_SZ * 1024 * 100)), got ${testfile_size}. Verifying file failed!" + quota_error u $TSTUSR "expect $((BLK_SZ * 1024 * 100)), got ${testfile_size}. Verifying file failed!" $SHOW_QUOTA_USER rm -f $TESTFILE sync - resetquota -u $TSTUSR - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + resetquota -u $TSTUSR + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } # test when mds does failover, the ost still could work well # this test shouldn't trigger watchdog b=14840 test_18b() { - test_18bc_sub normal - test_18bc_sub directio - # check if watchdog is triggered - do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log - watchdog=`awk '/test 18b/ {start = 1;} - /Watchdog triggered/ { - if (start) { - print; - } - }' $TMP/lustre-log-${TESTNAME}.log` - [ `echo "$watchdog" | wc -l` -ge 3 ] && error "$watchdog" - rm -f $TMP/lustre-log-${TESTNAME}.log + test_18bc_sub normal + test_18bc_sub directio + # check if watchdog is triggered + do_facet ost1 dmesg > $TMP/lustre-log-${TESTNAME}.log + watchdog=`awk '/test 18b/ {start = 1;} + /Watchdog triggered/ { + if (start) { + print; + } + }' $TMP/lustre-log-${TESTNAME}.log` + [ `echo "$watchdog" | wc -l` -ge 3 ] && error "$watchdog" + rm -f $TMP/lustre-log-${TESTNAME}.log } run_test_with_stat 18b "run for fixing bug14840(mds failover, no watchdog) ===========" # test when mds does failover, the ost still could work well # this test will prevent OST_DISCONNET from happening b=14840 test_18c() { - # define OBD_FAIL_OST_DISCONNECT_NET 0x202(disable ost_disconnect for osts) - lustre_fail ost 0x202 - test_18bc_sub normal - test_18bc_sub directio - lustre_fail ost 0 + # define OBD_FAIL_OST_DISCONNECT_NET 0x202(disable ost_disconnect for osts) + lustre_fail ost 0x202 + test_18bc_sub normal + test_18bc_sub directio + lustre_fail ost 0 } run_test_with_stat 18c "run for fixing bug14840(mds failover, OST_DISCONNECT is disabled) ===========" run_to_block_limit() { - local LIMIT=$((($OSTCOUNT + 1) * $BUNIT_SZ)) - local TESTFILE=$1 - wait_delete_completed + local LIMIT=$((($OSTCOUNT + 1) * $BUNIT_SZ)) + local TESTFILE=$1 + wait_delete_completed - # set 1 Mb quota unit size - set_blk_tunesz 512 - set_blk_unitsz 1024 + # set 1 Mb quota unit size + set_blk_tunesz 512 + set_blk_unitsz 1024 - # bind file to a single OST - $LFS setstripe -c 1 $TESTFILE - chown $TSTUSR.$TSTUSR $TESTFILE + # bind file to a single OST + $LFS setstripe -c 1 $TESTFILE + chown $TSTUSR.$TSTUSR $TESTFILE - echo " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT + echo " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT quota_show_check b u $TSTUSR - echo " Updating quota limits" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT + echo " Updating quota limits" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $MOUNT quota_show_check b u $TSTUSR - RUNDD="$RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ" - $RUNDD count=$BUNIT_SZ || quota_error u $TSTUSR "(usr) write failure, but expect success" - # for now page cache of TESTFILE may still be dirty, - # let's push it to the corresponding OST, this will also - # cache NOQUOTA on the client from OST's reply - cancel_lru_locks osc - $RUNDD seek=$BUNIT_SZ && quota_error u $TSTUSR "(usr) write success, should be EDQUOT" + RUNDD="$RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ" + $RUNDD count=$BUNIT_SZ || quota_error u $TSTUSR "(usr) write failure, but expect success" + # for now page cache of TESTFILE may still be dirty, + # let's push it to the corresponding OST, this will also + # cache NOQUOTA on the client from OST's reply + cancel_lru_locks osc + $RUNDD seek=$BUNIT_SZ && quota_error u $TSTUSR "(usr) write success, should be EDQUOT" } test_19() { - # 1 Mb bunit per each MDS/OSS - local TESTFILE="$DIR/$tdir/$tfile" - mkdir -p $DIR/$tdir + # 1 Mb bunit per each MDS/OSS + local TESTFILE="$DIR/$tdir/$tfile" + mkdir -p $DIR/$tdir - run_to_block_limit $TESTFILE - $SHOW_QUOTA_USER + run_to_block_limit $TESTFILE + $SHOW_QUOTA_USER - # cleanup - rm -f $TESTFILE - resetquota -u $TSTUSR + # cleanup + rm -f $TESTFILE + resetquota -u $TSTUSR - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } run_test_with_stat 19 "test if administrative limits updates do not zero operational limits (14790) ===" @@ -1798,80 +1798,80 @@ test_20() run_test_with_stat 20 "test if setquota specifiers work properly (15754)" test_21_sub() { - local testfile=$1 - local blk_number=$2 - local seconds=$3 - - time=$(($(date +%s) + seconds)) - while [ $(date +%s) -lt $time ]; do - $RUNAS dd if=/dev/zero of=$testfile bs=$BLK_SZ count=$blk_number > /dev/null 2>&1 - rm -f $testfile - done + local testfile=$1 + local blk_number=$2 + local seconds=$3 + + time=$(($(date +%s) + seconds)) + while [ $(date +%s) -lt $time ]; do + $RUNAS dd if=/dev/zero of=$testfile bs=$BLK_SZ count=$blk_number > /dev/null 2>&1 + rm -f $testfile + done } # run for fixing bug16053, setquota shouldn't fail when writing and # deleting are happening test_21() { - set_blk_tunesz 512 - set_blk_unitsz 1024 - - wait_delete_completed - - TESTFILE="$DIR/$tdir/$tfile" - - BLK_LIMIT=$((10 * 1024 * 1024)) # 10G - FILE_LIMIT=1000000 - - log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for user: $TSTUSR" - $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $MOUNT - log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for group: $TSTUSR" - $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $MOUNT - - # repeat writing on a 1M file - test_21_sub ${TESTFILE}_1 1024 30 & - DDPID1=$! - # repeat writing on a 128M file - test_21_sub ${TESTFILE}_2 $((1024 * 128)) 30 & - DDPID2=$! - - time=$(($(date +%s) + 30)) - i=1 - while [ $(date +%s) -lt $time ]; do - log " Set quota for $i times" - $LFS setquota -u $TSTUSR -b 0 -B $((BLK_LIMIT + 1024 * i)) -i 0 -I $((FILE_LIMIT + i)) $MOUNT - $LFS setquota -g $TSTUSR -b 0 -B $((BLK_LIMIT + 1024 * i)) -i 0 -I $((FILE_LIMIT + i)) $MOUNT - i=$((i+1)) - sleep 1 - done - - count=0 - while [ true ]; do - if ! ps -p ${DDPID1} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 60 ]; then - quota_error a $TSTUSR "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID1, time=$count)successful" - - count=0 - while [ true ]; do - if ! ps -p ${DDPID2} > /dev/null 2>&1; then break; fi - count=$[count+1] - if [ $count -gt 60 ]; then - quota_error a $TSTUSR "dd should be finished!" - fi - sleep 1 - done - echo "(dd_pid=$DDPID2, time=$count)successful" - - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) - resetquota -u $TSTUSR - resetquota -g $TSTUSR - - return $RC + set_blk_tunesz 512 + set_blk_unitsz 1024 + + wait_delete_completed + + TESTFILE="$DIR/$tdir/$tfile" + + BLK_LIMIT=$((10 * 1024 * 1024)) # 10G + FILE_LIMIT=1000000 + + log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for user: $TSTUSR" + $LFS setquota -u $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $MOUNT + log " Set enough high limit(block:$BLK_LIMIT; file: $FILE_LIMIT) for group: $TSTUSR" + $LFS setquota -g $TSTUSR -b 0 -B $BLK_LIMIT -i 0 -I $FILE_LIMIT $MOUNT + + # repeat writing on a 1M file + test_21_sub ${TESTFILE}_1 1024 30 & + DDPID1=$! + # repeat writing on a 128M file + test_21_sub ${TESTFILE}_2 $((1024 * 128)) 30 & + DDPID2=$! + + time=$(($(date +%s) + 30)) + i=1 + while [ $(date +%s) -lt $time ]; do + log " Set quota for $i times" + $LFS setquota -u $TSTUSR -b 0 -B $((BLK_LIMIT + 1024 * i)) -i 0 -I $((FILE_LIMIT + i)) $MOUNT + $LFS setquota -g $TSTUSR -b 0 -B $((BLK_LIMIT + 1024 * i)) -i 0 -I $((FILE_LIMIT + i)) $MOUNT + i=$((i+1)) + sleep 1 + done + + count=0 + while [ true ]; do + if ! ps -p ${DDPID1} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt 60 ]; then + quota_error a $TSTUSR "dd should be finished!" + fi + sleep 1 + done + echo "(dd_pid=$DDPID1, time=$count)successful" + + count=0 + while [ true ]; do + if ! ps -p ${DDPID2} > /dev/null 2>&1; then break; fi + count=$[count+1] + if [ $count -gt 60 ]; then + quota_error a $TSTUSR "dd should be finished!" + fi + sleep 1 + done + echo "(dd_pid=$DDPID2, time=$count)successful" + + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) + resetquota -u $TSTUSR + resetquota -g $TSTUSR + + return $RC } run_test_with_stat 21 "run for fixing bug16053 ===========" @@ -1892,70 +1892,70 @@ test_22() { run_test_with_stat 22 "test if quota_type saved as permanent parameter ====" test_23_sub() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - TESTFILE="$DIR/$tdir/$tfile-0" - rm -f $TESTFILE - local bs_unit=$((1024*1024)) - LIMIT=$1 - - wait_delete_completed - - # test for user - log " User quota (limit: $LIMIT kbytes)" - $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR - sleep 3 + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + TESTFILE="$DIR/$tdir/$tfile-0" + rm -f $TESTFILE + local bs_unit=$((1024*1024)) + LIMIT=$1 + + wait_delete_completed + + # test for user + log " User quota (limit: $LIMIT kbytes)" + $LFS setquota -u $TSTUSR -b 0 -B $LIMIT -i 0 -I 0 $DIR + sleep 3 quota_show_check b u $TSTUSR - $LFS setstripe $TESTFILE -c 1 - chown $TSTUSR.$TSTUSR $TESTFILE - - log " Step1: trigger quota with 0_DIRECT" - log " Write half of file" - $RUNAS $DIRECTIO write $TESTFILE 0 $(($LIMIT/1024/2)) $bs_unit || quota_error u $TSTUSR "(1) write failure, but expect success: $LIMIT" - log " Write out of block quota ..." - $RUNAS $DIRECTIO write $TESTFILE $(($LIMIT/1024/2)) $(($LIMIT/1024/2)) $bs_unit && quota_error u $TSTUSR "(2) write success, but expect EDQUOT: $LIMIT" - log " Step1: done" - - log " Step2: rewrite should succeed" - $RUNAS $DIRECTIO write $TESTFILE 0 1 $bs_unit || quota_error u $TSTUSR "(3) write failure, but expect success: $LIMIT" - log " Step2: done" - - rm -f $TESTFILE - wait_delete_completed - OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` - OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` - echo $OST0_QUOTA_USED - [ $OST0_QUOTA_USED -ne 0 ] && \ - ($SHOW_QUOTA_USER; quota_error u $TSTUSR "quota deleted isn't released") - $SHOW_QUOTA_USER - resetquota -u $TSTUSR + $LFS setstripe $TESTFILE -c 1 + chown $TSTUSR.$TSTUSR $TESTFILE + + log " Step1: trigger quota with 0_DIRECT" + log " Write half of file" + $RUNAS $DIRECTIO write $TESTFILE 0 $(($LIMIT/1024/2)) $bs_unit || quota_error u $TSTUSR "(1) write failure, but expect success: $LIMIT" + log " Write out of block quota ..." + $RUNAS $DIRECTIO write $TESTFILE $(($LIMIT/1024/2)) $(($LIMIT/1024/2)) $bs_unit && quota_error u $TSTUSR "(2) write success, but expect EDQUOT: $LIMIT" + log " Step1: done" + + log " Step2: rewrite should succeed" + $RUNAS $DIRECTIO write $TESTFILE 0 1 $bs_unit || quota_error u $TSTUSR "(3) write failure, but expect success: $LIMIT" + log " Step2: done" + + rm -f $TESTFILE + wait_delete_completed + OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` + OST0_QUOTA_USED=`$LFS quota -o $OST0_UUID -u $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + echo $OST0_QUOTA_USED + [ $OST0_QUOTA_USED -ne 0 ] && \ + ($SHOW_QUOTA_USER; quota_error u $TSTUSR "quota deleted isn't released") + $SHOW_QUOTA_USER + resetquota -u $TSTUSR } test_23() { - log "run for $((OSTCOUNT * 3))MB test file" - test_23_sub $((OSTCOUNT * 3 * 1024)) + log "run for $((OSTCOUNT * 3))MB test file" + test_23_sub $((OSTCOUNT * 3 * 1024)) - OST0_MIN=120000 - check_whether_skip && return 0 - log "run for $((OSTCOUNT * 30))MB test file" - test_23_sub $((OSTCOUNT * 30 * 1024)) + OST0_MIN=120000 + check_whether_skip && return 0 + log "run for $((OSTCOUNT * 30))MB test file" + test_23_sub $((OSTCOUNT * 30 * 1024)) } run_test_with_stat 23 "run for fixing bug16125 ===========" test_24() { - local TESTFILE="$DIR/$tdir/$tfile" - mkdir -p $DIR/$tdir + local TESTFILE="$DIR/$tdir/$tfile" + mkdir -p $DIR/$tdir - run_to_block_limit $TESTFILE - $SHOW_QUOTA_USER | grep '*' || error "no matching *" + run_to_block_limit $TESTFILE + $SHOW_QUOTA_USER | grep '*' || error "no matching *" - # cleanup - rm -f $TESTFILE - resetquota -u $TSTUSR + # cleanup + rm -f $TESTFILE + resetquota -u $TSTUSR - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) } run_test_with_stat 24 "test if lfs draws an asterix when limit is reached (16646) ===========" @@ -1963,7 +1963,7 @@ run_test_with_stat 24 "test if lfs draws an asterix when limit is reached (16646 show_quota() { if [ $1 = "-u" ]; then if [ $2 = "$TSTUSR" ]; then - $SHOW_QUOTA_USER + $SHOW_QUOTA_USER else $SHOW_QUOTA_USER2 fi @@ -1977,18 +1977,18 @@ show_quota() { } test_25_sub() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - TESTFILE="$DIR/$tdir/$tfile-0" - rm -f $TESTFILE - LIMIT=$(( $BUNIT_SZ * ($OSTCOUNT + 1) + 4096 )) + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + TESTFILE="$DIR/$tdir/$tfile-0" + rm -f $TESTFILE + LIMIT=$(( $BUNIT_SZ * ($OSTCOUNT + 1) + 4096 )) - wait_delete_completed + wait_delete_completed # set quota for $TSTUSR log "setquota for $TSTUSR" - $LFS setquota $1 $TSTUSR -b $LIMIT -B $LIMIT -i 10 -I 10 $DIR - sleep 3 + $LFS setquota $1 $TSTUSR -b $LIMIT -B $LIMIT -i 10 -I 10 $DIR + sleep 3 if [ "$1" == "-u" ]; then quota_show_check a u $TSTUSR else @@ -1997,8 +1997,8 @@ test_25_sub() { # set quota for $TSTUSR2 log "setquota for $TSTUSR2" - $LFS setquota $1 $TSTUSR2 -b $LIMIT -B $LIMIT -i 10 -I 10 $DIR - sleep 3 + $LFS setquota $1 $TSTUSR2 -b $LIMIT -B $LIMIT -i 10 -I 10 $DIR + sleep 3 if [ "$1" == "-u" ]; then quota_show_check a u $TSTUSR2 else @@ -2007,24 +2007,24 @@ test_25_sub() { # set stripe index to 0 log "setstripe for $DIR/$tdir to 0" - $LFS setstripe $DIR/$tdir -c 1 -i 0 - MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` - OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` - MDS_QUOTA_USED_OLD=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` - OST0_QUOTA_USED_OLD=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` - MDS_QUOTA_USED2_OLD=`$LFS quota -o $MDS_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` - OST0_QUOTA_USED2_OLD=`$LFS quota -o $OST0_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + $LFS setstripe $DIR/$tdir -c 1 -i 0 + MDS_UUID=`do_facet mds $LCTL dl | grep -m1 mds | awk '{print $((NF-1))}'` + OST0_UUID=`do_facet ost1 $LCTL dl | grep -m1 obdfilter | awk '{print $((NF-1))}'` + MDS_QUOTA_USED_OLD=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + OST0_QUOTA_USED_OLD=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + MDS_QUOTA_USED2_OLD=`$LFS quota -o $MDS_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + OST0_QUOTA_USED2_OLD=`$LFS quota -o $OST0_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` # TSTUSR write 4M log "$TSTUSR write 4M to $TESTFILE" $RUNAS dd if=/dev/zero of=$TESTFILE bs=4K count=1K || quota_error a $TSTUSR "dd failed" sync - show_quota $1 $TSTUSR - show_quota $1 $TSTUSR2 - MDS_QUOTA_USED_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + show_quota $1 $TSTUSR + show_quota $1 $TSTUSR2 + MDS_QUOTA_USED_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` [ $MDS_QUOTA_USED_NEW -ne $((MDS_QUOTA_USED_OLD + 1)) ] && \ quota_error a $TSTUSR "$TSTUSR inode quota usage error: [$MDS_QUOTA_USED_OLD|$MDS_QUOTA_USED_NEW]" - OST0_QUOTA_USED_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + OST0_QUOTA_USED_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` OST0_QUOTA_USED_DELTA=$((OST0_QUOTA_USED_NEW - OST0_QUOTA_USED_OLD)) [ $OST0_QUOTA_USED_DELTA -lt 4096 ] && \ quota_error a $TSTUSR "$TSTUSR block quota usage error: [$OST0_QUOTA_USED_OLD|$OST0_QUOTA_USED_NEW]" @@ -2038,81 +2038,81 @@ test_25_sub() { chgrp $TSTUSR2 $TESTFILE || quota_error g $TSTUSR2 "chgrp failed" fi sync - show_quota $1 $TSTUSR - show_quota $1 $TSTUSR2 - MDS_QUOTA_USED2_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + show_quota $1 $TSTUSR + show_quota $1 $TSTUSR2 + MDS_QUOTA_USED2_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` [ $MDS_QUOTA_USED2_NEW -ne $((MDS_QUOTA_USED2_OLD + 1)) ] && \ quota_error a $TSTUSR2 "$TSTUSR2 inode quota usage transfer from $TSTUSR to $TSTUSR2 failed: [$MDS_QUOTA_USED2_OLD|$MDS_QUOTA_USED2_NEW]" - OST0_QUOTA_USED2_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` - # when chown, the quota on ost could be displayed out of quota temporarily. Delete the '*' in this situation. b=20433 - OST0_QUOTA_USED2_NEW=${OST0_QUOTA_USED2_NEW%\*} + OST0_QUOTA_USED2_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR2 $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + # when chown, the quota on ost could be displayed out of quota temporarily. Delete the '*' in this situation. b=20433 + OST0_QUOTA_USED2_NEW=${OST0_QUOTA_USED2_NEW%\*} OST0_QUOTA_USED2_DELTA=$((OST0_QUOTA_USED2_NEW - OST0_QUOTA_USED2_OLD)) [ $OST0_QUOTA_USED2_DELTA -ne $OST0_QUOTA_USED_DELTA ] && \ quota_error a $TSTUSR2 "$TSTUSR2 block quota usage transfer from $TSTUSR to $TSTUSR2 failed: [$OST0_QUOTA_USED2_OLD|$OST0_QUOTA_USED2_NEW]" - MDS_QUOTA_USED_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` + MDS_QUOTA_USED_NEW=`$LFS quota -o $MDS_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $4 }'` [ $MDS_QUOTA_USED_NEW -ne $MDS_QUOTA_USED_OLD ] && \ quota_error a $TSTUSR "$TSTUSR inode quota usage transfer from $TSTUSR to $TSTUSR2 failed: [$MDS_QUOTA_USED_OLD|$MDS_QUOTA_USED_NEW]" - OST0_QUOTA_USED_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` + OST0_QUOTA_USED_NEW=`$LFS quota -o $OST0_UUID $1 $TSTUSR $DIR | awk '/^.*[[:digit:]+][[:space:]+]/ { print $1 }'` [ $OST0_QUOTA_USED_NEW -ne $OST0_QUOTA_USED_OLD ] && \ quota_error a $TSTUSR "$TSTUSR block quota usage transfer from $TSTUSR to $TSTUSR2 failed: [$OST0_QUOTA_USED_OLD|$OST0_QUOTA_USED_NEW]" - rm -f $TESTFILE - wait_delete_completed - resetquota $1 $TSTUSR - resetquota $1 $TSTUSR2 + rm -f $TESTFILE + wait_delete_completed + resetquota $1 $TSTUSR + resetquota $1 $TSTUSR2 } test_25() { - log "run for chown case" - test_25_sub -u + log "run for chown case" + test_25_sub -u - log "run for chgrp case" - test_25_sub -g + log "run for chgrp case" + test_25_sub -g } run_test_with_stat 25 "test whether quota usage is transfered when chown/chgrp (18081) ===========" test_26() { - mkdir -p $DIR/$tdir - chmod 0777 $DIR/$tdir - TESTFILE="$DIR/$tdir/$tfile-0" - TESTFILE2="$DIR/$tdir/$tfile-1" - set_blk_tunesz 512 - set_blk_unitsz 1024 - - wait_delete_completed - - # every quota slave gets 20MB - b_limit=$((OSTCOUNT * 20 * 1024)) - log "limit: ${b_limit}KB" - $LFS setquota -u $TSTUSR -b 0 -B $b_limit -i 0 -I 0 $DIR - sleep 3 - quota_show_check b u $TSTUSR - - $LFS setstripe $TESTFILE -c 1 -i 0 - $LFS setstripe $TESTFILE2 -c 1 -i 0 - chown $TSTUSR.$TSTUSR $TESTFILE - chown $TSTUSR.$TSTUSR $TESTFILE2 - - #define OBD_FAIL_QUOTA_DELAY_REL 0xA03 - lustre_fail ost 0xA03 - - log " Write the first file..." - $RUNAS $DIRECTIO write $TESTFILE 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success" - log " Delete the first file..." - rm -f $TESTFILE - - - wait_delete_completed - - log " Write the second file..." - $RUNAS $DIRECTIO write $TESTFILE2 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success" - log " Delete the second file..." - rm -f $TESTFILE2 - - lustre_fail ost 0 - set_blk_unitsz $((128 * 1024)) - set_blk_tunesz $((128 * 1024 / 2)) - resetquota -u $TSTUSR + mkdir -p $DIR/$tdir + chmod 0777 $DIR/$tdir + TESTFILE="$DIR/$tdir/$tfile-0" + TESTFILE2="$DIR/$tdir/$tfile-1" + set_blk_tunesz 512 + set_blk_unitsz 1024 + + wait_delete_completed + + # every quota slave gets 20MB + b_limit=$((OSTCOUNT * 20 * 1024)) + log "limit: ${b_limit}KB" + $LFS setquota -u $TSTUSR -b 0 -B $b_limit -i 0 -I 0 $DIR + sleep 3 + quota_show_check b u $TSTUSR + + $LFS setstripe $TESTFILE -c 1 -i 0 + $LFS setstripe $TESTFILE2 -c 1 -i 0 + chown $TSTUSR.$TSTUSR $TESTFILE + chown $TSTUSR.$TSTUSR $TESTFILE2 + + #define OBD_FAIL_QUOTA_DELAY_REL 0xA03 + lustre_fail ost 0xA03 + + log " Write the first file..." + $RUNAS $DIRECTIO write $TESTFILE 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success" + log " Delete the first file..." + rm -f $TESTFILE + + + wait_delete_completed + + log " Write the second file..." + $RUNAS $DIRECTIO write $TESTFILE2 0 10 $((BLK_SZ * 1024)) || quota_error u $TSTUSR "write failure, but expect success" + log " Delete the second file..." + rm -f $TESTFILE2 + + lustre_fail ost 0 + set_blk_unitsz $((128 * 1024)) + set_blk_tunesz $((128 * 1024 / 2)) + resetquota -u $TSTUSR } run_test_with_stat 26 "test for false quota error(bz18491) ======================================" @@ -2168,7 +2168,7 @@ test_28() { echo "Step 5: write the test file1 [10M] ..." $RUNAS dd if=/dev/zero of=$TESTFILE bs=$BLK_SZ count=$(( 10 * 1024 )) \ - || quota_error a $TSTUSR "write 10M file failure" + || quota_error a $TSTUSR "write 10M file failure" $SHOW_QUOTA_USER rm -f $TESTFILE @@ -2250,10 +2250,10 @@ run_test_with_stat 30 "hard limit updates should not reset grace times ========= # turn off quota test_99() { - $LFS quotaoff $DIR - lctl set_param debug="-quota" + $LFS quotaoff $DIR + lctl set_param debug="-quota" - return 0 + return 0 } run_test_with_stat 99 "Quota off ==============================="