[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176279909097.605950.5129078568168785441.stgit@frogsfrogsfrogs>
Date: Mon, 10 Nov 2025 10:27:20 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, zlang@...hat.com
Cc: fstests@...r.kernel.org, fstests@...r.kernel.org,
linux-ext4@...r.kernel.org
Subject: [PATCH 5/7] xfs/837: fix test to work with pre-metadir quota mount
options
From: Darrick J. Wong <djwong@...nel.org>
Prior to metadir, xfs users always had to supply quota mount options to
get quota functionality, even if the mount options match the ondisk
superblock's qflag state. The kernel, in turn, required a writable
filesystem if any mount options were specified. As a result, this test
fails on those old filesystems because the _scratch_mount fails.
Metadir filesystems reuse whatever's in qflags if no mount options are
supplied, so we don't need them in MOUNT_OPTS anymore.
Change the _scratch_mount to _try_scratch_mount and add configurable
golden output to handle this case.
Cc: <fstests@...r.kernel.org> # v2025.06.22
Fixes: e225772353e212 ("xfs: add mount test for read only rt devices")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
tests/xfs/837 | 28 ++++++++++++++++++++--------
tests/xfs/837.cfg | 1 +
tests/xfs/837.out.default | 0
tests/xfs/837.out.oldquota | 6 ++++++
4 files changed, 27 insertions(+), 8 deletions(-)
create mode 100644 tests/xfs/837.cfg
rename tests/xfs/{837.out => 837.out.default} (100%)
create mode 100644 tests/xfs/837.out.oldquota
diff --git a/tests/xfs/837 b/tests/xfs/837
index 61e51d3a7d0e81..2fe195a009f10f 100755
--- a/tests/xfs/837
+++ b/tests/xfs/837
@@ -8,6 +8,7 @@
# Check out various mount/remount/unmount scenarious on a read-only rtdev
# Based on generic/050
#
+seqfull=$0
. ./common/preamble
_begin_fstest mount auto quick
@@ -36,6 +37,17 @@ _register_cleanup "_cleanup_setrw"
_scratch_mkfs "-d rtinherit" > /dev/null 2>&1
+# Select appropriate output file
+features=""
+if ! _xfs_has_feature "$SCRATCH_DEV" metadir && echo "$MOUNT_OPTIONS" | grep -q quota ; then
+ # Mounting with quota mount options on a non-metadir fs requires a
+ # writable fs because the kernel requires write access even if the
+ # mount options match the superblock qflags. This means we expect to
+ # fail the ro blockdev test with with EPERM.
+ features="oldquota"
+fi
+_link_out_file "$features"
+
#
# Mark the rt device read-only.
#
@@ -46,20 +58,20 @@ blockdev --setro $SCRATCH_RTDEV
# Mount it and make sure it can't be written to.
#
echo "mounting read-only rt block device:"
-_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
+_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
if [ "${PIPESTATUS[0]}" -eq 0 ]; then
echo "writing to file on read-only filesystem:"
dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 oflag=direct 2>&1 | _filter_scratch
+
+ echo "remounting read-write:"
+ _scratch_remount rw 2>&1 | _filter_scratch | _filter_ro_mount
+
+ echo "unmounting read-only filesystem"
+ _scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
else
- _fail "failed to mount"
+ echo "failed to mount"
fi
-echo "remounting read-write:"
-_scratch_remount rw 2>&1 | _filter_scratch | _filter_ro_mount
-
-echo "unmounting read-only filesystem"
-_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
-
# success, all done
echo "*** done"
status=0
diff --git a/tests/xfs/837.cfg b/tests/xfs/837.cfg
new file mode 100644
index 00000000000000..01456b2fa80f04
--- /dev/null
+++ b/tests/xfs/837.cfg
@@ -0,0 +1 @@
+oldquota: oldquota
diff --git a/tests/xfs/837.out b/tests/xfs/837.out.default
similarity index 100%
rename from tests/xfs/837.out
rename to tests/xfs/837.out.default
diff --git a/tests/xfs/837.out.oldquota b/tests/xfs/837.out.oldquota
new file mode 100644
index 00000000000000..1383b4440dd8ee
--- /dev/null
+++ b/tests/xfs/837.out.oldquota
@@ -0,0 +1,6 @@
+QA output created by 837
+setting device read-only
+mounting read-only rt block device:
+mount: SCRATCH_MNT: permission denied
+failed to mount
+*** done
Powered by blists - more mailing lists