From d1d43f623e09815f13e732fbc75e1ff745740b30 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Mon, 20 Jan 2014 12:49:16 +1100 Subject: [PATCH] btrfs/022: fix failed case with qgroup limit test To have noexceed test, we should clear data before and then retry. However, when we are near to quota limit, we may fail to truncate/remove data before, so we restart everthing here. Signed-off-by: Wang Shilong Signed-off-by: Dave Chinner --- tests/btrfs/022 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/btrfs/022 b/tests/btrfs/022 index 5b186436..41d8588d 100644 --- a/tests/btrfs/022 +++ b/tests/btrfs/022 @@ -94,8 +94,8 @@ _rescan_test() _fail "exclusive values don't match after rescan" } -#basic limit testing -_limit_test() +#basic exceed limit testing +_limit_test_exceed() { run_check $BTRFS_UTIL_PROG subvol create $SCRATCH_MNT/a run_check $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT @@ -104,6 +104,15 @@ _limit_test() dd if=/dev/urandom of=$SCRATCH_MNT/a/file bs=10M count=1 >> \ $seqres.full 2>&1 [ $? -ne 0 ] || _fail "quota should have limited us" +} + +#basic noexceed limit testing +_limit_test_noexceed() +{ + run_check $BTRFS_UTIL_PROG subvol create $SCRATCH_MNT/a + run_check $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT + subvolid=$(_btrfs_get_subvolid $SCRATCH_MNT a) + run_check $BTRFS_UTIL_PROG qgroup limit 5M 0/$subvolid $SCRATCH_MNT dd if=/dev/urandom of=$SCRATCH_MNT/a/file bs=4M count=1 >> \ $seqres.full 2>&1 [ $? -eq 0 ] || _fail "should have been allowed to write" @@ -121,7 +130,12 @@ _scratch_unmount _scratch_mkfs > /dev/null 2>&1 _scratch_mount -_limit_test +_limit_test_exceed +_scratch_unmount + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount +_limit_test_noexceed # success, all done echo "Silence is golden" -- 2.39.5