* [PATCHBOMB 6.13] xfs: metadata directories and realtime groups
@ 2024-10-11 0:24 Darrick J. Wong
2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong
` (3 more replies)
0 siblings, 4 replies; 37+ messages in thread
From: Darrick J. Wong @ 2024-10-11 0:24 UTC (permalink / raw)
To: Carlos Maiolino, Christoph Hellwig; +Cc: linux-xfs, fstests
Hi everyone,
Christoph and I have been working on getting the long-delayed metadata
directory tree patchset into mergeable shape, and I think we're now
satisfied that we've gotten the code to where we want it for 6.13.
This time around we've included a ton of cleanups and refactorings that
Dave requested during the 6.12 cycle.
The metadata directory tree sets us up for much more flexible metadata
within an XFS filesystem. Instead of rooting inodes in the superblock
which has very limited space, we instead create a directory tree that
can contain arbitrary numbers of metadata files.
Having done that, we can now shard the realtime volume into multiple
allocation groups, much as we do with AGs for the data device. However,
the realtime volume has a fun twist -- each rtgroup gets its own space
metadata files, and for that we need a metadata directory tree.
Note that we also implement busy free(d) extent tracking, which means
that we can do discards asynchronously.
Metadata directory trees and realtime groups also enable us to complete
the realtime modernization project, which will add reverse mapping
btrees, reflink, quota support, and zoned storage support for rt
volumes.
Finally, quota inodes now live in the metadata directory tree, which is
a pretty simple conversion. However, we added yet another new feature,
which is that xfs will now remember the quota accounting and enforcement
state across unmounts. You can still tweak them via mount options, but
not specifying any is no longer interpreted the same as 'noquota'.
Quotas for the realtime are now supported.
I'm only sending the kernel patches to the list for now, but please have
a look at the git tree links for xfsprogs and fstests changes.
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/tag/?h=metadir_2024-10-10
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git/tag/?h=metadir_2024-10-10
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfstests-dev.git/tag/?h=metadir-quotas_2024-10-10
This is a list of the kernel patches that remain unreviewed:
[PATCHSET v5.0 3/9] xfs: metadata inode directory trees
[PATCH 01/28] xfs: constify the xfs_sb predicates
[PATCH 02/28] xfs: constify the xfs_inode predicates
[PATCH 04/28] xfs: undefine the sb_bad_features2 when metadir is
[PATCHSET v5.0 4/9] xfs: create incore rt allocation groups
[PATCH 08/21] xfs: add a xfs_qm_unmount_rt helper
[PATCH 09/21] xfs: factor out a xfs_growfs_rt_alloc_blocks helper
[PATCH 10/21] xfs: cleanup xfs_getfsmap_rtdev_rtbitmap
[PATCH 11/21] xfs: split xfs_trim_rtdev_extents
[PATCHSET v5.0 5/9] xfs: preparation for realtime allocation groups
[PATCH 1/2] xfs: fix rt device offset calculations for FITRIM
[PATCHSET v5.0 6/9] xfs: shard the realtime section
[PATCH 15/36] xfs: store rtgroup information with a bmap intent
[PATCH 27/36] xfs: create helpers to deal with rounding xfs_fileoff_t
[PATCH 28/36] xfs: create helpers to deal with rounding xfs_filblks_t
[PATCH 29/36] xfs: make xfs_rtblock_t a segmented address like
[PATCH 32/36] xfs: fix minor bug in xfs_verify_agbno
[PATCH 33/36] xfs: move the min and max group block numbers to
[PATCH 34/36] xfs: port the perag discard code to handle generic
[PATCH 35/36] xfs: implement busy extent tracking for rtgroups
[PATCH 36/36] xfs: use rtgroup busy extent list for FITRIM
[PATCHSET v5.0 8/9] xfs: enable quota for realtime volumes
[PATCH 1/6] xfs: fix chown with rt quota
[PATCH 2/6] xfs: advertise realtime quota support in the xqm stat
[PATCH 3/6] xfs: report realtime block quota limits on realtime
[PATCH 4/6] xfs: create quota preallocation watermarks for realtime
[PATCH 5/6] xfs: reserve quota for realtime files correctly
[PATCH 6/6] xfs: enable realtime quota again
None of the userspace and fstests patches have been reviewed.
--D
^ permalink raw reply [flat|nested] 37+ messages in thread* [PATCHSET v5.0 1/3] fstests: test XFS metadata directories 2024-10-11 0:24 [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Darrick J. Wong @ 2024-10-11 0:37 ` Darrick J. Wong 2024-10-11 1:38 ` [PATCH 01/11] xfs/122: fix metadirino Darrick J. Wong ` (10 more replies) 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (2 subsequent siblings) 3 siblings, 11 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 0:37 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests Hi all, Adjust fstests as needed to support the XFS metadata directory feature, and add some new tests for online fsck and fuzz testing of the ondisk metadata. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=metadir xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=metadir fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=metadir xfsdocs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=metadir --- Commits in this patchset: * xfs/122: fix metadirino * various: fix finding metadata inode numbers when metadir is enabled * xfs/{030,033,178}: forcibly disable metadata directory trees * common/repair: patch up repair sb inode value complaints * xfs/206: update for metadata directory support * xfs/{050,144,153,299,330}: update quota reports to handle metadir trees * xfs/509: adjust inumbers accounting for metadata directories * xfs/122: adjust for metadata directories * xfs: create fuzz tests for metadata directories * xfs/163: bigger fs for metadir * xfs: test metapath repairs --- common/filter | 7 ++- common/repair | 4 ++ common/xfs | 85 ++++++++++++++++++++++++++++++++++++- tests/xfs/007 | 16 ++++--- tests/xfs/030 | 1 tests/xfs/033 | 1 tests/xfs/050 | 5 ++ tests/xfs/122.out | 4 +- tests/xfs/153 | 5 ++ tests/xfs/1546 | 34 +++++++++++++++ tests/xfs/1546.out | 4 ++ tests/xfs/1547 | 34 +++++++++++++++ tests/xfs/1547.out | 4 ++ tests/xfs/1548 | 34 +++++++++++++++ tests/xfs/1548.out | 4 ++ tests/xfs/1549 | 35 +++++++++++++++ tests/xfs/1549.out | 4 ++ tests/xfs/1550 | 34 +++++++++++++++ tests/xfs/1550.out | 4 ++ tests/xfs/1551 | 34 +++++++++++++++ tests/xfs/1551.out | 4 ++ tests/xfs/1552 | 34 +++++++++++++++ tests/xfs/1552.out | 4 ++ tests/xfs/1553 | 35 +++++++++++++++ tests/xfs/1553.out | 4 ++ tests/xfs/163 | 2 - tests/xfs/178 | 1 tests/xfs/1874 | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1874.out | 19 ++++++++ tests/xfs/206 | 1 tests/xfs/299 | 1 tests/xfs/330 | 6 ++- tests/xfs/509 | 23 +++++++++- tests/xfs/529 | 5 +- tests/xfs/530 | 6 +-- tests/xfs/739 | 9 +--- tests/xfs/740 | 9 +--- tests/xfs/741 | 9 +--- tests/xfs/742 | 9 +--- tests/xfs/743 | 9 +--- tests/xfs/744 | 9 +--- tests/xfs/745 | 9 +--- tests/xfs/746 | 9 +--- 43 files changed, 610 insertions(+), 79 deletions(-) create mode 100755 tests/xfs/1546 create mode 100644 tests/xfs/1546.out create mode 100755 tests/xfs/1547 create mode 100644 tests/xfs/1547.out create mode 100755 tests/xfs/1548 create mode 100644 tests/xfs/1548.out create mode 100755 tests/xfs/1549 create mode 100644 tests/xfs/1549.out create mode 100755 tests/xfs/1550 create mode 100644 tests/xfs/1550.out create mode 100755 tests/xfs/1551 create mode 100644 tests/xfs/1551.out create mode 100755 tests/xfs/1552 create mode 100644 tests/xfs/1552.out create mode 100755 tests/xfs/1553 create mode 100644 tests/xfs/1553.out create mode 100755 tests/xfs/1874 create mode 100644 tests/xfs/1874.out ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 01/11] xfs/122: fix metadirino 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong @ 2024-10-11 1:38 ` Darrick J. Wong 2024-10-11 1:38 ` [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled Darrick J. Wong ` (9 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:38 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Fix xfs/122 to work properly with metadirino. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/122.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 4dc7d7d0a3602b..64109489896fd5 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -35,6 +35,7 @@ offsetof(xfs_sb_t, sb_logsunit) = 196 offsetof(xfs_sb_t, sb_lsn) = 240 offsetof(xfs_sb_t, sb_magicnum) = 0 offsetof(xfs_sb_t, sb_meta_uuid) = 248 +offsetof(xfs_sb_t, sb_metadirino) = 264 offsetof(xfs_sb_t, sb_pquotino) = 232 offsetof(xfs_sb_t, sb_qflags) = 176 offsetof(xfs_sb_t, sb_rblocks) = 16 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong 2024-10-11 1:38 ` [PATCH 01/11] xfs/122: fix metadirino Darrick J. Wong @ 2024-10-11 1:38 ` Darrick J. Wong 2024-10-11 1:38 ` [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees Darrick J. Wong ` (8 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:38 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> There are a number of tests that use xfs_db to examine the contents of metadata inodes to check correct functioning. The logic is scattered everywhere and won't work with metadata directory trees, so make a shared helper to find these inodes. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 21 +++++++++++++++++++-- tests/xfs/007 | 16 +++++++++------- tests/xfs/529 | 5 ++--- tests/xfs/530 | 6 ++---- tests/xfs/739 | 9 ++------- tests/xfs/740 | 9 ++------- tests/xfs/741 | 9 ++------- tests/xfs/742 | 9 ++------- tests/xfs/743 | 9 ++------- tests/xfs/744 | 9 ++------- tests/xfs/745 | 9 ++------- tests/xfs/746 | 9 ++------- 12 files changed, 48 insertions(+), 72 deletions(-) diff --git a/common/xfs b/common/xfs index 62e3100ee117a7..ae32710072671e 100644 --- a/common/xfs +++ b/common/xfs @@ -1385,7 +1385,7 @@ _scratch_get_bmx_prefix() { _scratch_get_iext_count() { - local ino=$1 + local selector=$1 local whichfork=$2 local field="" @@ -1400,7 +1400,7 @@ _scratch_get_iext_count() return 1 esac - _scratch_xfs_get_metadata_field $field "inode $ino" + _scratch_xfs_get_metadata_field $field "$selector" } # @@ -1870,3 +1870,20 @@ _wipe_xfs_properties() setfattr --remove="$name" "$1" done } + +# Return the xfs_db selector for a superblock-rooted metadata file on the +# scratch filesystem. The sole argument is the name of the field within the +# superblock. This helper cannot be used to find files under the metadata +# directory tree. +_scratch_xfs_find_metafile() +{ + local metafile="$1" + local sb_field + + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" + if echo "$sb_field" | grep -q -w 'not found'; then + return 1 + fi + echo "inode $sb_field" + return 0 +} diff --git a/tests/xfs/007 b/tests/xfs/007 index 2535f04cac36a5..e35a069f9bd5c5 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -21,6 +21,11 @@ _require_xfs_quota _scratch_mkfs_xfs | _filter_mkfs > /dev/null 2> $tmp.mkfs . $tmp.mkfs +get_qfile_nblocks() { + local selector="$(_scratch_xfs_find_metafile "$1")" + _scratch_xfs_db -c "$selector" -c "p core.nblocks" +} + do_test() { qino_1=$1 @@ -30,12 +35,9 @@ do_test() echo "*** umount" _scratch_unmount - QINO_1=`_scratch_xfs_get_sb_field $qino_1` - QINO_2=`_scratch_xfs_get_sb_field $qino_2` - echo "*** Usage before quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 _qmount echo "*** turn off $off_opts quotas" @@ -65,8 +67,8 @@ do_test() _scratch_unmount echo "*** Usage after quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 } # Test user and group first diff --git a/tests/xfs/529 b/tests/xfs/529 index 14bdd2eebf7047..aab8668c76f46c 100755 --- a/tests/xfs/529 +++ b/tests/xfs/529 @@ -161,9 +161,8 @@ done _scratch_unmount >> $seqres.full echo "Verify uquota inode's extent count" -uquotino=$(_scratch_xfs_get_metadata_field 'uquotino' 'sb 0') - -nextents=$(_scratch_get_iext_count $uquotino data || \ +selector="$(_scratch_xfs_find_metafile uquotino)" +nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/530 b/tests/xfs/530 index 8a182bd6a3928a..f6c88cd12e187c 100755 --- a/tests/xfs/530 +++ b/tests/xfs/530 @@ -102,10 +102,8 @@ _scratch_unmount >> $seqres.full echo "Verify rbmino's and rsumino's extent count" for rtino in rbmino rsumino; do - ino=$(_scratch_xfs_get_metadata_field $rtino "sb 0") - echo "$rtino = $ino" >> $seqres.full - - nextents=$(_scratch_get_iext_count $ino data || \ + selector="$(_scratch_xfs_find_metafile "$rtino")" + nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/739 b/tests/xfs/739 index a4f553d818c2be..a143325e3facb6 100755 --- a/tests/xfs/739 +++ b/tests/xfs/739 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/740 b/tests/xfs/740 index 971bf31e3239b1..e867d591fd99cb 100755 --- a/tests/xfs/740 +++ b/tests/xfs/740 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/741 b/tests/xfs/741 index 4e24fb4e2fef31..ea4aa75b24741b 100755 --- a/tests/xfs/741 +++ b/tests/xfs/741 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/742 b/tests/xfs/742 index eabe766d725c07..967e384f659f72 100755 --- a/tests/xfs/742 +++ b/tests/xfs/742 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/743 b/tests/xfs/743 index b5cec7d71a4002..82b87b33792cdd 100755 --- a/tests/xfs/743 +++ b/tests/xfs/743 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/744 b/tests/xfs/744 index e2d097c2f0d59f..4840e78c4427ab 100755 --- a/tests/xfs/744 +++ b/tests/xfs/744 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/745 b/tests/xfs/745 index d139aeefdd8a37..6cc3805d4c9df8 100755 --- a/tests/xfs/745 +++ b/tests/xfs/745 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/746 b/tests/xfs/746 index 696d024532982a..b6ec74524b0eaa 100755 --- a/tests/xfs/746 +++ b/tests/xfs/746 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong 2024-10-11 1:38 ` [PATCH 01/11] xfs/122: fix metadirino Darrick J. Wong 2024-10-11 1:38 ` [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled Darrick J. Wong @ 2024-10-11 1:38 ` Darrick J. Wong 2024-10-11 1:39 ` [PATCH 04/11] common/repair: patch up repair sb inode value complaints Darrick J. Wong ` (7 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:38 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> The golden output for thests tests encode the xfs_repair output when we fuzz various parts of the filesystem. With metadata directory trees enabled, however, the golden output changes dramatically to reflect reconstruction of the metadata directory tree. To avoid regressions, add a helper to force metadata directories off via MKFS_OPTIONS. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 13 +++++++++++++ tests/xfs/030 | 1 + tests/xfs/033 | 1 + tests/xfs/178 | 1 + 4 files changed, 16 insertions(+) diff --git a/common/xfs b/common/xfs index ae32710072671e..20217ea7365a4d 100644 --- a/common/xfs +++ b/common/xfs @@ -1887,3 +1887,16 @@ _scratch_xfs_find_metafile() echo "inode $sb_field" return 0 } + +# Force metadata directories off. +_scratch_xfs_force_no_metadir() +{ + if echo "$MKFS_OPTIONS" | grep -q 'metadir='; then + MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/metadir=[0-9]*/metadir=0/g' -e 's/metadir\([, ]\)/metadir=0\1/g')" + return + fi + + if grep -q 'metadir=' $MKFS_XFS_PROG; then + MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" + fi +} diff --git a/tests/xfs/030 b/tests/xfs/030 index 7ce5ffce38693c..22fbdb2fdbc999 100755 --- a/tests/xfs/030 +++ b/tests/xfs/030 @@ -48,6 +48,7 @@ _check_ag() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir DSIZE="-dsize=100m,agcount=6" diff --git a/tests/xfs/033 b/tests/xfs/033 index d7b02a9c51b3f0..e0b0dd58212d61 100755 --- a/tests/xfs/033 +++ b/tests/xfs/033 @@ -51,6 +51,7 @@ _filter_bad_ids() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir # devzero blows away 512byte blocks, so make 512byte inodes (at least) _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null diff --git a/tests/xfs/178 b/tests/xfs/178 index a22e626706ec49..0cc0e3f5bb88b4 100755 --- a/tests/xfs/178 +++ b/tests/xfs/178 @@ -50,6 +50,7 @@ _dd_repair_check() # fix filesystem, new mkfs.xfs will be fine. _require_scratch +_scratch_xfs_force_no_metadir _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs # By executing the followint tmp file, will get on the mkfs options stored in ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 04/11] common/repair: patch up repair sb inode value complaints 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (2 preceding siblings ...) 2024-10-11 1:38 ` [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees Darrick J. Wong @ 2024-10-11 1:39 ` Darrick J. Wong 2024-10-11 1:39 ` [PATCH 05/11] xfs/206: update for metadata directory support Darrick J. Wong ` (6 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:39 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Now that we've refactored xfs_repair to be more consistent in how it reports unexpected superblock inode pointer values, we have to fix up the fstests repair filters to emulate the old golden output. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/repair | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/repair b/common/repair index 8945d0028c47a4..c3afcfb3e6966a 100644 --- a/common/repair +++ b/common/repair @@ -28,6 +28,10 @@ _filter_repair() perl -ne ' # for sb /- agno = / && next; # remove each AG line (variable number) +s/realtime bitmap inode pointer/realtime bitmap ino pointer/; +s/sb realtime bitmap inode value/sb realtime bitmap inode/; +s/realtime summary inode pointer/realtime summary ino pointer/; +s/sb realtime summary inode value/sb realtime summary inode/; s/(pointer to) (\d+)/\1 INO/; # Changed inode output in 5.5.0 s/sb root inode value /sb root inode /; ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 05/11] xfs/206: update for metadata directory support 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (3 preceding siblings ...) 2024-10-11 1:39 ` [PATCH 04/11] common/repair: patch up repair sb inode value complaints Darrick J. Wong @ 2024-10-11 1:39 ` Darrick J. Wong 2024-10-11 1:39 ` [PATCH 06/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees Darrick J. Wong ` (5 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:39 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Filter 'metadir=' out of the golden output so that metadata directories don't cause this test to regress. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/206 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/206 b/tests/xfs/206 index 1297433188e868..ef5f4868e9bdca 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -63,6 +63,7 @@ mkfs_filter() -e "s/, lazy-count=[0-9]//" \ -e "/.*crc=/d" \ -e "/exchange=/d" \ + -e '/metadir=.*/d' \ -e 's/, parent=[01]//' \ -e "/^Default configuration/d" } ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 06/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (4 preceding siblings ...) 2024-10-11 1:39 ` [PATCH 05/11] xfs/206: update for metadata directory support Darrick J. Wong @ 2024-10-11 1:39 ` Darrick J. Wong 2024-10-11 1:39 ` [PATCH 07/11] xfs/509: adjust inumbers accounting for metadata directories Darrick J. Wong ` (4 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:39 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Prior to the new metadir feature in XFS, the rtbitmap and rtsummary files were included in icount, though their bcount contribution is zero due to rt and quota not being supported together. With the new metadir feature in XFS, no files in the metadata directory tree are counted in quota. Hence we must adjust the icount of any quota report down by two to avoid breaking golden outputs. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/filter | 7 +++++-- common/xfs | 29 +++++++++++++++++++++++++++++ tests/xfs/050 | 5 +++++ tests/xfs/153 | 5 +++++ tests/xfs/299 | 1 + tests/xfs/330 | 6 +++++- 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/common/filter b/common/filter index 36d51bd957dd53..03f60672c0e106 100644 --- a/common/filter +++ b/common/filter @@ -618,11 +618,14 @@ _filter_getcap() # Filter user/group/project id numbers out of quota reports, and standardize # the block counts to use filesystem block size. Callers must set the id and -# bsize variables before calling this function. +# bsize variables before calling this function. The HIDDEN_QUOTA_FILES variable +# (by default zero) is the number of root files to filter out of the inode +# count part of the quota report. _filter_quota_report() { test -n "$id" || echo "id must be set" test -n "$bsize" || echo "block size must be set" + test -n "$HIDDEN_QUOTA_FILES" || HIDDEN_QUOTA_FILES=0 tr -s '[:space:]' | \ perl -npe ' @@ -630,7 +633,7 @@ _filter_quota_report() s/^\#0 \d+ /[ROOT] 0 /g; s/6 days/7 days/g' | perl -npe ' - $val = 0; + $val = '"$HIDDEN_QUOTA_FILES"'; if ($ENV{'LARGE_SCRATCH_DEV'}) { $val = $ENV{'NUM_SPACE_FILES'}; } diff --git a/common/xfs b/common/xfs index 20217ea7365a4d..f95a5a6d1d970e 100644 --- a/common/xfs +++ b/common/xfs @@ -1900,3 +1900,32 @@ _scratch_xfs_force_no_metadir() MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" fi } + +# Decide if a mount filesystem has metadata directory trees. +_xfs_mount_has_metadir() { + local mount="$1" + + # spaceman (and its info command) predate metadir + test ! -e "$XFS_SPACEMAN_PROG" && return 1 + $XFS_SPACEMAN_PROG -c "info" "$mount" | grep -q 'metadir=1' +} + +# Compute the number of files that are not counted in quotas. +_xfs_calc_hidden_quota_files() { + local mount="$1" + + if _xfs_mount_has_metadir "$mount"; then + # Prior to the metadir feature, the realtime bitmap and summary + # file were "owned" by root and hence accounted to the root + # dquots. The metadata directory feature stopped accounting + # metadata files to quotas, so we must subtract 2 inodes from + # the repquota golden outputs to keep the tests going. + # + # We needn't adjust the block counts because the kernel doesn't + # support rt quota and hence the rt metadata files will always + # be zero length. + echo -2 + else + echo 0 + fi +} diff --git a/tests/xfs/050 b/tests/xfs/050 index 7baaaeaa3efcf9..4ce56d375e945b 100755 --- a/tests/xfs/050 +++ b/tests/xfs/050 @@ -30,9 +30,14 @@ _require_scratch _require_xfs_quota _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/153 b/tests/xfs/153 index d5e43082c1cd35..2ce22b8c44b298 100755 --- a/tests/xfs/153 +++ b/tests/xfs/153 @@ -35,9 +35,14 @@ _require_idmapped_mounts _require_test_program "vfs/mount-idmapped" _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/299 b/tests/xfs/299 index 710eb89c2ac0e7..3986f8fb904e5d 100755 --- a/tests/xfs/299 +++ b/tests/xfs/299 @@ -155,6 +155,7 @@ _qmount_option "uquota,gquota,pquota" _qmount bsize=$(_get_file_block_size $SCRATCH_MNT) +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) bsoft=$(( 100 * $bsize )) bhard=$(( 500 * $bsize )) diff --git a/tests/xfs/330 b/tests/xfs/330 index d239a64085c76c..30c09ff5906e12 100755 --- a/tests/xfs/330 +++ b/tests/xfs/330 @@ -24,7 +24,10 @@ _require_nobody do_repquota() { - repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r + repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r | \ + perl -npe ' + $val = '"$HIDDEN_QUOTA_FILES"'; + s/(^root\s+--\s+\S+\s+\S+\s+\S+\s+)(\S+)/$1@{[$2 - $val]}/g' } rm -f "$seqres.full" @@ -33,6 +36,7 @@ echo "Format and mount" _scratch_mkfs > "$seqres.full" 2>&1 export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" _scratch_mount >> "$seqres.full" 2>&1 +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) quotacheck -u -g $SCRATCH_MNT 2> /dev/null quotaon $SCRATCH_MNT 2> /dev/null ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 07/11] xfs/509: adjust inumbers accounting for metadata directories 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (5 preceding siblings ...) 2024-10-11 1:39 ` [PATCH 06/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees Darrick J. Wong @ 2024-10-11 1:39 ` Darrick J. Wong 2024-10-11 1:40 ` [PATCH 08/11] xfs/122: adjust " Darrick J. Wong ` (3 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:39 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> The INUMBERS ioctl exports data from the inode btree directly -- the number of inodes it reports is taken from ir_freemask and includes all the files in the metadata directory tree. BULKSTAT, on the other hand, only reports non-metadata files. When metadir is enabled, this will (eventually) cause a discrepancy in the inode counts that is large enough to exceed the tolerances, thereby causing a test failure. Correct this by counting the files in the metadata directory and subtracting that from the INUMBERS totals. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/509 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/xfs/509 b/tests/xfs/509 index 53c6bd9c0772a1..9b07fecc5d1a10 100755 --- a/tests/xfs/509 +++ b/tests/xfs/509 @@ -91,13 +91,13 @@ inumbers_count() bstat_versions | while read v_tag v_flag; do echo -n "inumbers all($v_tag): " nr=$(inumbers_fs $SCRATCH_MNT $v_flag) - _within_tolerance "inumbers" $nr $expect $tolerance -v + _within_tolerance "inumbers" $((nr - METADATA_FILES)) $expect $tolerance -v local agcount=$(_xfs_mount_agcount $SCRATCH_MNT) for batchsize in 71 2 1; do echo -n "inumbers $batchsize($v_tag): " nr=$(inumbers_ag $agcount $batchsize $SCRATCH_MNT $v_flag) - _within_tolerance "inumbers" $nr $expect $tolerance -v + _within_tolerance "inumbers" $((nr - METADATA_FILES)) $expect $tolerance -v done done } @@ -142,9 +142,28 @@ _require_xfs_io_command inumbers DIRCOUNT=8 INOCOUNT=$((2048 / DIRCOUNT)) +# Count everything in the metadata directory tree. +count_metadir_files() { + # Each possible path in the metadata directory tree must be listed + # here. + local metadirs=('/rtgroups') + local db_args=('-f') + + for m in "${metadirs[@]}"; do + db_args+=('-c' "ls -m $m") + done + + local ret=$(_scratch_xfs_db "${db_args[@]}" 2>/dev/null | grep regular | wc -l) + test -z "$ret" && ret=0 + echo $ret +} + _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed" _scratch_mount +METADATA_FILES=$(count_metadir_files) +echo "found $METADATA_FILES metadata files" >> $seqres.full + # Figure out if we have v5 bulkstat/inumbers ioctls. has_v5= bs_root_out="$($XFS_IO_PROG -c 'bulkstat_single root' $SCRATCH_MNT 2>>$seqres.full)" ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 08/11] xfs/122: adjust for metadata directories 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (6 preceding siblings ...) 2024-10-11 1:39 ` [PATCH 07/11] xfs/509: adjust inumbers accounting for metadata directories Darrick J. Wong @ 2024-10-11 1:40 ` Darrick J. Wong 2024-10-11 1:40 ` [PATCH 09/11] xfs: create fuzz tests " Darrick J. Wong ` (2 subsequent siblings) 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:40 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Adjust this test for the metadir feature. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/122.out | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 64109489896fd5..f47904bc75e6de 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -36,6 +36,7 @@ offsetof(xfs_sb_t, sb_lsn) = 240 offsetof(xfs_sb_t, sb_magicnum) = 0 offsetof(xfs_sb_t, sb_meta_uuid) = 248 offsetof(xfs_sb_t, sb_metadirino) = 264 +offsetof(xfs_sb_t, sb_metadirpad) = 204 offsetof(xfs_sb_t, sb_pquotino) = 232 offsetof(xfs_sb_t, sb_qflags) = 176 offsetof(xfs_sb_t, sb_rblocks) = 16 @@ -92,7 +93,7 @@ sizeof(struct xfs_dir3_leaf) = 64 sizeof(struct xfs_dir3_leaf_hdr) = 64 sizeof(struct xfs_disk_dquot) = 104 sizeof(struct xfs_dqblk) = 136 -sizeof(struct xfs_dsb) = 264 +sizeof(struct xfs_dsb) = 272 sizeof(struct xfs_dsymlink_hdr) = 56 sizeof(struct xfs_exchange_range) = 40 sizeof(struct xfs_extent_data) = 24 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 09/11] xfs: create fuzz tests for metadata directories 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (7 preceding siblings ...) 2024-10-11 1:40 ` [PATCH 08/11] xfs/122: adjust " Darrick J. Wong @ 2024-10-11 1:40 ` Darrick J. Wong 2024-10-11 1:40 ` [PATCH 10/11] xfs/163: bigger fs for metadir Darrick J. Wong 2024-10-11 1:40 ` [PATCH 11/11] xfs: test metapath repairs Darrick J. Wong 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:40 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Create fuzz tests to make sure that all the validation works for metadata directories and subdirectories. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 22 ++++++++++++++++++++++ tests/xfs/1546 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1546.out | 4 ++++ tests/xfs/1547 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1547.out | 4 ++++ tests/xfs/1548 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1548.out | 4 ++++ tests/xfs/1549 | 35 +++++++++++++++++++++++++++++++++++ tests/xfs/1549.out | 4 ++++ tests/xfs/1550 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1550.out | 4 ++++ tests/xfs/1551 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1551.out | 4 ++++ tests/xfs/1552 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1552.out | 4 ++++ tests/xfs/1553 | 35 +++++++++++++++++++++++++++++++++++ tests/xfs/1553.out | 4 ++++ 17 files changed, 328 insertions(+) create mode 100755 tests/xfs/1546 create mode 100644 tests/xfs/1546.out create mode 100755 tests/xfs/1547 create mode 100644 tests/xfs/1547.out create mode 100755 tests/xfs/1548 create mode 100644 tests/xfs/1548.out create mode 100755 tests/xfs/1549 create mode 100644 tests/xfs/1549.out create mode 100755 tests/xfs/1550 create mode 100644 tests/xfs/1550.out create mode 100755 tests/xfs/1551 create mode 100644 tests/xfs/1551.out create mode 100755 tests/xfs/1552 create mode 100644 tests/xfs/1552.out create mode 100755 tests/xfs/1553 create mode 100644 tests/xfs/1553.out diff --git a/common/xfs b/common/xfs index f95a5a6d1d970e..39cb04ff2cddcd 100644 --- a/common/xfs +++ b/common/xfs @@ -1929,3 +1929,25 @@ _xfs_calc_hidden_quota_files() { echo 0 fi } + +_require_xfs_mkfs_metadir() +{ + _scratch_mkfs_xfs_supported -m metadir=1 >/dev/null 2>&1 || \ + _notrun "mkfs.xfs doesn't have metadir features" +} + +_require_xfs_scratch_metadir() +{ + _require_xfs_mkfs_metadir + _require_scratch + + _scratch_mkfs -m metadir=1 &> /dev/null + _require_scratch_xfs_features METADIR + _try_scratch_mount + res=$? + if [ $res -ne 0 ]; then + _notrun "mounting with metadir not supported by filesystem type: $FSTYP" + else + _scratch_unmount + fi +} diff --git a/tests/xfs/1546 b/tests/xfs/1546 new file mode 100755 index 00000000000000..e41ee0d4a6c759 --- /dev/null +++ b/tests/xfs/1546 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1546 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1546.out b/tests/xfs/1546.out new file mode 100644 index 00000000000000..b72891a7583c04 --- /dev/null +++ b/tests/xfs/1546.out @@ -0,0 +1,4 @@ +QA output created by 1546 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1547 b/tests/xfs/1547 new file mode 100755 index 00000000000000..b82c2ef6a87aed --- /dev/null +++ b/tests/xfs/1547 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1547 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1547.out b/tests/xfs/1547.out new file mode 100644 index 00000000000000..983cc01343e5f4 --- /dev/null +++ b/tests/xfs/1547.out @@ -0,0 +1,4 @@ +QA output created by 1547 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1548 b/tests/xfs/1548 new file mode 100755 index 00000000000000..b2ca3016842e3a --- /dev/null +++ b/tests/xfs/1548 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1548 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1548.out b/tests/xfs/1548.out new file mode 100644 index 00000000000000..9e395bb059436d --- /dev/null +++ b/tests/xfs/1548.out @@ -0,0 +1,4 @@ +QA output created by 1548 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1549 b/tests/xfs/1549 new file mode 100755 index 00000000000000..f0b01c9ce1e177 --- /dev/null +++ b/tests/xfs/1549 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1549 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1549.out b/tests/xfs/1549.out new file mode 100644 index 00000000000000..22b3d215e32e7b --- /dev/null +++ b/tests/xfs/1549.out @@ -0,0 +1,4 @@ +QA output created by 1549 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1550 b/tests/xfs/1550 new file mode 100755 index 00000000000000..b8da04676cd6b3 --- /dev/null +++ b/tests/xfs/1550 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1550 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1550.out b/tests/xfs/1550.out new file mode 100644 index 00000000000000..7694cd670bd25b --- /dev/null +++ b/tests/xfs/1550.out @@ -0,0 +1,4 @@ +QA output created by 1550 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1551 b/tests/xfs/1551 new file mode 100755 index 00000000000000..df721d9b34dae2 --- /dev/null +++ b/tests/xfs/1551 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1551 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1551.out b/tests/xfs/1551.out new file mode 100644 index 00000000000000..4c3360d08b34f8 --- /dev/null +++ b/tests/xfs/1551.out @@ -0,0 +1,4 @@ +QA output created by 1551 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1552 b/tests/xfs/1552 new file mode 100755 index 00000000000000..8672cb3c08bedf --- /dev/null +++ b/tests/xfs/1552 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1552 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1552.out b/tests/xfs/1552.out new file mode 100644 index 00000000000000..6636b1b656c926 --- /dev/null +++ b/tests/xfs/1552.out @@ -0,0 +1,4 @@ +QA output created by 1552 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1553 b/tests/xfs/1553 new file mode 100755 index 00000000000000..b98ad67904c31f --- /dev/null +++ b/tests/xfs/1553 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1553 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1553.out b/tests/xfs/1553.out new file mode 100644 index 00000000000000..0298fcfddbf15a --- /dev/null +++ b/tests/xfs/1553.out @@ -0,0 +1,4 @@ +QA output created by 1553 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 10/11] xfs/163: bigger fs for metadir 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (8 preceding siblings ...) 2024-10-11 1:40 ` [PATCH 09/11] xfs: create fuzz tests " Darrick J. Wong @ 2024-10-11 1:40 ` Darrick J. Wong 2024-10-11 1:40 ` [PATCH 11/11] xfs: test metapath repairs Darrick J. Wong 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:40 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Adjust filesystem size up so we can pass this test even with metadir and rtgroups enabled. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/163 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/163 b/tests/xfs/163 index 2bd94060222f96..04b09d15afadfe 100755 --- a/tests/xfs/163 +++ b/tests/xfs/163 @@ -35,7 +35,7 @@ echo "Format and mount" # agcount = 1 is forbidden on purpose, and need to ensure shrinking to # 2 AGs isn't feasible yet. So agcount = 3 is the minimum number now. -_scratch_mkfs -dsize="$((512 * 1024 * 1024))" -dagcount=3 2>&1 | \ +_scratch_mkfs -dsize="$((900 * 1024 * 1024))" -dagcount=3 2>&1 | \ tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs t_dblocks=$dblocks ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 11/11] xfs: test metapath repairs 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong ` (9 preceding siblings ...) 2024-10-11 1:40 ` [PATCH 10/11] xfs/163: bigger fs for metadir Darrick J. Wong @ 2024-10-11 1:40 ` Darrick J. Wong 10 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:40 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Functional testing for metadir path checking and repairs. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/1874 | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1874.out | 19 ++++++++ 2 files changed, 138 insertions(+) create mode 100755 tests/xfs/1874 create mode 100644 tests/xfs/1874.out diff --git a/tests/xfs/1874 b/tests/xfs/1874 new file mode 100755 index 00000000000000..9a5eda43d38fdc --- /dev/null +++ b/tests/xfs/1874 @@ -0,0 +1,119 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023-2024 Oracle. All Rights Reserved. +# +# FS QA Test 1874 +# +# Functional test of using online repair to fix metadir paths. +# +. ./common/preamble +_begin_fstest auto online_repair + +. ./common/filter +. ./common/inject +. ./common/fuzzy +. ./common/quota + +_require_xfs_db_command "link" +_require_xfs_db_command "unlink" +_require_scratch +_require_xfs_stress_online_repair + +prepare_fs() { + # Format filesystem + _scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full + _scratch_mount + + _require_xfs_has_feature "$SCRATCH_MNT" rmapbt + _require_xfs_has_feature "$SCRATCH_MNT" realtime + _require_xfs_has_feature "$SCRATCH_MNT" metadir + _require_xfs_has_feature "$SCRATCH_MNT" parent + + root_inum="$(stat -c '%i' $SCRATCH_MNT)" + __stress_scrub_check_commands "%dir%" '' '' 'scrub metapath' + _scratch_unmount + + # Stash the /rtgroups inode number and gen + rt_metadir_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups') + rt_metadir_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups') + + # Stash the /rtgroups/0.rmap inode number and gen + rbm_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups/0.rmap') + rbm_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups/0.rmap') + + # Fuzz parent pointer in rtgroup 0 rmap file + _scratch_xfs_db -x \ + -c 'path -m /rtgroups/0.rmap' \ + -c "write -d a.sfattr.list[0].parent_dir.inumber $root_inum" >> $seqres.full +} + +simple_online_repair() { + echo "check /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -c "scrub directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -c "scrub parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -c "scrub metapath rtrmapbt 0" $SCRATCH_MNT + + echo "check nlinks" | _tee_kernlog + $XFS_IO_PROG -c "scrub nlinks" $SCRATCH_MNT + + # Destroying a metadir path (e.g. /rtgroups/0.rmap) cannot be done + # offline because then the mount will fail. Hence we must use a + # specific sequence of online repairs to remove the metadir path link. + # Only then can we use the metapath scrubber to restore the link. + + # Force repair the parent directory. Since /rtgroups/0.rmap has a bad + # parent pointer, the "0.rmap" entry in /rtgroups will not be created. + echo "fix /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + # Force repair the parent pointer. Since the "0.rmap" entry in + # /rtgroups no longer exists and no other directories count the + # rtgroup 0 rmap as a parent, this will fail cross-referencing after + # the repair. + echo "fix /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + # Now that we've completely erased the /rtgroups/0.rmap path, check + # that the link is indeed lost, and restore the link. + echo "fix /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -x -c "repair metapath rtrmapbt 0" $SCRATCH_MNT + + # Make sure we're not missing any link count + echo "fix nlinks" | _tee_kernlog + $XFS_IO_PROG -x -c "repair nlinks" $SCRATCH_MNT +} + +echo Part 1: Use raw ioctls to detect the error and fix it. +prepare_fs +_scratch_mount +simple_online_repair +_check_scratch_fs +_scratch_unmount + +echo Part 2: Use xfs_scrub to detect the error and fix it. +prepare_fs +_scratch_mount +echo "fix with xfs_scrub" | _tee_kernlog +_scratch_scrub &>> $seqres.full +echo "xfs_scrub returned $?" >> $seqres.full +_check_scratch_fs +_scratch_unmount + +echo Part 3: Use xfs_repair to detect the error and fix it. +prepare_fs +echo "fix with xfs_repair" | _tee_kernlog +echo repair?? >> $seqres.full +_scratch_xfs_repair &>> $seqres.full +echo "xfs_repair returned $?" >> $seqres.full +_scratch_mount +_check_scratch_fs +_scratch_unmount + +echo "done with test" | _tee_kernlog +# success, all done +status=0 +exit diff --git a/tests/xfs/1874.out b/tests/xfs/1874.out new file mode 100644 index 00000000000000..ff4497363d8063 --- /dev/null +++ b/tests/xfs/1874.out @@ -0,0 +1,19 @@ +QA output created by 1874 +Part 1: Use raw ioctls to detect the error and fix it. +check /rtgroups dir +Corruption detected during cross-referencing. +check /rtgroups/0.rmap pptr +Corruption detected during cross-referencing. +check /rtgroups/0.rmap metapath +check nlinks +fix /rtgroups dir +fix /rtgroups/0.rmap pptr +Corruption remains. +Corruption still detected during cross-referencing. +fix /rtgroups/0.rmap metapath +fix nlinks +Part 2: Use xfs_scrub to detect the error and fix it. +fix with xfs_scrub +Part 3: Use xfs_repair to detect the error and fix it. +fix with xfs_repair +done with test ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section 2024-10-11 0:24 [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Darrick J. Wong 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong @ 2024-10-11 0:37 ` Darrick J. Wong 2024-10-11 1:41 ` [PATCH 01/16] common/populate: refactor caching of metadumps to a helper Darrick J. Wong ` (15 more replies) 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong 2024-10-14 7:50 ` [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Christoph Hellwig 3 siblings, 16 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 0:37 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests Hi all, Right now, the realtime section uses a single pair of metadata inodes to store the free space information. This presents a scalability problem since every thread trying to allocate or free rt extents have to lock these files. It would be very useful if we could begin to tackle these problems by sharding the realtime section, so create the notion of realtime groups, which are similar to allocation groups on the data section. While we're at it, define a superblock to be stamped into the start of each rt section. This enables utilities such as blkid to identify block devices containing realtime sections, and helpfully avoids the situation where a file extent can cross an rtgroup boundary. The best advantage for rtgroups will become evident later when we get to adding rmap and reflink to the realtime volume, since the geometry constraints are the same for rt groups and AGs. Hence we can reuse all that code directly. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=realtime-groups xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=realtime-groups fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=realtime-groups xfsdocs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=realtime-groups --- Commits in this patchset: * common/populate: refactor caching of metadumps to a helper * common/{fuzzy,populate}: use _scratch_xfs_mdrestore * fuzzy: stress data and rt sections of xfs filesystems equally * common/ext4: reformat external logs during mdrestore operations * common/populate: use metadump v2 format by default for fs metadata snapshots * xfs/122: update for rtgroups * punch-alternating: detect xfs realtime files with large allocation units * xfs/206: update mkfs filtering for rt groups feature * common: pass the realtime device to xfs_db when possible * xfs/185: update for rtgroups * xfs/449: update test to know about xfs_db -R * xfs/122: update for rtbitmap headers * xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands * common/xfs: capture realtime devices during metadump/mdrestore * common/fuzzy: adapt the scrub stress tests to support rtgroups * xfs: fix fuzz tests of rtgroups bitmap and summary files --- common/ext4 | 17 ++++++++ common/fuzzy | 95 ++++++++++++++++++++++++++++++++++++----------- common/metadump | 21 ++++++++-- common/populate | 85 ++++++++++++++++++++++++------------------ common/xfs | 87 +++++++++++++++++++++++++++++++++++++++---- src/punch-alternating.c | 28 +++++++++++++- tests/xfs/114 | 4 ++ tests/xfs/122.out | 8 +++- tests/xfs/146 | 2 - tests/xfs/185 | 65 +++++++++++++++++++++++++------- tests/xfs/187 | 3 + tests/xfs/206 | 1 tests/xfs/271 | 4 +- tests/xfs/341 | 4 +- tests/xfs/449 | 6 ++- tests/xfs/556 | 16 +++++--- tests/xfs/581 | 9 ++++ tests/xfs/582 | 14 +++---- tests/xfs/720 | 2 - tests/xfs/739 | 6 ++- tests/xfs/740 | 6 ++- tests/xfs/741 | 6 ++- tests/xfs/742 | 6 ++- tests/xfs/743 | 6 ++- tests/xfs/744 | 6 ++- tests/xfs/745 | 6 ++- tests/xfs/746 | 6 ++- tests/xfs/793 | 14 +++---- tests/xfs/795 | 2 - 29 files changed, 409 insertions(+), 126 deletions(-) ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 01/16] common/populate: refactor caching of metadumps to a helper 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong @ 2024-10-11 1:41 ` Darrick J. Wong 2024-10-11 1:41 ` [PATCH 02/16] common/{fuzzy,populate}: use _scratch_xfs_mdrestore Darrick J. Wong ` (14 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:41 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Hoist out of _scratch_populate_cached all the code that we use to save a metadump of the populated filesystem. We're going to make this more involved for XFS in the next few patches so that we can take advantage of the new support for external devices in metadump/mdrestore. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/populate | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/common/populate b/common/populate index 88c8ba2b32767c..82f526dcf9e2d5 100644 --- a/common/populate +++ b/common/populate @@ -1051,6 +1051,31 @@ _scratch_populate_restore_cached() { return 1 } +# Take a metadump of the scratch filesystem and cache it for later. +_scratch_populate_save_metadump() +{ + local metadump_file="$1" + + case "${FSTYP}" in + "xfs") + local logdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + logdev=$SCRATCH_LOGDEV + + _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ + compress -a -o + res=$? + ;; + "ext2"|"ext3"|"ext4") + _ext4_metadump "${SCRATCH_DEV}" "${metadump_file}" compress + res=$? + ;; + *) + _fail "Don't know how to save a ${FSTYP} filesystem." + esac + return $res +} + # Populate a scratch FS from scratch or from a cached image. _scratch_populate_cached() { local meta_descr="$(_scratch_populate_cache_tag "$@")" @@ -1074,26 +1099,20 @@ _scratch_populate_cached() { # Oh well, just create one from scratch _scratch_mkfs - echo "${meta_descr}" > "${populate_metadump_descr}" case "${FSTYP}" in "xfs") _scratch_xfs_populate $@ _scratch_xfs_populate_check - - local logdev=none - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ - logdev=$SCRATCH_LOGDEV - - _xfs_metadump "$POPULATE_METADUMP" "$SCRATCH_DEV" "$logdev" \ - compress -a -o ;; "ext2"|"ext3"|"ext4") _scratch_ext4_populate $@ _scratch_ext4_populate_check - _ext4_metadump "${SCRATCH_DEV}" "${POPULATE_METADUMP}" compress ;; *) _fail "Don't know how to populate a ${FSTYP} filesystem." ;; esac + + _scratch_populate_save_metadump "${POPULATE_METADUMP}" && \ + echo "${meta_descr}" > "${populate_metadump_descr}" } ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 02/16] common/{fuzzy,populate}: use _scratch_xfs_mdrestore 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong 2024-10-11 1:41 ` [PATCH 01/16] common/populate: refactor caching of metadumps to a helper Darrick J. Wong @ 2024-10-11 1:41 ` Darrick J. Wong 2024-10-11 1:41 ` [PATCH 03/16] fuzzy: stress data and rt sections of xfs filesystems equally Darrick J. Wong ` (13 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:41 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Port the fuzzing and populated filesystem cache code to use this helper to pick up external log devices for the scratch filesystem. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/fuzzy | 2 +- common/populate | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 14d6cb104aaf57..73e5cd2a544455 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -306,7 +306,7 @@ __scratch_xfs_fuzz_unmount() __scratch_xfs_fuzz_mdrestore() { __scratch_xfs_fuzz_unmount - _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" || \ + _scratch_xfs_mdrestore "${POPULATE_METADUMP}" || \ _fail "${POPULATE_METADUMP}: Could not find metadump to restore?" } diff --git a/common/populate b/common/populate index 82f526dcf9e2d5..94ee7af9ba1c95 100644 --- a/common/populate +++ b/common/populate @@ -1017,19 +1017,8 @@ _scratch_populate_restore_cached() { case "${FSTYP}" in "xfs") - _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" - res=$? - test $res -ne 0 && return $res - - # Cached images should have been unmounted cleanly, so if - # there's an external log we need to wipe it and run repair to - # format it to match this filesystem. - if [ -n "${SCRATCH_LOGDEV}" ]; then - $WIPEFS_PROG -a "${SCRATCH_LOGDEV}" - _scratch_xfs_repair - res=$? - fi - return $res + _scratch_xfs_mdrestore "${metadump}" + return $? ;; "ext2"|"ext3"|"ext4") _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 03/16] fuzzy: stress data and rt sections of xfs filesystems equally 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong 2024-10-11 1:41 ` [PATCH 01/16] common/populate: refactor caching of metadumps to a helper Darrick J. Wong 2024-10-11 1:41 ` [PATCH 02/16] common/{fuzzy,populate}: use _scratch_xfs_mdrestore Darrick J. Wong @ 2024-10-11 1:41 ` Darrick J. Wong 2024-10-11 1:42 ` [PATCH 04/16] common/ext4: reformat external logs during mdrestore operations Darrick J. Wong ` (12 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:41 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> If we're stress-testing scrub on a realtime filesystem, make sure that we run fsstress on separate directory trees for data and realtime workouts. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/fuzzy | 66 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index 73e5cd2a544455..ceb547669b51cd 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -998,13 +998,37 @@ __stress_scrub_fsx_loop() { rm -f "$runningfile" } +# Run fsstress with a timeout, and touch $tmp.killstress if dead +__run_timed_fsstress() { + timeout -s TERM "$remount_period" $FSSTRESS_PROG $* >> $seqres.full + res=$? + echo "$mode fsstress $* exits with $res at $(date)" >> $seqres.full + if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then + # Stop if fsstress returns error. Mask off the magic code 124 + # because that is how the timeout(1) program communicates that + # we ran out of time. + touch "$tmp.killstress" + fi +} + +# Run fsstress and record outcome +__run_fsstress() { + $FSSTRESS_PROG $* >> $seqres.full + echo "fsstress $* exits with $? at $(date)" >> $seqres.full +} + # Run fsstress while we're testing online fsck. __stress_scrub_fsstress_loop() { local end="$1" local runningfile="$2" local remount_period="$3" local stress_tgt="$4" - local focus=() + local focus=(-p 4 -n 2000000) + local scale_args=() + local has_rt + + test $FSTYP = "xfs" && _xfs_has_feature "$SCRATCH_MNT" realtime && \ + has_rt=1 case "$stress_tgt" in "parent") @@ -1096,28 +1120,35 @@ __stress_scrub_fsstress_loop() { # As of March 2022, 2 million fsstress ops should be enough to keep # any filesystem busy for a couple of hours. - local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}" $FSSTRESS_AVOID) - echo "Running $FSSTRESS_PROG $args" >> $seqres.full + local args + if [ -n "$has_rt" ]; then + mkdir -p $SCRATCH_MNT/rt $SCRATCH_MNT/data + $XFS_IO_PROG -c 'chattr +rt' $SCRATCH_MNT/rt + $XFS_IO_PROG -c 'chattr -rt' $SCRATCH_MNT/data + + rt_args=$(_scale_fsstress_args -d $SCRATCH_MNT/rt "${focus[@]}" $FSSTRESS_AVOID) + args=$(_scale_fsstress_args -d $SCRATCH_MNT/data "${focus[@]}" $FSSTRESS_AVOID) + echo "Running $FSSTRESS_PROG $args" >> $seqres.full + echo "Running $FSSTRESS_PROG $rt_args" >> $seqres.full + else + args=$(_scale_fsstress_args -d $SCRATCH_MNT "${focus[@]}" $FSSTRESS_AVOID) + echo "Running $FSSTRESS_PROG $args" >> $seqres.full + fi if [ -n "$remount_period" ]; then local mode="rw" local rw_arg="" + + rm -f "$tmp.killstress" while __stress_scrub_running "$end" "$runningfile"; do # Need to recheck running conditions if we cleared # anything. test "$mode" = "rw" && __stress_scrub_clean_scratch && continue - timeout -s TERM "$remount_period" $FSSTRESS_PROG \ - $args $rw_arg >> $seqres.full - res=$? - echo "$mode fsstress exits with $res at $(date)" >> $seqres.full - if [ "$res" -ne 0 ] && [ "$res" -ne 124 ]; then - # Stop if fsstress returns error. Mask off - # the magic code 124 because that is how the - # timeout(1) program communicates that we ran - # out of time. - break; - fi + __run_timed_fsstress $args $rw_arg & + test -n "$has_rt" && __run_timed_fsstress $rt_args $rw_arg & + wait + test -e "$tmp.killstress" && break if [ "$mode" = "rw" ]; then mode="ro" rw_arg="-R" @@ -1132,15 +1163,16 @@ __stress_scrub_fsstress_loop() { sleep 0.2 done done - rm -f "$runningfile" + rm -f "$runningfile" "$tmp.killstress" return 0 fi while __stress_scrub_running "$end" "$runningfile"; do # Need to recheck running conditions if we cleared anything __stress_scrub_clean_scratch && continue - $FSSTRESS_PROG $args >> $seqres.full - echo "fsstress exits with $? at $(date)" >> $seqres.full + __run_fsstress $args & + test -n "$has_rt" && __run_fsstress $rt_args & + wait done rm -f "$runningfile" } ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 04/16] common/ext4: reformat external logs during mdrestore operations 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (2 preceding siblings ...) 2024-10-11 1:41 ` [PATCH 03/16] fuzzy: stress data and rt sections of xfs filesystems equally Darrick J. Wong @ 2024-10-11 1:42 ` Darrick J. Wong 2024-10-11 1:42 ` [PATCH 05/16] common/populate: use metadump v2 format by default for fs metadata snapshots Darrick J. Wong ` (11 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:42 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> The e2image file format doesn't support the capture of external log devices, which means that mdrestore ought to reformat the external log to get the restored filesystem to work again. The common/populate code could already do this, so push it to the common ext4 helper. While we're at it, fix the uncareful usage of SCRATCH_LOGDEV in the populate code. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/ext4 | 17 ++++++++++++++++- common/populate | 18 +++++------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/common/ext4 b/common/ext4 index 13921bb8165a4d..e1b336d3d20cba 100644 --- a/common/ext4 +++ b/common/ext4 @@ -134,7 +134,8 @@ _ext4_mdrestore() { local metadump="$1" local device="$2" - shift; shift + local logdev="$3" + shift; shift; shift local options="$@" # If we're configured for compressed dumps and there isn't already an @@ -148,6 +149,20 @@ _ext4_mdrestore() test -r "$metadump" || return 1 $E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}" + res=$? + test $res -ne 0 && return $res + + # ext4 cannot e2image external logs, so we have to reformat the log + # device to match the restored fs + if [ "${logdev}" != "none" ]; then + local fsuuid="$($DUMPE2FS_PROG -h "${SCRATCH_DEV}" 2>/dev/null | \ + grep 'Journal UUID:' | \ + sed -e 's/Journal UUID:[[:space:]]*//g')" + $MKFS_EXT4_PROG -O journal_dev "${logdev}" \ + -F -U "${fsuuid}" + res=$? + fi + return $res } # this test requires the ext4 kernel support crc feature on scratch device diff --git a/common/populate b/common/populate index 94ee7af9ba1c95..ed3ee85ee2b6db 100644 --- a/common/populate +++ b/common/populate @@ -1021,20 +1021,12 @@ _scratch_populate_restore_cached() { return $? ;; "ext2"|"ext3"|"ext4") - _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" - ret=$? - test $ret -ne 0 && return $ret + local logdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + logdev=$SCRATCH_LOGDEV - # ext4 cannot e2image external logs, so we have to reformat - # the scratch device to match the restored fs - if [ -n "${SCRATCH_LOGDEV}" ]; then - local fsuuid="$($DUMPE2FS_PROG -h "${SCRATCH_DEV}" 2>/dev/null | \ - grep 'Journal UUID:' | \ - sed -e 's/Journal UUID:[[:space:]]*//g')" - $MKFS_EXT4_PROG -O journal_dev "${SCRATCH_LOGDEV}" \ - -F -U "${fsuuid}" - fi - return 0 + _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}" + return $? ;; esac return 1 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 05/16] common/populate: use metadump v2 format by default for fs metadata snapshots 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (3 preceding siblings ...) 2024-10-11 1:42 ` [PATCH 04/16] common/ext4: reformat external logs during mdrestore operations Darrick J. Wong @ 2024-10-11 1:42 ` Darrick J. Wong 2024-10-11 1:42 ` [PATCH 06/16] xfs/122: update for rtgroups Darrick J. Wong ` (10 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:42 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> When we're snapshotting filesystem metadata after creating a populated filesystem, force the creation of metadump v2 files by default to exercise the new format, since xfs_metadump continues to use the v1 format unless told otherwise. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/populate | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/populate b/common/populate index ed3ee85ee2b6db..b9d4b0fad5999c 100644 --- a/common/populate +++ b/common/populate @@ -55,7 +55,12 @@ __populate_fail() { case "$FSTYP" in xfs) _scratch_unmount - _scratch_xfs_metadump "$metadump" -a -o + + mdargs=('-a' '-o') + test "$(_xfs_metadump_max_version)" -gt 1 && \ + mdargs+=('-v' '2') + + _scratch_xfs_metadump "$metadump" "${mdargs[@]}" ;; ext4) _scratch_unmount @@ -1043,8 +1048,12 @@ _scratch_populate_save_metadump() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV + mdargs=('-a' '-o') + test "$(_xfs_metadump_max_version)" -gt 1 && \ + mdargs+=('-v' '2') + _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ - compress -a -o + compress "${mdargs[@]}" res=$? ;; "ext2"|"ext3"|"ext4") ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 06/16] xfs/122: update for rtgroups 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (4 preceding siblings ...) 2024-10-11 1:42 ` [PATCH 05/16] common/populate: use metadump v2 format by default for fs metadata snapshots Darrick J. Wong @ 2024-10-11 1:42 ` Darrick J. Wong 2024-10-11 1:42 ` [PATCH 07/16] punch-alternating: detect xfs realtime files with large allocation units Darrick J. Wong ` (9 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:42 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Add our new metadata for realtime allocation groups to the ondisk checking. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/122.out | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index f47904bc75e6de..ff501d027612ee 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -45,6 +45,9 @@ offsetof(xfs_sb_t, sb_rbmino) = 64 offsetof(xfs_sb_t, sb_rextents) = 24 offsetof(xfs_sb_t, sb_rextsize) = 80 offsetof(xfs_sb_t, sb_rextslog) = 125 +offsetof(xfs_sb_t, sb_rgblklog) = 280 +offsetof(xfs_sb_t, sb_rgcount) = 272 +offsetof(xfs_sb_t, sb_rgextents) = 276 offsetof(xfs_sb_t, sb_rootino) = 56 offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 @@ -93,7 +96,7 @@ sizeof(struct xfs_dir3_leaf) = 64 sizeof(struct xfs_dir3_leaf_hdr) = 64 sizeof(struct xfs_disk_dquot) = 104 sizeof(struct xfs_dqblk) = 136 -sizeof(struct xfs_dsb) = 272 +sizeof(struct xfs_dsb) = 280 sizeof(struct xfs_dsymlink_hdr) = 56 sizeof(struct xfs_exchange_range) = 40 sizeof(struct xfs_extent_data) = 24 @@ -121,9 +124,11 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtgroup_geometry) = 128 sizeof(struct xfs_rtrmap_key) = 24 sizeof(struct xfs_rtrmap_rec) = 32 sizeof(struct xfs_rtrmap_root) = 4 +sizeof(struct xfs_rtsb) = 56 sizeof(struct xfs_rud_log_format) = 16 sizeof(struct xfs_rui_log_format) = 16 sizeof(struct xfs_scrub_metadata) = 64 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 07/16] punch-alternating: detect xfs realtime files with large allocation units 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (5 preceding siblings ...) 2024-10-11 1:42 ` [PATCH 06/16] xfs/122: update for rtgroups Darrick J. Wong @ 2024-10-11 1:42 ` Darrick J. Wong 2024-10-11 1:43 ` [PATCH 08/16] xfs/206: update mkfs filtering for rt groups feature Darrick J. Wong ` (8 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:42 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> For files on the XFS realtime volume, it's possible that the file allocation unit (aka the minimum size we have to punch to deallocate file blocks) could be greater than a single fs block. This utility assumed that it's always possible to punch a single fs block, but for these types of files, all that does is zeroes the page cache. While that's what most *user applications* want, fstests uses punching to fragment file mapping metadata and/or fragment free space, so adapt this test for that purpose by detecting realtime files. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- src/punch-alternating.c | 28 +++++++++++++++++++++++++++- tests/xfs/114 | 4 ++++ tests/xfs/146 | 2 +- tests/xfs/187 | 3 ++- tests/xfs/341 | 4 ++-- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/punch-alternating.c b/src/punch-alternating.c index 18dd215197db2b..d2bb4b6a2276c9 100644 --- a/src/punch-alternating.c +++ b/src/punch-alternating.c @@ -20,6 +20,28 @@ void usage(char *cmd) exit(1); } +/* Compute the file allocation unit size for an XFS file. */ +static int detect_xfs_alloc_unit(int fd) +{ + struct fsxattr fsx; + struct xfs_fsop_geom fsgeom; + int ret; + + ret = ioctl(fd, XFS_IOC_FSGEOMETRY, &fsgeom); + if (ret) + return -1; + + ret = ioctl(fd, XFS_IOC_FSGETXATTR, &fsx); + if (ret) + return -1; + + ret = fsgeom.blocksize; + if (fsx.fsx_xflags & XFS_XFLAG_REALTIME) + ret *= fsgeom.rtextsize; + + return ret; +} + int main(int argc, char *argv[]) { struct stat s; @@ -82,7 +104,11 @@ int main(int argc, char *argv[]) goto err; sz = s.st_size; - blksz = sf.f_bsize; + c = detect_xfs_alloc_unit(fd); + if (c > 0) + blksz = c; + else + blksz = sf.f_bsize; mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE; for (offset = start_offset * blksz; diff --git a/tests/xfs/114 b/tests/xfs/114 index 510d31a4028598..f764cad73babb7 100755 --- a/tests/xfs/114 +++ b/tests/xfs/114 @@ -47,6 +47,10 @@ $XFS_IO_PROG -f \ -c "pwrite -S 0x68 -b 1048576 0 $len2" \ $SCRATCH_MNT/f2 >> $seqres.full +# The arguments to punch-alternating must be specified in units of file +# allocation units, so we divide the argument by $file_blksz. We already +# verified that $blksz is congruent with $file_blksz, so the fpunch parameters +# will always align with the file allocation unit. $here/src/punch-alternating -o $((16 * blksz / file_blksz)) \ -s $((blksz / file_blksz)) \ -i $((blksz * 2 / file_blksz)) \ diff --git a/tests/xfs/146 b/tests/xfs/146 index b6f4c2bd093d45..1cd7076d2426ee 100755 --- a/tests/xfs/146 +++ b/tests/xfs/146 @@ -67,7 +67,7 @@ _xfs_force_bdev realtime $SCRATCH_MNT # Allocate some stuff at the start, to force the first falloc of the ouch file # to happen somewhere in the middle of the rt volume $XFS_IO_PROG -f -c 'falloc 0 64m' "$SCRATCH_MNT/b" -$here/src/punch-alternating -i $((rextblks * 2)) -s $((rextblks)) "$SCRATCH_MNT/b" +$here/src/punch-alternating "$SCRATCH_MNT/b" avail="$(df -P "$SCRATCH_MNT" | awk 'END {print $4}')"1 toobig="$((avail * 2))" diff --git a/tests/xfs/187 b/tests/xfs/187 index 56a9adc164eab2..1d32d702f629c9 100755 --- a/tests/xfs/187 +++ b/tests/xfs/187 @@ -130,7 +130,8 @@ $XFS_IO_PROG -f -c "truncate $required_sz" -c "falloc 0 $remap_sz" $SCRATCH_MNT/ # Punch out every other extent of the last two sections, to fragment free space. frag_sz=$((remap_sz * 3)) punch_off=$((bigfile_sz - frag_sz)) -$here/src/punch-alternating $SCRATCH_MNT/bigfile -o $((punch_off / fsbsize)) -i $((rtextsize_blks * 2)) -s $rtextsize_blks +rtextsize_bytes=$((fsbsize * rtextsize_blks)) +$here/src/punch-alternating $SCRATCH_MNT/bigfile -o $((punch_off / rtextsize_bytes)) # Make sure we have some free rtextents. free_rtx=$(_xfs_statfs_field "$SCRATCH_MNT" statfs.f_bavail) diff --git a/tests/xfs/341 b/tests/xfs/341 index 6e25549b2b3d08..9b12febf8d5c49 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -41,8 +41,8 @@ len=$((blocks * rtextsz)) echo "Create some files" $XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f1 >> $seqres.full $XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCRATCH_MNT/f2 >> $seqres.full -$here/src/punch-alternating -i $((2 * rtextsz_blks)) -s $rtextsz_blks $SCRATCH_MNT/f1 >> "$seqres.full" -$here/src/punch-alternating -i $((2 * rtextsz_blks)) -s $rtextsz_blks $SCRATCH_MNT/f2 >> "$seqres.full" +$here/src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" +$here/src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" echo garbage > $SCRATCH_MNT/f3 ino=$(stat -c '%i' $SCRATCH_MNT/f3) _scratch_unmount ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 08/16] xfs/206: update mkfs filtering for rt groups feature 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (6 preceding siblings ...) 2024-10-11 1:42 ` [PATCH 07/16] punch-alternating: detect xfs realtime files with large allocation units Darrick J. Wong @ 2024-10-11 1:43 ` Darrick J. Wong 2024-10-11 1:43 ` [PATCH 09/16] common: pass the realtime device to xfs_db when possible Darrick J. Wong ` (7 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:43 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Filter out the new mkfs lines that show the rtgroup information, since this test is heavily dependent on old mkfs output. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/206 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/206 b/tests/xfs/206 index ef5f4868e9bdca..01531e1f08c37e 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -65,6 +65,7 @@ mkfs_filter() -e "/exchange=/d" \ -e '/metadir=.*/d' \ -e 's/, parent=[01]//' \ + -e '/rgcount=/d' \ -e "/^Default configuration/d" } ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 09/16] common: pass the realtime device to xfs_db when possible 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (7 preceding siblings ...) 2024-10-11 1:43 ` [PATCH 08/16] xfs/206: update mkfs filtering for rt groups feature Darrick J. Wong @ 2024-10-11 1:43 ` Darrick J. Wong 2024-10-11 1:43 ` [PATCH 10/16] xfs/185: update for rtgroups Darrick J. Wong ` (6 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:43 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Teach xfstests to pass the realtime device to xfs_db when it supports that option. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/xfs b/common/xfs index 39cb04ff2cddcd..ffa5f3fa6d0d7b 100644 --- a/common/xfs +++ b/common/xfs @@ -303,6 +303,10 @@ _scratch_xfs_db_options() SCRATCH_OPTIONS="" [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV" + if [ "$USE_EXTERNAL" = yes ] && [ ! -z "$SCRATCH_RTDEV" ]; then + $XFS_DB_PROG --help 2>&1 | grep -q -- '-R rtdev' && \ + SCRATCH_OPTIONS="$SCRATCH_OPTIONS -R$SCRATCH_RTDEV" + fi echo $SCRATCH_OPTIONS $* $SCRATCH_DEV } ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 10/16] xfs/185: update for rtgroups 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (8 preceding siblings ...) 2024-10-11 1:43 ` [PATCH 09/16] common: pass the realtime device to xfs_db when possible Darrick J. Wong @ 2024-10-11 1:43 ` Darrick J. Wong 2024-10-11 1:43 ` [PATCH 11/16] xfs/449: update test to know about xfs_db -R Darrick J. Wong ` (5 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:43 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> This old test is a bit too fixated on exact rt allocator behavior. With rtgroups enabled, we can end up with one large contiguous region that's split into multiple bmbt mappings to avoid crossing rtgroup boundaries. The realtime superblock throws another twist into the mix because the first rtx will always be in use, which can shift the start of the physical space mappings by up to 1 rtx. Also fix a bug where we'd try to fallocate the total number of rtx, whereas we should be asking for the number of free rtx to avoid ENOSPC errors. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/185 | 65 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/tests/xfs/185 b/tests/xfs/185 index b14bcb9b791bb8..e48b1851f524b0 100755 --- a/tests/xfs/185 +++ b/tests/xfs/185 @@ -97,10 +97,17 @@ test "$ddbytes" -lt "$((rtbytes + (10 * rtextsize) ))" || \ # higher than the size of the data device. For realtime files this is really # easy because fallocate for the first rt file always starts allocating at # physical offset zero. -alloc_rtx="$((rtbytes / rtextsize))" +rtfreebytes="$(stat -f -c '%S * %a' $rtfile | bc)" +alloc_rtx="$((rtfreebytes / rtextsize))" $XFS_IO_PROG -c "falloc 0 $((alloc_rtx * rtextsize))" $rtfile -expected_end="$(( (alloc_rtx * rtextsize - 1) / 512 ))" +# log a bunch of geometry data to the full file for debugging +echo "rtbytes $rtbytes rtfreebytes $rtfreebytes rtextsize $rtextsize" >> $seqres.full +echo "allocrtx $alloc_rtx falloc $((alloc_rtx * rtextsize))" >> $seqres.full +$XFS_IO_PROG -c statfs $SCRATCH_MNT >> $seqres.full + +total_rtx=$(_xfs_statfs_field $SCRATCH_MNT geom.rtextents) +expected_end="$(( (total_rtx * rtextsize - 1) / 512 ))" # Print extent mapping of rtfile in format: # file_offset file_end physical_offset physical_end @@ -113,13 +120,28 @@ rtfile_exts() { done } -# Make sure that we actually got the entire device. -rtfile_exts | $AWK_PROG -v end=$expected_end ' +# Make sure that fallocate actually managed to map the entire rt device. The +# realtime superblock may consume the first rtx, so we allow for that here. +# Allow for multiple contiguous mappings if the rtgroups are very small. +allowed_start=$((rtextsize / 512)) +rtfile_exts | $AWK_PROG -v exp_start=$allowed_start -v exp_end=$expected_end ' +BEGIN { + start = -1; + end = -1; +} { - if ($3 != 0) - printf("%s: unexpected physical offset %s, wanted 0\n", $0, $3); - if ($4 != end) - printf("%s: unexpected physical end %s, wanted %d\n", $0, $4, end); + if (end >= 0 && ($3 != end + 1)) + printf("%s: non-contiguous allocation should have started at %s\n", $0, end + 1); + if (start < 0 || $3 < start) + start = $3; + if (end < 0 || $4 > end) + end = $4; +} +END { + if (start > exp_start) + printf("%s: unexpected physical offset %d, wanted <= %d\n", $0, start, exp_start); + if (end != exp_end) + printf("%s: unexpected physical end %d, wanted %d\n", $0, end, exp_end); }' # Now punch out a range that is slightly larger than the size of the data @@ -132,14 +154,27 @@ expected_offset="$((punch_rtx * rtextsize / 512))" echo "rtfile should have physical extent from $expected_offset to $expected_end sectors" >> $seqres.full -# Make sure that the realtime file now has only one extent at the end of the -# realtime device -rtfile_exts | $AWK_PROG -v offset=$expected_offset -v end=$expected_end ' +# Make sure that the realtime file now maps one large extent at the end of the +# realtime device. Due to rtgroups boundary rules, there may be multiple +# contiguous mappings. +rtfile_exts | $AWK_PROG -v exp_start=$expected_offset -v exp_end=$expected_end ' +BEGIN { + start = -1; + end = -1; +} { - if ($3 != offset) - printf("%s: unexpected physical offset %s, wanted %d\n", $0, $3, offset); - if ($4 != end) - printf("%s: unexpected physical end %s, wanted %d\n", $0, $4, end); + if (end >= 0 && ($3 != end + 1)) + printf("%s: non-contiguous allocation should have started at %s\n", $0, end + 1); + if (start < 0 || $3 < start) + start = $3; + if (end < 0 || $4 > end) + end = $4; +} +END { + if (start < exp_start) + printf("%s: unexpected physical offset %d, wanted >= %d\n", $0, start, exp_start); + if (end != exp_end) + printf("%s: unexpected physical end %d, wanted %d\n", $0, end, exp_end); }' $XFS_IO_PROG -c 'bmap -elpv' $rtfile >> $seqres.full ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 11/16] xfs/449: update test to know about xfs_db -R 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (9 preceding siblings ...) 2024-10-11 1:43 ` [PATCH 10/16] xfs/185: update for rtgroups Darrick J. Wong @ 2024-10-11 1:43 ` Darrick J. Wong 2024-10-11 1:44 ` [PATCH 12/16] xfs/122: update for rtbitmap headers Darrick J. Wong ` (4 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:43 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> The realtime groups feature added a -R flag to xfs_db so that users can pass in the realtime device. Since we've now modified the _scratch_xfs_db to use this facility, we can update the test to do exact comparisons of the xfs_db info command against the mkfs output. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/449 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/xfs/449 b/tests/xfs/449 index 3d528e03a483fb..a739df50e319c5 100755 --- a/tests/xfs/449 +++ b/tests/xfs/449 @@ -30,7 +30,11 @@ echo DB >> $seqres.full cat $tmp.dbinfo >> $seqres.full # xfs_db doesn't take a rtdev argument, so it reports "realtime=external". # mkfs does, so make a quick substitution -diff -u <(cat $tmp.mkfs | sed -e 's/realtime =\/.*extsz=/realtime =external extsz=/g') $tmp.dbinfo +if $XFS_DB_PROG --help 2>&1 | grep -q -- '-R rtdev'; then + diff -u $tmp.mkfs $tmp.dbinfo +else + diff -u <(cat $tmp.mkfs | sed -e 's/realtime =\/.*extsz=/realtime =external extsz=/g') $tmp.dbinfo +fi _scratch_mount ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 12/16] xfs/122: update for rtbitmap headers 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (10 preceding siblings ...) 2024-10-11 1:43 ` [PATCH 11/16] xfs/449: update test to know about xfs_db -R Darrick J. Wong @ 2024-10-11 1:44 ` Darrick J. Wong 2024-10-11 1:44 ` [PATCH 13/16] xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands Darrick J. Wong ` (3 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:44 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/122.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index ff501d027612ee..18aff98f96ac46 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -124,6 +124,7 @@ sizeof(struct xfs_refcount_key) = 4 sizeof(struct xfs_refcount_rec) = 12 sizeof(struct xfs_rmap_key) = 20 sizeof(struct xfs_rmap_rec) = 24 +sizeof(struct xfs_rtbuf_blkinfo) = 48 sizeof(struct xfs_rtgroup_geometry) = 128 sizeof(struct xfs_rtrmap_key) = 24 sizeof(struct xfs_rtrmap_rec) = 32 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 13/16] xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (11 preceding siblings ...) 2024-10-11 1:44 ` [PATCH 12/16] xfs/122: update for rtbitmap headers Darrick J. Wong @ 2024-10-11 1:44 ` Darrick J. Wong 2024-10-11 1:44 ` [PATCH 14/16] common/xfs: capture realtime devices during metadump/mdrestore Darrick J. Wong ` (2 subsequent siblings) 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:44 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Fix these tests to deal with the xfs_io bmap and fsmap commands printing out realtime group numbers if the feature is enabled. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 7 +++++++ tests/xfs/271 | 4 +++- tests/xfs/556 | 16 ++++++++++------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/common/xfs b/common/xfs index ffa5f3fa6d0d7b..f73cd467a2e7c5 100644 --- a/common/xfs +++ b/common/xfs @@ -414,6 +414,13 @@ _xfs_has_feature() feat="rtextents" feat_regex="[1-9][0-9]*" ;; + "rtgroups") + # any fs with rtgroups enabled will have a nonzero rt group + # size, even if there is no rt device (and hence zero actual + # groups) + feat="rgsize" + feat_regex="[1-9][0-9]*" + ;; esac local answer="$($XFS_INFO_PROG "$fs" 2>&1 | grep -E -w -c "$feat=$feat_regex")" diff --git a/tests/xfs/271 b/tests/xfs/271 index 420f4e7479220a..8a71746d6eaede 100755 --- a/tests/xfs/271 +++ b/tests/xfs/271 @@ -29,6 +29,8 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount agcount=$(_xfs_mount_agcount $SCRATCH_MNT) +agcount_wiggle=0 +_xfs_has_feature $SCRATCH_MNT rtgroups && agcount_wiggle=1 # mkfs lays out btree root blocks in the order bnobt, cntbt, inobt, finobt, # rmapbt, refcountbt, and then allocates AGFL blocks. Since GETFSMAP has the @@ -46,7 +48,7 @@ cat $TEST_DIR/fsmap >> $seqres.full echo "Check AG header" | tee -a $seqres.full grep 'static fs metadata[[:space:]]*[0-9]*[[:space:]]*(0\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout -_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount 0 -v +_within_tolerance "AG header count" $(wc -l < $TEST_DIR/testout) $agcount $agcount_wiggle -v echo "Check freesp/rmap btrees" | tee -a $seqres.full grep 'per-AG metadata[[:space:]]*[0-9]*[[:space:]]*([0-9]*\.\.' $TEST_DIR/fsmap | tee -a $seqres.full > $TEST_DIR/testout diff --git a/tests/xfs/556 b/tests/xfs/556 index 79e03caf40a0a5..83d5022e700c8b 100755 --- a/tests/xfs/556 +++ b/tests/xfs/556 @@ -45,16 +45,20 @@ victim=$SCRATCH_MNT/a file_blksz=$(_get_file_block_size $SCRATCH_MNT) $XFS_IO_PROG -f -c "pwrite -S 0x58 0 $((4 * file_blksz))" -c "fsync" $victim >> $seqres.full unset errordev -_xfs_is_realtime_file $victim && errordev="RT" + +awk_len_prog='{print $6}' +if _xfs_is_realtime_file $victim; then + if ! _xfs_has_feature $SCRATCH_MNT rtgroups; then + awk_len_prog='{print $4}' + fi + errordev="RT" +fi bmap_str="$($XFS_IO_PROG -c "bmap -elpv" $victim | grep "^[[:space:]]*0:")" echo "$errordev:$bmap_str" >> $seqres.full phys="$(echo "$bmap_str" | $AWK_PROG '{print $3}')" -if [ "$errordev" = "RT" ]; then - len="$(echo "$bmap_str" | $AWK_PROG '{print $4}')" -else - len="$(echo "$bmap_str" | $AWK_PROG '{print $6}')" -fi +len="$(echo "$bmap_str" | $AWK_PROG "$awk_len_prog")" + fs_blksz=$(_get_block_size $SCRATCH_MNT) echo "file_blksz:$file_blksz:fs_blksz:$fs_blksz" >> $seqres.full kernel_sectors_per_fs_block=$((fs_blksz / 512)) ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 14/16] common/xfs: capture realtime devices during metadump/mdrestore 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (12 preceding siblings ...) 2024-10-11 1:44 ` [PATCH 13/16] xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands Darrick J. Wong @ 2024-10-11 1:44 ` Darrick J. Wong 2024-10-11 1:44 ` [PATCH 15/16] common/fuzzy: adapt the scrub stress tests to support rtgroups Darrick J. Wong 2024-10-11 1:45 ` [PATCH 16/16] xfs: fix fuzz tests of rtgroups bitmap and summary files Darrick J. Wong 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:44 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> If xfs_metadump supports the -r switch to capture the contents of realtime devices and there is a realtime device, add the option to the command line to enable preservation. Similarly, if the dump file could restore to an external scratch rtdev, pass the -r option to mdrestore so that we can restore rtdev contents. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/metadump | 21 +++++++++++++++++---- common/populate | 6 +++++- common/xfs | 48 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/common/metadump b/common/metadump index 3373edfe92efd6..aebcb45875ddb3 100644 --- a/common/metadump +++ b/common/metadump @@ -107,6 +107,8 @@ _xfs_verify_metadump_v2() local data_loop local log_img="" local log_loop + local rt_img="" + local rt_loop # Capture metadump, which creates metadump_file _scratch_xfs_metadump $metadump_file $metadump_args $version @@ -117,8 +119,12 @@ _xfs_verify_metadump_v2() # from such a metadump file. test -n "$SCRATCH_LOGDEV" && log_img="$XFS_METADUMP_IMG.log" + # Use a temporary file to hold restored rt device contents + test -n "$SCRATCH_RTDEV" && _xfs_metadump_supports_rt && \ + rt_img="$XFS_METADUMP_IMG.rt" + # Restore metadump, which creates data_img and log_img - SCRATCH_DEV=$data_img SCRATCH_LOGDEV=$log_img \ + SCRATCH_DEV=$data_img SCRATCH_LOGDEV=$log_img SCRATCH_RTDEV=$rt_img \ _scratch_xfs_mdrestore $metadump_file # Create loopdev for data device so we can mount the fs @@ -127,15 +133,22 @@ _xfs_verify_metadump_v2() # Create loopdev for log device if we recovered anything test -s "$log_img" && log_loop=$(_create_loop_device $log_img) + # Create loopdev for rt device if we recovered anything + test -s "$rt_img" && rt_loop=$(_create_loop_device $rt_img) + # Mount fs, run an extra test, fsck, and unmount - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop _scratch_mount + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop _scratch_mount if [ -n "$extra_test" ]; then - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop $extra_test + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop $extra_test fi - SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop _check_xfs_scratch_fs + SCRATCH_DEV=$data_loop SCRATCH_LOGDEV=$log_loop SCRATCH_RTDEV=$rt_loop _check_xfs_scratch_fs SCRATCH_DEV=$data_loop _scratch_unmount # Tear down what we created + if [ -b "$rt_loop" ]; then + _destroy_loop_device $rt_loop + rm -f $rt_img + fi if [ -b "$log_loop" ]; then _destroy_loop_device $log_loop rm -f $log_img diff --git a/common/populate b/common/populate index b9d4b0fad5999c..a0dc48f14559bf 100644 --- a/common/populate +++ b/common/populate @@ -1048,12 +1048,16 @@ _scratch_populate_save_metadump() [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV + local rtdev=none + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + mdargs=('-a' '-o') test "$(_xfs_metadump_max_version)" -gt 1 && \ mdargs+=('-v' '2') _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \ - compress "${mdargs[@]}" + "$rtdev" compress "${mdargs[@]}" res=$? ;; "ext2"|"ext3"|"ext4") diff --git a/common/xfs b/common/xfs index f73cd467a2e7c5..09ce830ffdefbe 100644 --- a/common/xfs +++ b/common/xfs @@ -620,14 +620,19 @@ _xfs_metadump() { local metadump="$1" local device="$2" local logdev="$3" - local compressopt="$4" - shift; shift; shift; shift + local rtdev="$4" + local compressopt="$5" + shift; shift; shift; shift; shift local options="$@" if [ "$logdev" != "none" ]; then options="$options -l $logdev" fi + if [ "$rtdev" != "none" ] && _xfs_metadump_supports_rt; then + options="$options -r $rtdev" + fi + $XFS_METADUMP_PROG $options "$device" "$metadump" res=$? [ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] && @@ -651,7 +656,8 @@ _xfs_mdrestore() { local metadump="$1" local device="$2" local logdev="$3" - shift; shift; shift + local rtdev="$4" + shift; shift; shift; shift local options="$@" local dumpfile_ver @@ -679,6 +685,18 @@ _xfs_mdrestore() { options="$options -l $logdev" fi + if [ "$rtdev" != "none" ] && [[ $dumpfile_ver > 1 ]] && _xfs_metadump_supports_rt; then + # metadump and mdrestore capture and restore metadata on the + # realtime volume by turning on metadump v2 format. This is + # only done if the realtime volume contains metadata such as + # rtgroup superblocks. The -r option to mdrestore wasn't added + # until the creation of rtgroups. + # + # Hence it only makes sense to specify -r here if the dump file + # itself is in v2 format. + options="$options -r $rtdev" + fi + $XFS_MDRESTORE_PROG $options "${metadump}" "${device}" } @@ -692,17 +710,27 @@ _xfs_metadump_max_version() fi } +# Do xfs_metadump/mdrestore support the -r switch for realtime devices? +_xfs_metadump_supports_rt() +{ + $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-r rtdev' +} + # Snapshot the metadata on the scratch device _scratch_xfs_metadump() { local metadump=$1 shift local logdev=none + local rtdev=none [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ logdev=$SCRATCH_LOGDEV - _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" nocompress "$@" + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" nocompress "$@" } # Restore snapshotted metadata on the scratch device @@ -711,6 +739,7 @@ _scratch_xfs_mdrestore() local metadump=$1 shift local logdev=none + local rtdev=none local options="$@" # $SCRATCH_LOGDEV should have a non-zero length value only when all of @@ -721,7 +750,10 @@ _scratch_xfs_mdrestore() logdev=$SCRATCH_LOGDEV fi - _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$@" + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \ + rtdev=$SCRATCH_RTDEV + + _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" "$@" } # Do not use xfs_repair (offline fsck) to rebuild the filesystem @@ -842,7 +874,7 @@ _check_xfs_filesystem() if [ "$ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.check.md" "$device" "$logdev" \ - compress -a -o >> $seqres.full + "$rtdev" compress -a -o >> $seqres.full fi # Optionally test the index rebuilding behavior. @@ -875,7 +907,7 @@ _check_xfs_filesystem() if [ "$rebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.rebuild.md" "$device" \ - "$logdev" compress -a -o >> $seqres.full + "$logdev" "$rtdev" compress -a -o >> $seqres.full fi fi @@ -959,7 +991,7 @@ _check_xfs_filesystem() if [ "$orebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then local flatdev="$(basename "$device")" _xfs_metadump "$seqres.$flatdev.orebuild.md" "$device" \ - "$logdev" compress -a -o >> $seqres.full + "$logdev" "$rtdev" compress -a -o >> $seqres.full fi fi ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 15/16] common/fuzzy: adapt the scrub stress tests to support rtgroups 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (13 preceding siblings ...) 2024-10-11 1:44 ` [PATCH 14/16] common/xfs: capture realtime devices during metadump/mdrestore Darrick J. Wong @ 2024-10-11 1:44 ` Darrick J. Wong 2024-10-11 1:45 ` [PATCH 16/16] xfs: fix fuzz tests of rtgroups bitmap and summary files Darrick J. Wong 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:44 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Adapt the scrub stress testing framework to support checking realtime group metadata. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/fuzzy | 27 ++++++++++++++++++++++----- common/xfs | 9 +++++++++ tests/xfs/581 | 2 +- tests/xfs/720 | 2 +- tests/xfs/795 | 2 +- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index ceb547669b51cd..254426be6c8cf9 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -829,8 +829,10 @@ __stress_one_scrub_loop() { local scrub_tgt="$3" local scrub_startat="$4" local start_agno="$5" - shift; shift; shift; shift; shift + local start_rgno="$6" + shift; shift; shift; shift; shift; shift local agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" + local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)" local xfs_io_args=() for arg in "$@"; do @@ -843,6 +845,12 @@ __stress_one_scrub_loop() { local ag_arg="$(echo "$arg" | sed -e "s|%agno%|$agno|g")" xfs_io_args+=('-c' "$ag_arg") done + elif echo "$arg" | grep -q -w '%rgno%'; then + # Substitute the rtgroup number + for ((rgno = start_rgno; rgno < rgcount; rgno++)); do + local rg_arg="$(echo "$arg" | sed -e "s|%rgno%|$rgno|g")" + xfs_io_args+=('-c' "$rg_arg") + done else xfs_io_args+=('-c' "$arg") fi @@ -1259,7 +1267,9 @@ _scratch_xfs_stress_scrub_cleanup() { __stress_scrub_check_commands() { local scrub_tgt="$1" local start_agno="$2" - shift; shift + local start_rgno="$3" + shift; shift; shift + local rgcount="$(_xfs_mount_rgcount $SCRATCH_MNT)" local cooked_tgt="$scrub_tgt" case "$scrub_tgt" in @@ -1289,6 +1299,10 @@ __stress_scrub_check_commands() { cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" fi cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/$start_agno/g")" + if echo "$cooked_arg" | grep -q -w '%rgno%'; then + test "$rgcount" -eq 0 && continue + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%rgno%/$start_rgno/g")" + fi testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1` echo $testio | grep -q "Unknown type" && \ _notrun "xfs_io scrub subcommand support is missing" @@ -1314,6 +1328,7 @@ __stress_scrub_check_commands() { # in a separate loop. If zero -i options are specified, do not run. # Callers must check each of these commands (via _require_xfs_io_command) # before calling here. +# -R For %rgno% substitution, start with this rtgroup instead of rtgroup 0. # -r Run fsstress for this amount of time, then remount the fs ro or rw. # The default is to run fsstress continuously with no remount, unless # XFS_SCRUB_STRESS_REMOUNT_PERIOD is set. @@ -1360,6 +1375,7 @@ _scratch_xfs_stress_scrub() { local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}" local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}" local start_agno=0 + local start_rgno=0 __SCRUB_STRESS_FREEZE_PID="" __SCRUB_STRESS_REMOUNT_LOOP="" @@ -1367,12 +1383,13 @@ _scratch_xfs_stress_scrub() { touch "$runningfile" OPTIND=1 - while getopts "a:fi:r:s:S:t:w:x:X:" c; do + while getopts "a:fi:r:R:s:S:t:w:x:X:" c; do case "$c" in a) start_agno="$OPTARG";; f) freeze=yes;; i) io_args+=("$OPTARG");; r) remount_period="$OPTARG";; + R) start_rgno="$OPTARG";; s) one_scrub_args+=("$OPTARG");; S) xfs_scrub_args+=("$OPTARG");; t) scrub_tgt="$OPTARG";; @@ -1383,7 +1400,7 @@ _scratch_xfs_stress_scrub() { esac done - __stress_scrub_check_commands "$scrub_tgt" "$start_agno" \ + __stress_scrub_check_commands "$scrub_tgt" "$start_agno" "$start_rgno" \ "${one_scrub_args[@]}" if ! command -v "__stress_scrub_${exerciser}_loop" &>/dev/null; then @@ -1439,7 +1456,7 @@ _scratch_xfs_stress_scrub() { if [ "${#one_scrub_args[@]}" -gt 0 ]; then __stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \ - "$scrub_startat" "$start_agno" \ + "$scrub_startat" "$start_agno" "$start_rgno" \ "${one_scrub_args[@]}" & fi diff --git a/common/xfs b/common/xfs index 09ce830ffdefbe..9036fdb363904e 100644 --- a/common/xfs +++ b/common/xfs @@ -1475,6 +1475,15 @@ _xfs_mount_agcount() $XFS_INFO_PROG "$1" | sed -n "s/^.*agcount=\([[:digit:]]*\).*/\1/p" } +# Find rtgroup count of mounted filesystem +_xfs_mount_rgcount() +{ + local rtgroups="$($XFS_INFO_PROG "$1" | grep rgcount= | sed -e 's/^.*rgcount=\([0-9]*\).*$/\1/g')" + + test -z "$rtgroups" && rtgroups=0 + echo "$rtgroups" +} + # Wipe the superblock of each XFS AGs _try_wipe_scratch_xfs() { diff --git a/tests/xfs/581 b/tests/xfs/581 index 73b51f994a3f00..3af9ef8a19c0bb 100755 --- a/tests/xfs/581 +++ b/tests/xfs/581 @@ -30,7 +30,7 @@ _require_xfs_stress_scrub _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime -_scratch_xfs_stress_scrub -s "scrub rtbitmap" +_scratch_xfs_stress_scrub -s "scrub rtbitmap" -s "scrub rgbitmap %rgno%" # success, all done echo Silence is golden diff --git a/tests/xfs/720 b/tests/xfs/720 index f928cc43d3bc54..e4af2a8d5470d2 100755 --- a/tests/xfs/720 +++ b/tests/xfs/720 @@ -37,7 +37,7 @@ alloc_unit=$(_get_file_block_size $SCRATCH_MNT) scratchfile=$SCRATCH_MNT/file touch $scratchfile $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT -__stress_scrub_check_commands "$scratchfile" "" 'repair bmapbtd' +__stress_scrub_check_commands "$scratchfile" "" "" 'repair bmapbtd' # Compute the number of extent records needed to guarantee btree format, # assuming 16 bytes for each ondisk extent record diff --git a/tests/xfs/795 b/tests/xfs/795 index 5a67f02ec92eca..cd1d288add212f 100755 --- a/tests/xfs/795 +++ b/tests/xfs/795 @@ -37,7 +37,7 @@ scratchfile=$SCRATCH_MNT/file mkdir $scratchdir touch $scratchfile $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT -__stress_scrub_check_commands "$scratchdir" "" 'repair directory' +__stress_scrub_check_commands "$scratchdir" "" "" 'repair directory' # Create a 2-dirblock directory total_size=$((alloc_unit * 2)) ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 16/16] xfs: fix fuzz tests of rtgroups bitmap and summary files 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong ` (14 preceding siblings ...) 2024-10-11 1:44 ` [PATCH 15/16] common/fuzzy: adapt the scrub stress tests to support rtgroups Darrick J. Wong @ 2024-10-11 1:45 ` Darrick J. Wong 15 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:45 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> With rtgroups, the rt bitmap and summary files are now per-group, so adjust the fuzz and fsck tests to find the new locations. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 19 +++++++++++++++++++ tests/xfs/581 | 9 ++++++++- tests/xfs/582 | 14 +++++++------- tests/xfs/739 | 6 +++++- tests/xfs/740 | 6 +++++- tests/xfs/741 | 6 +++++- tests/xfs/742 | 6 +++++- tests/xfs/743 | 6 +++++- tests/xfs/744 | 6 +++++- tests/xfs/745 | 6 +++++- tests/xfs/746 | 6 +++++- tests/xfs/793 | 14 +++++++------- 12 files changed, 81 insertions(+), 23 deletions(-) diff --git a/common/xfs b/common/xfs index 9036fdb363904e..6bd411cad67f5f 100644 --- a/common/xfs +++ b/common/xfs @@ -1932,6 +1932,25 @@ _scratch_xfs_find_metafile() local metafile="$1" local sb_field + # With metadir=1, the realtime volume is sharded into allocation + # groups. Each rtgroup has its own bitmap and summary file. Tests + # should pick a particular file, but this compatibility shim still + # exists to keep old tests working. + case "$metafile" in + "rbmino") + if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + echo "path -m /rtgroups/0.bitmap" + return 0 + fi + ;; + "rsumino") + if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + echo "path -m /rtgroups/0.summary" + return 0 + fi + ;; + esac + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" if echo "$sb_field" | grep -q -w 'not found'; then return 1 diff --git a/tests/xfs/581 b/tests/xfs/581 index 3af9ef8a19c0bb..1bac2d5b6739a0 100755 --- a/tests/xfs/581 +++ b/tests/xfs/581 @@ -30,7 +30,14 @@ _require_xfs_stress_scrub _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime -_scratch_xfs_stress_scrub -s "scrub rtbitmap" -s "scrub rgbitmap %rgno%" + +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_scrub -s "scrub rtbitmap %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_scrub -s "scrub rtbitmap 0" +else + _scratch_xfs_stress_scrub -s "scrub rtbitmap" +fi # success, all done echo Silence is golden diff --git a/tests/xfs/582 b/tests/xfs/582 index f390b77f3439ee..c949e14899788a 100755 --- a/tests/xfs/582 +++ b/tests/xfs/582 @@ -31,13 +31,13 @@ _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime -# XXX the realtime summary scrubber isn't currently implemented upstream. -# Don't bother trying to test it on those kernels -$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \ - grep -q 'Scan was not complete' && \ - _notrun "rtsummary scrub is incomplete" - -_scratch_xfs_stress_scrub -s "scrub rtsummary" +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_scrub -s "scrub rtsummary %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_scrub -s "scrub rtsummary 0" +else + _scratch_xfs_stress_scrub -s "scrub rtsummary" +fi # success, all done echo Silence is golden diff --git a/tests/xfs/739 b/tests/xfs/739 index a143325e3facb6..1fcae151f007d1 100755 --- a/tests/xfs/739 +++ b/tests/xfs/739 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/740 b/tests/xfs/740 index e867d591fd99cb..74c37312b088f1 100755 --- a/tests/xfs/740 +++ b/tests/xfs/740 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/741 b/tests/xfs/741 index ea4aa75b24741b..95b7c5f01646b5 100755 --- a/tests/xfs/741 +++ b/tests/xfs/741 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/742 b/tests/xfs/742 index 967e384f659f72..50dd387fae3456 100755 --- a/tests/xfs/742 +++ b/tests/xfs/742 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/743 b/tests/xfs/743 index 82b87b33792cdd..c8129b76a87e33 100755 --- a/tests/xfs/743 +++ b/tests/xfs/743 @@ -26,7 +26,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/744 b/tests/xfs/744 index 4840e78c4427ab..9382676fbb2707 100755 --- a/tests/xfs/744 +++ b/tests/xfs/744 @@ -26,7 +26,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/745 b/tests/xfs/745 index 6cc3805d4c9df8..be61f4bc463a18 100755 --- a/tests/xfs/745 +++ b/tests/xfs/745 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -path="$(_scratch_xfs_find_metafile rbmino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.bitmap" +else + path="$(_scratch_xfs_find_metafile rbmino)" +fi _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" diff --git a/tests/xfs/746 b/tests/xfs/746 index b6ec74524b0eaa..84600ab755a5aa 100755 --- a/tests/xfs/746 +++ b/tests/xfs/746 @@ -25,7 +25,11 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -path="$(_scratch_xfs_find_metafile rsumino)" +if _xfs_has_feature "$SCRATCH_DEV" rtgroups; then + path="path -m /rtgroups/0.summary" +else + path="$(_scratch_xfs_find_metafile rsumino)" +fi _scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" diff --git a/tests/xfs/793 b/tests/xfs/793 index d942d9807967b5..59080467e90606 100755 --- a/tests/xfs/793 +++ b/tests/xfs/793 @@ -32,13 +32,13 @@ _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" realtime _xfs_force_bdev realtime $SCRATCH_MNT -# XXX the realtime summary scrubber isn't currently implemented upstream. -# Don't bother trying to fix it on those kernels -$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \ - grep -q 'Scan was not complete' && \ - _notrun "rtsummary scrub is incomplete" - -_scratch_xfs_stress_online_repair -s "repair rtsummary" +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_online_repair -s "repair rtsummary %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_online_repair -s "repair rtsummary 0" +else + _scratch_xfs_stress_online_repair -s "repair rtsummary" +fi # success, all done echo Silence is golden ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCHSET v5.0 3/3] fstests: store quota files in the metadir 2024-10-11 0:24 [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Darrick J. Wong 2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong 2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong @ 2024-10-11 0:37 ` Darrick J. Wong 2024-10-11 1:45 ` [PATCH 1/4] xfs/122: update for segmented rtblock addresses Darrick J. Wong ` (3 more replies) 2024-10-14 7:50 ` [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Christoph Hellwig 3 siblings, 4 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 0:37 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests Hi all, Store the quota files in the metadata directory tree instead of the superblock. Since we're introducing a new incompat feature flag, let's also make the mount process bring up quotas in whatever state they were when the filesystem was last unmounted, instead of requiring sysadmins to remember that themselves. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=metadir-quotas xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=metadir-quotas fstests git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=metadir-quotas --- Commits in this patchset: * xfs/122: update for segmented rtblock addresses * xfs: update tests for quota files in the metadir * xfs: test persistent quota flags * xfs: fix tests for persistent qflags --- common/quota | 1 common/rc | 1 common/xfs | 21 ++++++ tests/generic/563 | 8 ++ tests/xfs/007 | 2 - tests/xfs/096 | 1 tests/xfs/096.out | 2 - tests/xfs/106 | 2 - tests/xfs/116 | 13 ++++ tests/xfs/116.cfg | 1 tests/xfs/116.out.default | 0 tests/xfs/116.out.metadir | 3 + tests/xfs/122.out | 5 +- tests/xfs/152 | 2 - tests/xfs/1856 | 13 ++++ tests/xfs/1891 | 128 +++++++++++++++++++++++++++++++++++++++ tests/xfs/1891.out | 147 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/263 | 1 tests/xfs/263.out | 2 - 19 files changed, 344 insertions(+), 9 deletions(-) create mode 100644 tests/xfs/116.cfg rename tests/xfs/{116.out => 116.out.default} (100%) create mode 100644 tests/xfs/116.out.metadir create mode 100755 tests/xfs/1891 create mode 100644 tests/xfs/1891.out ^ permalink raw reply [flat|nested] 37+ messages in thread
* [PATCH 1/4] xfs/122: update for segmented rtblock addresses 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong @ 2024-10-11 1:45 ` Darrick J. Wong 2024-10-11 1:45 ` [PATCH 2/4] xfs: update tests for quota files in the metadir Darrick J. Wong ` (2 subsequent siblings) 3 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:45 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Check the offset of sb_rgblklog. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/xfs/122.out | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 18aff98f96ac46..3fbc4d4fc49ad1 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -36,7 +36,8 @@ offsetof(xfs_sb_t, sb_lsn) = 240 offsetof(xfs_sb_t, sb_magicnum) = 0 offsetof(xfs_sb_t, sb_meta_uuid) = 248 offsetof(xfs_sb_t, sb_metadirino) = 264 -offsetof(xfs_sb_t, sb_metadirpad) = 204 +offsetof(xfs_sb_t, sb_metadirpad0) = 205 +offsetof(xfs_sb_t, sb_metadirpad1) = 206 offsetof(xfs_sb_t, sb_pquotino) = 232 offsetof(xfs_sb_t, sb_qflags) = 176 offsetof(xfs_sb_t, sb_rblocks) = 16 @@ -45,7 +46,7 @@ offsetof(xfs_sb_t, sb_rbmino) = 64 offsetof(xfs_sb_t, sb_rextents) = 24 offsetof(xfs_sb_t, sb_rextsize) = 80 offsetof(xfs_sb_t, sb_rextslog) = 125 -offsetof(xfs_sb_t, sb_rgblklog) = 280 +offsetof(xfs_sb_t, sb_rgblklog) = 204 offsetof(xfs_sb_t, sb_rgcount) = 272 offsetof(xfs_sb_t, sb_rgextents) = 276 offsetof(xfs_sb_t, sb_rootino) = 56 ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 2/4] xfs: update tests for quota files in the metadir 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong 2024-10-11 1:45 ` [PATCH 1/4] xfs/122: update for segmented rtblock addresses Darrick J. Wong @ 2024-10-11 1:45 ` Darrick J. Wong 2024-10-11 1:45 ` [PATCH 3/4] xfs: test persistent quota flags Darrick J. Wong 2024-10-11 1:46 ` [PATCH 4/4] xfs: fix tests for persistent qflags Darrick J. Wong 3 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:45 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Update fstests to handle quota files in the metadir. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/xfs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/xfs b/common/xfs index 6bd411cad67f5f..7198a5579d4cfa 100644 --- a/common/xfs +++ b/common/xfs @@ -1949,6 +1949,24 @@ _scratch_xfs_find_metafile() return 0 fi ;; + "uquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/user" + return 0 + fi + ;; + "gquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/group" + return 0 + fi + ;; + "pquotino") + if _xfs_has_feature "$SCRATCH_DEV" metadir; then + echo "path -m /quota/project" + return 0 + fi + ;; esac sb_field="$(_scratch_xfs_get_sb_field "$metafile")" ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 3/4] xfs: test persistent quota flags 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong 2024-10-11 1:45 ` [PATCH 1/4] xfs/122: update for segmented rtblock addresses Darrick J. Wong 2024-10-11 1:45 ` [PATCH 2/4] xfs: update tests for quota files in the metadir Darrick J. Wong @ 2024-10-11 1:45 ` Darrick J. Wong 2024-10-11 1:46 ` [PATCH 4/4] xfs: fix tests for persistent qflags Darrick J. Wong 3 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:45 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Test the persistent quota flags that come with the metadir feature. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- tests/generic/563 | 8 ++- tests/xfs/1891 | 128 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1891.out | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 282 insertions(+), 1 deletion(-) create mode 100755 tests/xfs/1891 create mode 100644 tests/xfs/1891.out diff --git a/tests/generic/563 b/tests/generic/563 index 0a8129a60ea28f..3f3c335f84b371 100755 --- a/tests/generic/563 +++ b/tests/generic/563 @@ -92,7 +92,13 @@ smajor=$((0x`stat -L -c %t $LOOP_DEV`)) sminor=$((0x`stat -L -c %T $LOOP_DEV`)) _mkfs_dev $LOOP_DEV >> $seqres.full 2>&1 -_mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed" +if [ $FSTYP = "xfs" ]; then + # Writes to the quota file are captured in cgroup metrics on XFS, so + # we require that quota is not enabled at all. + _mount $LOOP_DEV -o noquota $SCRATCH_MNT || _fail "mount failed" +else + _mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed" +fi drop_io_cgroup= grep -q -w io $cgdir/cgroup.subtree_control || drop_io_cgroup=1 diff --git a/tests/xfs/1891 b/tests/xfs/1891 new file mode 100755 index 00000000000000..53009571a95a03 --- /dev/null +++ b/tests/xfs/1891 @@ -0,0 +1,128 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oracle. All Rights Reserved. +# +# FS QA Test 1891 +# +# Functionality test for persistent quota accounting and enforcement flags in +# XFS when metadata directories are enabled. +# +. ./common/preamble +_begin_fstest auto quick quota + +. ./common/filter +. ./common/quota + +$MKFS_XFS_PROG 2>&1 | grep -q 'uquota' || \ + _notrun "mkfs does not support uquota option" + +_require_scratch +_require_xfs_quota + +filter_quota_state() { + sed -e 's/Inode: #[0-9]\+/Inode #XXX/g' \ + -e '/max warnings:/d' \ + -e '/Blocks grace time:/d' \ + -e '/Inodes grace time:/d' \ + | _filter_scratch +} + +qerase_mkfs_options() { + echo "$MKFS_OPTIONS" | sed \ + -e 's/uquota//g' \ + -e 's/gquota//g' \ + -e 's/pquota//g' \ + -e 's/uqnoenforce//g' \ + -e 's/gqnoenforce//g' \ + -e 's/pqnoenforce//g' \ + -e 's/,,*/,/g' +} + +confirm() { + echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" + _scratch_mount + $XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state + _check_xfs_scratch_fs + _scratch_unmount +} + +ORIG_MOUNT_OPTIONS="$MOUNT_OPTIONS" +MKFS_OPTIONS="$(qerase_mkfs_options)" + +echo "Test 0: formatting a subset" +_scratch_mkfs -m uquota,gqnoenforce &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 1: formatting" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 2: only grpquota" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option grpquota +confirm + +echo "Test 3: repair" +_scratch_xfs_repair &>> $seqres.full || echo "repair failed?" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +confirm + +echo "Test 4: weird options" +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option pqnoenforce,uquota +confirm + +echo "Test 5: simple recovery" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +confirm + +echo "Test 6: simple recovery with mount options" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option gqnoenforce +confirm + +echo "Test 7: user quotaoff recovery" +_scratch_mkfs -m uquota,gquota,pquota &>> $seqres.full +MOUNT_OPTIONS="$ORIG_MOUNT_OPTIONS" +_qmount_option # blank out quota options +echo "$MOUNT_OPTIONS" | grep -E -q '(qnoenforce|quota)' && \ + echo "saw quota mount options" +_scratch_mount +$XFS_QUOTA_PROG -x -c "state -ugp" $SCRATCH_MNT | filter_quota_state +touch $SCRATCH_MNT/a +$XFS_QUOTA_PROG -x -c 'off -u' $SCRATCH_MNT +_scratch_shutdown -v -f >> $seqres.full +echo shutdown +_scratch_unmount +confirm + +# success, all done +status=0 +exit diff --git a/tests/xfs/1891.out b/tests/xfs/1891.out new file mode 100644 index 00000000000000..7e8894088042bb --- /dev/null +++ b/tests/xfs/1891.out @@ -0,0 +1,147 @@ +QA output created by 1891 +Test 0: formatting a subset +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode: N/A +Test 1: formatting +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Test 2: only grpquota +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 3: repair +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 4: weird options +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 5: simple recovery +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Test 6: simple recovery with mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +saw quota mount options +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: OFF + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Test 7: user quotaoff recovery +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +shutdown +User quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: OFF + Inode #XXX (1 blocks, 1 extents) +Group quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) +Project quota state on SCRATCH_MNT (SCRATCH_DEV) + Accounting: ON + Enforcement: ON + Inode #XXX (1 blocks, 1 extents) ^ permalink raw reply related [flat|nested] 37+ messages in thread
* [PATCH 4/4] xfs: fix tests for persistent qflags 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong ` (2 preceding siblings ...) 2024-10-11 1:45 ` [PATCH 3/4] xfs: test persistent quota flags Darrick J. Wong @ 2024-10-11 1:46 ` Darrick J. Wong 3 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-11 1:46 UTC (permalink / raw) To: zlang, djwong; +Cc: linux-xfs, hch, fstests From: Darrick J. Wong <djwong@kernel.org> Fix the tests that now break with persistent quota flags. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- common/quota | 1 + common/rc | 1 + common/xfs | 3 +++ tests/xfs/007 | 2 +- tests/xfs/096 | 1 + tests/xfs/096.out | 2 +- tests/xfs/106 | 2 +- tests/xfs/116 | 13 ++++++++++++- tests/xfs/116.cfg | 1 + tests/xfs/116.out.default | 0 tests/xfs/116.out.metadir | 3 +++ tests/xfs/152 | 2 +- tests/xfs/1856 | 13 +++++++++++++ tests/xfs/263 | 1 + tests/xfs/263.out | 2 +- 15 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 tests/xfs/116.cfg rename tests/xfs/{116.out => 116.out.default} (100%) create mode 100644 tests/xfs/116.out.metadir diff --git a/common/quota b/common/quota index 3bf7d552eecc07..c16634d8d2fbf4 100644 --- a/common/quota +++ b/common/quota @@ -312,6 +312,7 @@ _qmount_option() -e 's/grpjquota=[^, ]*/QUOTA/g' \ -e 's/\bpquota/QUOTA/g' \ -e 's/prjquota/QUOTA/g' \ + -e 's/noquota/QUOTA/g' \ -e 's/quota/QUOTA/g' \ -e 's/uqnoenforce/QUOTA/g' \ -e 's/gqnoenforce/QUOTA/g' \ diff --git a/common/rc b/common/rc index 3171058496c732..1018f0b6afc8e4 100644 --- a/common/rc +++ b/common/rc @@ -3531,6 +3531,7 @@ _get_os_name() _link_out_file_named() { test -n "$seqfull" || _fail "need to set seqfull" + test -r "$seqfull.cfg" || _fail "need $seqfull.cfg" local features=$2 local suffix=$(FEATURES="$features" perl -e ' diff --git a/common/xfs b/common/xfs index 7198a5579d4cfa..c43b824d28f792 100644 --- a/common/xfs +++ b/common/xfs @@ -1689,6 +1689,9 @@ _xfs_filter_mkfs() print STDERR "ldev=\"$1\"\nlbsize=$2\nlblocks=$3\nlversion=$4\n"; print STDOUT "log =LDEV bsize=XXX blocks=XXX\n"; } + if (/^\s+=\s+exchange=(\d+)\s+metadir=(\d+)/) { + print STDERR "exchange=$1\nmetadir=$2\n\n"; + } if (/^\s+=\s+sectsz=(\d+)\s+sunit=(\d+) blks/) { print STDERR "logsectsz=$1\nlogsunit=$2\n\n"; } diff --git a/tests/xfs/007 b/tests/xfs/007 index e35a069f9bd5c5..4721bc832b3fe4 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -47,7 +47,7 @@ do_test() # This takes care of newer kernels where quotaoff clears the superblock # quota enforcement flags but doesn't shut down accounting. _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _scratch_mount rm_commands=(-x -c "remove -$off_opts") diff --git a/tests/xfs/096 b/tests/xfs/096 index 57a05a8ffefbd1..f1f5d562d4fa18 100755 --- a/tests/xfs/096 +++ b/tests/xfs/096 @@ -28,6 +28,7 @@ function option_string() if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi; if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi; if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi; + if [ "$VAL" = "0" ]; then OPT=noquota; fi; echo $OPT } diff --git a/tests/xfs/096.out b/tests/xfs/096.out index 1deb7a8c302374..20f68d3870c4a0 100644 --- a/tests/xfs/096.out +++ b/tests/xfs/096.out @@ -1,5 +1,5 @@ QA output created by 096 -== Options: rw == +== Options: noquota == == Options: usrquota,rw == User quota state on SCRATCH_MNT (SCRATCH_DEV) Accounting: ON diff --git a/tests/xfs/106 b/tests/xfs/106 index 066efef1181b8a..10cbd1052bbc89 100755 --- a/tests/xfs/106 +++ b/tests/xfs/106 @@ -155,7 +155,7 @@ test_off() { echo "turning quota off by remounting" _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _qmount } diff --git a/tests/xfs/116 b/tests/xfs/116 index c5e7508f8862ed..3ef6f5ddfdb2d6 100755 --- a/tests/xfs/116 +++ b/tests/xfs/116 @@ -23,7 +23,18 @@ _require_xfs_quota # Only mount with the quota options we specify below _qmount_option "defaults" -_scratch_mkfs >/dev/null 2>&1 +_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null +. $tmp.mkfs +cat $tmp.mkfs >> $seqres.full + +# link correct .out file, see $seqfull.cfg +seqfull=$0 +if [ "$metadir" = 1 ]; then + _link_out_file_named $seqfull.out "metadir" +else + _link_out_file_named $seqfull.out +fi + _scratch_mount "-o uquota" _scratch_unmount _scratch_xfs_db -r -c sb -c print | grep qflags diff --git a/tests/xfs/116.cfg b/tests/xfs/116.cfg new file mode 100644 index 00000000000000..571f542faef97d --- /dev/null +++ b/tests/xfs/116.cfg @@ -0,0 +1 @@ +metadir: metadir diff --git a/tests/xfs/116.out b/tests/xfs/116.out.default similarity index 100% rename from tests/xfs/116.out rename to tests/xfs/116.out.default diff --git a/tests/xfs/116.out.metadir b/tests/xfs/116.out.metadir new file mode 100644 index 00000000000000..3a58fb919b1e39 --- /dev/null +++ b/tests/xfs/116.out.metadir @@ -0,0 +1,3 @@ +QA output created by 116 +qflags = 0x7 +qflags = 0x7 diff --git a/tests/xfs/152 b/tests/xfs/152 index 6c052cbc9b31f5..94428b35d22a87 100755 --- a/tests/xfs/152 +++ b/tests/xfs/152 @@ -194,7 +194,7 @@ test_off() { echo "checking off command (type=$type)" _scratch_unmount - _qmount_option "" + _qmount_option "noquota" _qmount } diff --git a/tests/xfs/1856 b/tests/xfs/1856 index 74f982af65070f..9f43aa32f6f42f 100755 --- a/tests/xfs/1856 +++ b/tests/xfs/1856 @@ -158,6 +158,19 @@ post_exercise() return 0 } +qerase_mkfs_options() { + echo "$MKFS_OPTIONS" | sed \ + -e 's/uquota//g' \ + -e 's/gquota//g' \ + -e 's/pquota//g' \ + -e 's/uqnoenforce//g' \ + -e 's/gqnoenforce//g' \ + -e 's/pqnoenforce//g' \ + -e 's/,,*/,/g' +} + +MKFS_OPTIONS="$(qerase_mkfs_options)" + # Create a list of fs features in the order that support for them was added # to the kernel driver. For each feature upgrade test, we enable all the # features that came before it and none of the ones after, which means we're diff --git a/tests/xfs/263 b/tests/xfs/263 index aedbc4795296d3..83ec8b959fa9de 100755 --- a/tests/xfs/263 +++ b/tests/xfs/263 @@ -27,6 +27,7 @@ function option_string() if [ "$((VAL & 4))" -ne "0" ]; then OPT=prjquota,${OPT}; fi; if [ "$((VAL & 2))" -ne "0" ]; then OPT=grpquota,${OPT}; fi; if [ "$((VAL & 1))" -ne "0" ]; then OPT=usrquota,${OPT}; fi; + if [ "$VAL" = "0" ]; then OPT=noquota; fi; echo $OPT } diff --git a/tests/xfs/263.out b/tests/xfs/263.out index 64c1a5876cfa24..8682eee2680728 100644 --- a/tests/xfs/263.out +++ b/tests/xfs/263.out @@ -1,5 +1,5 @@ QA output created by 263 -== Options: rw == +== Options: noquota == == Options: usrquota,rw == User quota state on SCRATCH_MNT (SCRATCH_DEV) Accounting: ON ^ permalink raw reply related [flat|nested] 37+ messages in thread
* Re: [PATCHBOMB 6.13] xfs: metadata directories and realtime groups 2024-10-11 0:24 [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Darrick J. Wong ` (2 preceding siblings ...) 2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong @ 2024-10-14 7:50 ` Christoph Hellwig 2024-10-15 1:01 ` Darrick J. Wong 3 siblings, 1 reply; 37+ messages in thread From: Christoph Hellwig @ 2024-10-14 7:50 UTC (permalink / raw) To: Darrick J. Wong; +Cc: Carlos Maiolino, linux-xfs, fstests On Thu, Oct 10, 2024 at 05:24:02PM -0700, Darrick J. Wong wrote: > I'm only sending the kernel patches to the list for now, but please have > a look at the git tree links for xfsprogs and fstests changes. As far as I can you've also sent out xfsprogs and xfstests patches :) ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: [PATCHBOMB 6.13] xfs: metadata directories and realtime groups 2024-10-14 7:50 ` [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Christoph Hellwig @ 2024-10-15 1:01 ` Darrick J. Wong 0 siblings, 0 replies; 37+ messages in thread From: Darrick J. Wong @ 2024-10-15 1:01 UTC (permalink / raw) To: Christoph Hellwig; +Cc: Carlos Maiolino, linux-xfs, fstests On Mon, Oct 14, 2024 at 12:50:14AM -0700, Christoph Hellwig wrote: > On Thu, Oct 10, 2024 at 05:24:02PM -0700, Darrick J. Wong wrote: > > I'm only sending the kernel patches to the list for now, but please have > > a look at the git tree links for xfsprogs and fstests changes. > > As far as I can you've also sent out xfsprogs and xfstests patches :) Oops, haha. Yeah, I meant to adjust the patchbomb letter and forgot. At least I remembered to split up the xfsprogs branches into libxfs-sync and non-libxfs-sync and omit the libxfs-sync branches, unlike last time. Baby steps... --D ^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2024-10-15 1:01 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 0:24 [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Darrick J. Wong
2024-10-11 0:37 ` [PATCHSET v5.0 1/3] fstests: test XFS metadata directories Darrick J. Wong
2024-10-11 1:38 ` [PATCH 01/11] xfs/122: fix metadirino Darrick J. Wong
2024-10-11 1:38 ` [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled Darrick J. Wong
2024-10-11 1:38 ` [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees Darrick J. Wong
2024-10-11 1:39 ` [PATCH 04/11] common/repair: patch up repair sb inode value complaints Darrick J. Wong
2024-10-11 1:39 ` [PATCH 05/11] xfs/206: update for metadata directory support Darrick J. Wong
2024-10-11 1:39 ` [PATCH 06/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees Darrick J. Wong
2024-10-11 1:39 ` [PATCH 07/11] xfs/509: adjust inumbers accounting for metadata directories Darrick J. Wong
2024-10-11 1:40 ` [PATCH 08/11] xfs/122: adjust " Darrick J. Wong
2024-10-11 1:40 ` [PATCH 09/11] xfs: create fuzz tests " Darrick J. Wong
2024-10-11 1:40 ` [PATCH 10/11] xfs/163: bigger fs for metadir Darrick J. Wong
2024-10-11 1:40 ` [PATCH 11/11] xfs: test metapath repairs Darrick J. Wong
2024-10-11 0:37 ` [PATCHSET v5.0 2/3] xfsprogs: shard the realtime section Darrick J. Wong
2024-10-11 1:41 ` [PATCH 01/16] common/populate: refactor caching of metadumps to a helper Darrick J. Wong
2024-10-11 1:41 ` [PATCH 02/16] common/{fuzzy,populate}: use _scratch_xfs_mdrestore Darrick J. Wong
2024-10-11 1:41 ` [PATCH 03/16] fuzzy: stress data and rt sections of xfs filesystems equally Darrick J. Wong
2024-10-11 1:42 ` [PATCH 04/16] common/ext4: reformat external logs during mdrestore operations Darrick J. Wong
2024-10-11 1:42 ` [PATCH 05/16] common/populate: use metadump v2 format by default for fs metadata snapshots Darrick J. Wong
2024-10-11 1:42 ` [PATCH 06/16] xfs/122: update for rtgroups Darrick J. Wong
2024-10-11 1:42 ` [PATCH 07/16] punch-alternating: detect xfs realtime files with large allocation units Darrick J. Wong
2024-10-11 1:43 ` [PATCH 08/16] xfs/206: update mkfs filtering for rt groups feature Darrick J. Wong
2024-10-11 1:43 ` [PATCH 09/16] common: pass the realtime device to xfs_db when possible Darrick J. Wong
2024-10-11 1:43 ` [PATCH 10/16] xfs/185: update for rtgroups Darrick J. Wong
2024-10-11 1:43 ` [PATCH 11/16] xfs/449: update test to know about xfs_db -R Darrick J. Wong
2024-10-11 1:44 ` [PATCH 12/16] xfs/122: update for rtbitmap headers Darrick J. Wong
2024-10-11 1:44 ` [PATCH 13/16] xfs/271,xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands Darrick J. Wong
2024-10-11 1:44 ` [PATCH 14/16] common/xfs: capture realtime devices during metadump/mdrestore Darrick J. Wong
2024-10-11 1:44 ` [PATCH 15/16] common/fuzzy: adapt the scrub stress tests to support rtgroups Darrick J. Wong
2024-10-11 1:45 ` [PATCH 16/16] xfs: fix fuzz tests of rtgroups bitmap and summary files Darrick J. Wong
2024-10-11 0:37 ` [PATCHSET v5.0 3/3] fstests: store quota files in the metadir Darrick J. Wong
2024-10-11 1:45 ` [PATCH 1/4] xfs/122: update for segmented rtblock addresses Darrick J. Wong
2024-10-11 1:45 ` [PATCH 2/4] xfs: update tests for quota files in the metadir Darrick J. Wong
2024-10-11 1:45 ` [PATCH 3/4] xfs: test persistent quota flags Darrick J. Wong
2024-10-11 1:46 ` [PATCH 4/4] xfs: fix tests for persistent qflags Darrick J. Wong
2024-10-14 7:50 ` [PATCHBOMB 6.13] xfs: metadata directories and realtime groups Christoph Hellwig
2024-10-15 1:01 ` Darrick J. Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox