diff mbox series

btrfs-progs: do not use async discard for misc/004

Message ID 5a292583be11ae383e79aaca0fa79be2141ef6ca.1717732459.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: do not use async discard for misc/004 | expand

Commit Message

Qu Wenruo June 7, 2024, 10:30 a.m. UTC
[BUG]
There is a long long existing failure in my local VM that with any newer
kernel (6.x) the test case misc/004 would fail with ENOSPC during
balance:

    [TEST]   misc-tests.sh
    [TEST/misc]   004-shrink-fs
 failed: /home/adam/btrfs-progs/btrfs balance start -mconvert=single -sconvert=single -f /home/adam/btrfs-progs/tests/mnt
 test failed for case 004-shrink-fs
 make: *** [Makefile:547: test-misc] Error 1

[CAUSE]
With more testing, it turns out that just before the balance, the
filesystem still have several empty data block groups.

The reason is the new default discard=async behavior, as it also changes
the empty block groups to be async, this leave the empty block groups
there, resulting no extra space for the convert balance.

[FIX]
I do not understand why for loopback block devices we also enable
discard, but at least disable discard for the test case so that we can
ensure the empty block groups get cleaned up properly.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/misc-tests/004-shrink-fs/test.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Sterba June 12, 2024, 7:54 p.m. UTC | #1
On Fri, Jun 07, 2024 at 08:00:45PM +0930, Qu Wenruo wrote:
> [BUG]
> There is a long long existing failure in my local VM that with any newer
> kernel (6.x) the test case misc/004 would fail with ENOSPC during
> balance:
> 
>     [TEST]   misc-tests.sh
>     [TEST/misc]   004-shrink-fs
>  failed: /home/adam/btrfs-progs/btrfs balance start -mconvert=single -sconvert=single -f /home/adam/btrfs-progs/tests/mnt
>  test failed for case 004-shrink-fs
>  make: *** [Makefile:547: test-misc] Error 1
> 
> [CAUSE]
> With more testing, it turns out that just before the balance, the
> filesystem still have several empty data block groups.
> 
> The reason is the new default discard=async behavior, as it also changes
> the empty block groups to be async, this leave the empty block groups
> there, resulting no extra space for the convert balance.
> 
> [FIX]
> I do not understand why for loopback block devices we also enable
> discard, but at least disable discard for the test case so that we can
> ensure the empty block groups get cleaned up properly.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Added to devel, thanks.
diff mbox series

Patch

diff --git a/tests/misc-tests/004-shrink-fs/test.sh b/tests/misc-tests/004-shrink-fs/test.sh
index c7473649020e..4fb42a024b81 100755
--- a/tests/misc-tests/004-shrink-fs/test.sh
+++ b/tests/misc-tests/004-shrink-fs/test.sh
@@ -32,7 +32,9 @@  shrink_test()
 
 run_check truncate -s 20G "$IMAGE"
 run_check "$TOP/mkfs.btrfs" -f "$IMAGE"
-run_check $SUDO_HELPER mount "$IMAGE" "$TEST_MNT"
+# Disable the new default async discard, which makes empty block group cleanup
+# async.
+run_check $SUDO_HELPER mount -o nodiscard "$IMAGE" "$TEST_MNT"
 run_check $SUDO_HELPER chmod a+rw "$TEST_MNT"
 
 # Create 7 data block groups, each with a size of 1Gb.