]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
btrfs: test remount with "compress" clears "compress-force"
authorFilipe Manana <fdmanana@suse.com>
Fri, 25 Oct 2024 17:24:21 +0000 (18:24 +0100)
committerZorro Lang <zlang@kernel.org>
Sat, 26 Oct 2024 14:28:38 +0000 (22:28 +0800)
Test that remounting with the "compress" mount option clears the
"compress-force" mount option previously specified.

This tests a regression introduced with kernel 6.8 and recently fixed by
the following kernel commit:

  3510e684b8f6 ("btrfs: clear force-compress on remount when compress mount option is given")

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/324 [new file with mode: 0755]
tests/btrfs/324.out [new file with mode: 0644]

diff --git a/tests/btrfs/324 b/tests/btrfs/324
new file mode 100755 (executable)
index 0000000..5cafa4b
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2024 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# Test that remounting with the "compress" mount option clears the
+# "compress-force" mount option previously specified.
+#
+. ./common/preamble
+_begin_fstest auto quick mount remount compress
+
+_require_scratch
+
+_fixed_by_kernel_commit 3510e684b8f6 \
+       "btrfs: clear force-compress on remount when compress mount option is given"
+
+_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
+_scratch_mount -o compress-force=zlib:9
+
+# Confirm we have compress-force with zlib:9
+grep -wq 'compress-force=zlib:9' <(findmnt -rncv -S $SCRATCH_DEV -o OPTIONS)
+if [ $? -ne 0 ]; then
+       echo "compress-force not set to zlib:9 after initial mount:"
+       findmnt -rncv -S $SCRATCH_DEV -o OPTIONS
+fi
+
+# Remount with compress=zlib:4, which should clear compress-force and set the
+# algorithm to zlib:4.
+_scratch_remount compress=zlib:4
+
+grep -wq 'compress=zlib:4' <(findmnt -rncv -S $SCRATCH_DEV -o OPTIONS)
+if [ $? -ne 0 ]; then
+       echo "compress not set to zlib:4 after remount:"
+       findmnt -rncv -S $SCRATCH_DEV -o OPTIONS
+fi
+
+echo "Silence is golden"
+
+status=0
+exit
diff --git a/tests/btrfs/324.out b/tests/btrfs/324.out
new file mode 100644 (file)
index 0000000..b46ecd7
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 324
+Silence is golden