* [PATCH 0/2] Add xfs test coverage for ro external dev mounts
@ 2025-06-09 11:03 Hans Holmberg
2025-06-09 11:03 ` [PATCH 1/2] xfs: add mount test for read only rt devices Hans Holmberg
2025-06-09 11:03 ` [PATCH 2/2] ext4/002: make generic to support xfs Hans Holmberg
0 siblings, 2 replies; 7+ messages in thread
From: Hans Holmberg @ 2025-06-09 11:03 UTC (permalink / raw)
To: Zorro Lang
Cc: hch, tytso@mit.edu, djwong@kernel.org, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
Hans Holmberg
These two patches adds test coverage for verifying that xfs file
systems with external log and rt devices marked as read only will be
mounted and remounted correctly.
The first patch adds test coverage for xfs external rt devs.
ext4 already has a test for log devices that can be shared, so the
second patch turns that test generic.
This is an updated resend of these two patches:
https://lore.kernel.org/fstests/20250425090259.10154-2-hans.holmberg@wdc.com/
https://lore.kernel.org/fstests/20250502113415.14882-1-hans.holmberg@wdc.com/
Updates:
- Added _fixed_by_kernel_commit(s) as suggested by Ted
- Made sure the the new xfs test is skipped on internal rt file systems
Hans Holmberg (2):
xfs: add mount test for read only rt devices
ext4/002: make generic to support xfs
tests/{ext4/002 => generic/766} | 11 ++++-
tests/{ext4/002.out => generic/766.out} | 2 +-
tests/xfs/837 | 65 +++++++++++++++++++++++++
tests/xfs/837.out | 10 ++++
4 files changed, 86 insertions(+), 2 deletions(-)
rename tests/{ext4/002 => generic/766} (91%)
rename tests/{ext4/002.out => generic/766.out} (98%)
create mode 100755 tests/xfs/837
create mode 100644 tests/xfs/837.out
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] xfs: add mount test for read only rt devices
2025-06-09 11:03 [PATCH 0/2] Add xfs test coverage for ro external dev mounts Hans Holmberg
@ 2025-06-09 11:03 ` Hans Holmberg
2025-06-09 16:18 ` Darrick J. Wong
2025-06-10 3:36 ` hch
2025-06-09 11:03 ` [PATCH 2/2] ext4/002: make generic to support xfs Hans Holmberg
1 sibling, 2 replies; 7+ messages in thread
From: Hans Holmberg @ 2025-06-09 11:03 UTC (permalink / raw)
To: Zorro Lang
Cc: hch, tytso@mit.edu, djwong@kernel.org, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
Hans Holmberg
Make sure that we can mount rt devices read-only if them themselves
are marked as read-only.
Also make sure that rw re-mounts are not allowed if the device is
marked as read-only.
Based on generic/050.
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
---
tests/xfs/837 | 65 +++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/837.out | 10 ++++++++
2 files changed, 75 insertions(+)
create mode 100755 tests/xfs/837
create mode 100644 tests/xfs/837.out
diff --git a/tests/xfs/837 b/tests/xfs/837
new file mode 100755
index 000000000000..61e51d3a7d0e
--- /dev/null
+++ b/tests/xfs/837
@@ -0,0 +1,65 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2009 Christoph Hellwig.
+# Copyright (c) 2025 Western Digital Corporation
+#
+# FS QA Test No. 837
+#
+# Check out various mount/remount/unmount scenarious on a read-only rtdev
+# Based on generic/050
+#
+. ./common/preamble
+_begin_fstest mount auto quick
+
+_cleanup_setrw()
+{
+ cd /
+ blockdev --setrw $SCRATCH_RTDEV
+}
+
+# Import common functions.
+. ./common/filter
+
+_fixed_by_kernel_commit bfecc4091e07 \
+ "xfs: allow ro mounts if rtdev or logdev are read-only"
+
+_require_realtime
+_require_scratch
+
+if [ -z "$SCRATCH_RTDEV" ]; then
+ _notrun "requires external scratch rt device"
+else
+ _require_local_device $SCRATCH_RTDEV
+fi
+
+_register_cleanup "_cleanup_setrw"
+
+_scratch_mkfs "-d rtinherit" > /dev/null 2>&1
+
+#
+# Mark the rt device read-only.
+#
+echo "setting device read-only"
+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
+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
+else
+ _fail "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.out b/tests/xfs/837.out
new file mode 100644
index 000000000000..0a843a0ba398
--- /dev/null
+++ b/tests/xfs/837.out
@@ -0,0 +1,10 @@
+QA output created by 837
+setting device read-only
+mounting read-only rt block device:
+mount: device write-protected, mounting read-only
+writing to file on read-only filesystem:
+dd: failed to open 'SCRATCH_MNT/foo': Read-only file system
+remounting read-write:
+mount: cannot remount device read-write, is write-protected
+unmounting read-only filesystem
+*** done
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ext4/002: make generic to support xfs
2025-06-09 11:03 [PATCH 0/2] Add xfs test coverage for ro external dev mounts Hans Holmberg
2025-06-09 11:03 ` [PATCH 1/2] xfs: add mount test for read only rt devices Hans Holmberg
@ 2025-06-09 11:03 ` Hans Holmberg
2025-06-09 16:20 ` Darrick J. Wong
2025-06-10 3:37 ` hch
1 sibling, 2 replies; 7+ messages in thread
From: Hans Holmberg @ 2025-06-09 11:03 UTC (permalink / raw)
To: Zorro Lang
Cc: hch, tytso@mit.edu, djwong@kernel.org, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
Hans Holmberg
xfs supports separate log devices and as this test now passes, share
it by turning it into a generic test.
This should not result in a new failure for other file systems as only
ext2/ext3/ext4 and xfs supports mkfs with SCRATCH_LOGDEVs.
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
---
tests/{ext4/002 => generic/766} | 11 ++++++++++-
tests/{ext4/002.out => generic/766.out} | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
rename tests/{ext4/002 => generic/766} (91%)
rename tests/{ext4/002.out => generic/766.out} (98%)
diff --git a/tests/ext4/002 b/tests/generic/766
similarity index 91%
rename from tests/ext4/002
rename to tests/generic/766
index 6c1e1d926973..3b6911f0bdb9 100755
--- a/tests/ext4/002
+++ b/tests/generic/766
@@ -3,10 +3,11 @@
# Copyright (c) 2009 Christoph Hellwig.
# Copyright (c) 2020 Lukas Czerner.
#
-# FS QA Test No. 002
+# FS QA Test No. 766
#
# Copied from tests generic/050 and adjusted to support testing
# read-only external journal device on ext4.
+# Moved to generic from ext4/002 to support xfs as well
#
# Check out various mount/remount/unmount scenarious on a read-only
# logdev blockdev.
@@ -31,6 +32,14 @@ _cleanup()
_exclude_fs ext2
+[ $FSTYP == "ext4" ] && \
+ _fixed_by_kernel_commit 273108fa5015 \
+ "ext4: handle read only external journal device"
+
+[ $FSTYP == "xfs" ] && \
+ _fixed_by_kernel_commit bfecc4091e07 \
+ "xfs: allow ro mounts if rtdev or logdev are read-only"
+
_require_scratch_nocheck
_require_scratch_shutdown
_require_logdev
diff --git a/tests/ext4/002.out b/tests/generic/766.out
similarity index 98%
rename from tests/ext4/002.out
rename to tests/generic/766.out
index 579bc7e0cd78..975751751749 100644
--- a/tests/ext4/002.out
+++ b/tests/generic/766.out
@@ -1,4 +1,4 @@
-QA output created by 002
+QA output created by 766
setting log device read-only
mounting with read-only log device:
mount: device write-protected, mounting read-only
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] xfs: add mount test for read only rt devices
2025-06-09 11:03 ` [PATCH 1/2] xfs: add mount test for read only rt devices Hans Holmberg
@ 2025-06-09 16:18 ` Darrick J. Wong
2025-06-10 3:36 ` hch
1 sibling, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2025-06-09 16:18 UTC (permalink / raw)
To: Hans Holmberg
Cc: Zorro Lang, hch, tytso@mit.edu, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org
On Mon, Jun 09, 2025 at 11:03:53AM +0000, Hans Holmberg wrote:
> Make sure that we can mount rt devices read-only if them themselves
> are marked as read-only.
>
> Also make sure that rw re-mounts are not allowed if the device is
> marked as read-only.
>
> Based on generic/050.
>
> Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Looks fine to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> tests/xfs/837 | 65 +++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/837.out | 10 ++++++++
> 2 files changed, 75 insertions(+)
> create mode 100755 tests/xfs/837
> create mode 100644 tests/xfs/837.out
>
> diff --git a/tests/xfs/837 b/tests/xfs/837
> new file mode 100755
> index 000000000000..61e51d3a7d0e
> --- /dev/null
> +++ b/tests/xfs/837
> @@ -0,0 +1,65 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2009 Christoph Hellwig.
> +# Copyright (c) 2025 Western Digital Corporation
> +#
> +# FS QA Test No. 837
> +#
> +# Check out various mount/remount/unmount scenarious on a read-only rtdev
> +# Based on generic/050
> +#
> +. ./common/preamble
> +_begin_fstest mount auto quick
> +
> +_cleanup_setrw()
> +{
> + cd /
> + blockdev --setrw $SCRATCH_RTDEV
> +}
> +
> +# Import common functions.
> +. ./common/filter
> +
> +_fixed_by_kernel_commit bfecc4091e07 \
> + "xfs: allow ro mounts if rtdev or logdev are read-only"
> +
> +_require_realtime
> +_require_scratch
> +
> +if [ -z "$SCRATCH_RTDEV" ]; then
> + _notrun "requires external scratch rt device"
> +else
> + _require_local_device $SCRATCH_RTDEV
> +fi
> +
> +_register_cleanup "_cleanup_setrw"
> +
> +_scratch_mkfs "-d rtinherit" > /dev/null 2>&1
> +
> +#
> +# Mark the rt device read-only.
> +#
> +echo "setting device read-only"
> +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
> +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
> +else
> + _fail "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.out b/tests/xfs/837.out
> new file mode 100644
> index 000000000000..0a843a0ba398
> --- /dev/null
> +++ b/tests/xfs/837.out
> @@ -0,0 +1,10 @@
> +QA output created by 837
> +setting device read-only
> +mounting read-only rt block device:
> +mount: device write-protected, mounting read-only
> +writing to file on read-only filesystem:
> +dd: failed to open 'SCRATCH_MNT/foo': Read-only file system
> +remounting read-write:
> +mount: cannot remount device read-write, is write-protected
> +unmounting read-only filesystem
> +*** done
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ext4/002: make generic to support xfs
2025-06-09 11:03 ` [PATCH 2/2] ext4/002: make generic to support xfs Hans Holmberg
@ 2025-06-09 16:20 ` Darrick J. Wong
2025-06-10 3:37 ` hch
1 sibling, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2025-06-09 16:20 UTC (permalink / raw)
To: Hans Holmberg
Cc: Zorro Lang, hch, tytso@mit.edu, fstests@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org
On Mon, Jun 09, 2025 at 11:03:54AM +0000, Hans Holmberg wrote:
> xfs supports separate log devices and as this test now passes, share
> it by turning it into a generic test.
>
> This should not result in a new failure for other file systems as only
> ext2/ext3/ext4 and xfs supports mkfs with SCRATCH_LOGDEVs.
>
> Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Looks ok,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> tests/{ext4/002 => generic/766} | 11 ++++++++++-
> tests/{ext4/002.out => generic/766.out} | 2 +-
> 2 files changed, 11 insertions(+), 2 deletions(-)
> rename tests/{ext4/002 => generic/766} (91%)
> rename tests/{ext4/002.out => generic/766.out} (98%)
>
> diff --git a/tests/ext4/002 b/tests/generic/766
> similarity index 91%
> rename from tests/ext4/002
> rename to tests/generic/766
> index 6c1e1d926973..3b6911f0bdb9 100755
> --- a/tests/ext4/002
> +++ b/tests/generic/766
> @@ -3,10 +3,11 @@
> # Copyright (c) 2009 Christoph Hellwig.
> # Copyright (c) 2020 Lukas Czerner.
> #
> -# FS QA Test No. 002
> +# FS QA Test No. 766
> #
> # Copied from tests generic/050 and adjusted to support testing
> # read-only external journal device on ext4.
> +# Moved to generic from ext4/002 to support xfs as well
> #
> # Check out various mount/remount/unmount scenarious on a read-only
> # logdev blockdev.
> @@ -31,6 +32,14 @@ _cleanup()
>
> _exclude_fs ext2
>
> +[ $FSTYP == "ext4" ] && \
> + _fixed_by_kernel_commit 273108fa5015 \
> + "ext4: handle read only external journal device"
> +
> +[ $FSTYP == "xfs" ] && \
> + _fixed_by_kernel_commit bfecc4091e07 \
> + "xfs: allow ro mounts if rtdev or logdev are read-only"
> +
> _require_scratch_nocheck
> _require_scratch_shutdown
> _require_logdev
> diff --git a/tests/ext4/002.out b/tests/generic/766.out
> similarity index 98%
> rename from tests/ext4/002.out
> rename to tests/generic/766.out
> index 579bc7e0cd78..975751751749 100644
> --- a/tests/ext4/002.out
> +++ b/tests/generic/766.out
> @@ -1,4 +1,4 @@
> -QA output created by 002
> +QA output created by 766
> setting log device read-only
> mounting with read-only log device:
> mount: device write-protected, mounting read-only
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] xfs: add mount test for read only rt devices
2025-06-09 11:03 ` [PATCH 1/2] xfs: add mount test for read only rt devices Hans Holmberg
2025-06-09 16:18 ` Darrick J. Wong
@ 2025-06-10 3:36 ` hch
1 sibling, 0 replies; 7+ messages in thread
From: hch @ 2025-06-10 3:36 UTC (permalink / raw)
To: Hans Holmberg
Cc: Zorro Lang, hch, tytso@mit.edu, djwong@kernel.org,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-ext4@vger.kernel.org
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ext4/002: make generic to support xfs
2025-06-09 11:03 ` [PATCH 2/2] ext4/002: make generic to support xfs Hans Holmberg
2025-06-09 16:20 ` Darrick J. Wong
@ 2025-06-10 3:37 ` hch
1 sibling, 0 replies; 7+ messages in thread
From: hch @ 2025-06-10 3:37 UTC (permalink / raw)
To: Hans Holmberg
Cc: Zorro Lang, hch, tytso@mit.edu, djwong@kernel.org,
fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-ext4@vger.kernel.org
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-06-10 3:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 11:03 [PATCH 0/2] Add xfs test coverage for ro external dev mounts Hans Holmberg
2025-06-09 11:03 ` [PATCH 1/2] xfs: add mount test for read only rt devices Hans Holmberg
2025-06-09 16:18 ` Darrick J. Wong
2025-06-10 3:36 ` hch
2025-06-09 11:03 ` [PATCH 2/2] ext4/002: make generic to support xfs Hans Holmberg
2025-06-09 16:20 ` Darrick J. Wong
2025-06-10 3:37 ` hch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).