X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Ftests%2Fsanity-quota.sh;h=2b16a2bd9cd77243fcef5f02f20ab4cbf7413eb8;hb=5641279101af968b88e9929c4b9d79f9bb15a6ac;hp=3a61d12ef62ae56311cf554c805c1558d8803a4f;hpb=2b3745b4b98cc360fd337a4caae9b9e334ad735c;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 3a61d12..2b16a2b 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -50,12 +50,9 @@ if [ $(facet_fstype $SINGLEMDS) == ldiskfs ] && skip "e2fsprogs doesn't support quota" && exit 0 fi -# bug number for skipped test: LU-4515 -ALWAYS_EXCEPT="$ALWAYS_EXCEPT 34" - if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then -# bug number for skipped test: LU-2872 LU-2836 LU-2836 LU-2059 - ALWAYS_EXCEPT="$ALWAYS_EXCEPT 1 3 6 7d" +# bug number for skipped test: LU-2836 LU-2836 LU-2059 + ALWAYS_EXCEPT="$ALWAYS_EXCEPT 3 6 7d" # bug number: LU-2887 ZFS_SLOW="12a" fi @@ -89,21 +86,18 @@ SHOW_QUOTA_INFO_GROUP="$LFS quota -t -g $DIR" build_test_filter lustre_fail() { - local fail_node=$1 + local fail_node=$1 local fail_loc=$2 local fail_val=${3:-0} + local NODES= - if [ $fail_node == "mds" ] || [ $fail_node == "mds_ost" ]; then - do_facet $SINGLEMDS "lctl set_param fail_val=$fail_val" - do_facet $SINGLEMDS "lctl set_param fail_loc=$fail_loc" - fi + case $fail_node in + mds_ost|mdt_ost) NODES="$(comma_list $(mdts_nodes) $(osts_nodes))";; + mds|mdt) NODES="$(comma_list $(mdts_nodes))";; + ost) NODES="$(comma_list $(osts_nodes))";; + esac - if [ $fail_node == "ost" ] || [ $fail_node == "mds_ost" ]; then - for num in `seq $OSTCOUNT`; do - do_facet ost$num "lctl set_param fail_val=$fail_val" - do_facet ost$num "lctl set_param fail_loc=$fail_loc" - done - fi + do_nodes $NODES "lctl set_param fail_val=$fail_val fail_loc=$fail_loc" } RUNAS="runas -u $TSTID -g $TSTID" @@ -144,7 +138,7 @@ quota_scan() { fi if [ "$LOCAL_UG" == "a" -o "$LOCAL_UG" == "g" ]; then - $LFS quota -v -u $LOCAL_ID $DIR + $LFS quota -v -g $LOCAL_ID $DIR log "Files for group ($LOCAL_ID):" ($LFS find -group $LOCAL_ID $DIR | head -n 4 | xargs stat 2>/dev/null) @@ -742,7 +736,7 @@ test_file_soft() { test_4a() { local LIMIT=10 # inodes local TESTFILE=$DIR/$tdir/$tfile-0 - local GRACE=5 + local GRACE=12 set_mdt_qtype "ug" || error "enable mdt quota failed" @@ -933,9 +927,8 @@ test_6() { rm -f $TMP/lustre-log-${TESTNAME}.log - # write should continue & succeed + # write should continue then fail with EDQUOT local count=0 - local o_size=$(stat -c %s $TESTFILE) local c_size while [ true ]; do if ! ps -p ${DDPID} > /dev/null 2>&1; then break; fi @@ -945,13 +938,8 @@ test_6() { count=$((count + 1)) if [ $((count % 30)) -eq 0 ]; then c_size=$(stat -c %s $TESTFILE) - if [ $c_size -eq $o_size ]; then - quota_error u $TSTUSR "file not growed" \ - "in 30 seconds $o_size/$c_size" - else - echo "Waiting $count secs. $o_size/$c_size" - o_size=$c_size - fi + echo "Waiting $count secs. $c_size" + $SHOW_QUOTA_USER fi sleep 1 done @@ -2026,9 +2014,17 @@ test_27c() { error "lfs setquota failed" limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $3}') - [ $limit != "30M" ] && error "softlimit isn't human-readable" + [ $limit != "30M" ] && error "softlimit $limit isn't human-readable" limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $4}') - [ $limit != "3T" ] && error "hardlimit isn't human-readable" + [ $limit != "3T" ] && error "hardlimit $limit isn't human-readable" + + $LFS setquota -u $TSTID -b 1500M -B 18500G $DIR || + error "lfs setquota for $TSTID failed" + + limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $3}') + [ $limit != "1.465G" ] && error "wrong softlimit $limit" + limit=$($LFS quota -u $TSTID -v -h $DIR | grep $DIR | awk '{print $4}') + [ $limit != "18.07T" ] && error "wrong hardlimit $limit" $LFS quota -u $TSTID -v -h $DIR | grep -q "Total allocated" || error "total allocated inode/block limit not printed" @@ -2062,11 +2058,11 @@ test_30() { # over-quota flag has not yet settled since we do not trigger async # events based on grace time period expiration $SHOW_QUOTA_USER - $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 || true + $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=4 || true cancel_lru_locks osc # now over-quota flag should be settled and further writes should fail $SHOW_QUOTA_USER - $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=1 && + $RUNAS $DD of=$TESTFILE conv=notrunc oflag=append count=4 && error "grace times were reset" # cleanup cleanup_quota_test @@ -2145,6 +2141,9 @@ test_34() { USED=$(getquota -g $TSTID global curspace) [ $USED -ne 0 ] && error "Used space ($USED) for group $TSTID isn't 0." + local USED=$(getquota -u $TSTID2 global curspace) + [ $USED -ne 0 ] && error "Used space ($USED) for user $TSTID2 isn't 0." + echo "Write file..." $DD of=$DIR/$tdir/$tfile count=$BLK_CNT 2>/dev/null || error "write failed" @@ -2181,6 +2180,24 @@ test_34() { [ $USED -eq 1 ] || error "Used inodes for group $TSTID is $USED, expected 1" + # chown won't change the ost object group. LU-4345 */ + echo "chown the file to user $TSTID2" + chown $TSTID2 $DIR/$tdir/$tfile || error "chown to $TSTID2 failed" + + echo "Wait for setattr on objects finished..." + wait_delete_completed + + echo "Verify disk usage for user $TSTID2/$TSTID and group $TSTID" + USED=$(getquota -u $TSTID2 global curspace) + [ $USED -lt $BLK_CNT ] && + error "Used space for user $TSTID2 is $USED, expected $BLK_CNT" + USED=$(getquota -u $TSTID global curspace) + [ $USED -ne 0 ] && + error "Used space for user $TSTID is $USED, expected 0" + USED=$(getquota -g $TSTID global curspace) + [ $USED -lt $BLK_CNT ] && + error "Used space for group $TSTID is $USED, expected $BLK_CNT" + cleanup_quota_test } run_test 34 "Usage transfer for user & group" @@ -2332,6 +2349,36 @@ test_36() { } run_test 36 "Migrate old admin files into new global indexes" +# chown/chgrp to the file created with MDS_OPEN_DELAY_CREATE +# LU-5006 +test_37() { + setup_quota_test + trap cleanup_quota_test EXIT + + # make sure the system is clean + local USED=$(getquota -u $TSTID global curspace) + [ $USED -ne 0 ] && + error "Used space ($USED) for user $TSTID isn't 0." + + # create file with MDS_OPEN_DELAY_CREATE flag + $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile || + error "Create file failed" + # write to file + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=1 conv=notrunc \ + oflag=sync || error "Write file failed" + # chown to the file + chown $TSTID $DIR/$tdir/$tfile || error "Chown to file failed" + + # wait for setattr on objects finished..." + wait_delete_completed + + USED=$(getquota -u $TSTID global curspace) + [ $USED -ne 0 ] || quota_error u $TSTUSR "Used space is 0" + + cleanup_quota_test +} +run_test 37 "Quota accounted properly for file created by 'lfs setstripe'" + quota_fini() { do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"