From patchwork Wed Dec 27 13:57:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508543 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 409834A03; Mon, 1 Jan 2024 00:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JakMk9ts" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12873C433C8; Mon, 1 Jan 2024 00:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070680; bh=QGntrNCdYCD+4lcnznxRRuQJFD69M4THXaEfrLTsR9o=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JakMk9ts57WGEZOjZAFdZ9ho7Gt4TbdUgnUwDsadasEMkD2yqXLBXxv9J6KcFyljw 8AKjPNUKtJtmjnQQyKAnRSp4CgRqUUk68Dr4wcFy0xR2C1ae/LC1ECC/Cqvrp8i3s7 /rNOOyVjYp60nU+8R9TD16BmzqQ99lFrvcwlp7cq49hneFyJk4+3Y/dIoZdUhZSYZ2 r8svpIY4uSaoWUgFafH7cfBBbsvmn7DkxPx7TkaNHkDOfhQcxz2Uc5NMRqD7nvNRgQ POOLltReUn86g3QtBzhKUojB0SRzMbdOE4n6ymrR5y0gJ6l0SCAUX0DT/ROo/worpI HWKjE6tMyAaDQ== Date: Sun, 31 Dec 2023 16:57:59 +9900 Subject: [PATCH 01/13] xfs: fix tests that try to access the realtime rmap inode From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031247.1826914.14975902534899402025.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The realtime rmap tests were added to fstests a long time ago. Since they were added, we decided to create a metadata file directory structure instead of adding more fields to the superblock. Therefore, fix all the tests that try to access these paths. While we're at it, fix xfs/409 to run the *online* scrub program like it's supposed to. xfs/408 is the fuzzer for xfs_repair testing. Signed-off-by: Darrick J. Wong --- common/xfs | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/122.out | 1 - tests/xfs/333 | 45 --------------------------------------------- tests/xfs/333.out | 6 ------ tests/xfs/337 | 2 +- tests/xfs/338 | 30 +++++++++++++++++++++++++----- tests/xfs/339 | 5 +++-- tests/xfs/340 | 25 ++++++++++++++++++++----- tests/xfs/341 | 2 +- tests/xfs/342 | 4 ++-- 10 files changed, 93 insertions(+), 68 deletions(-) delete mode 100755 tests/xfs/333 delete mode 100644 tests/xfs/333.out diff --git a/common/xfs b/common/xfs index 75f1bbcc3d..d3baa7a7c3 100644 --- a/common/xfs +++ b/common/xfs @@ -2105,3 +2105,44 @@ _xfs_statfs_field() { $XFS_IO_PROG -c 'statfs' "$1" | grep -E "$2" | cut -d ' ' -f 3 } + +# Resolve a metadata directory tree path and return the inode number. +_scratch_metadir_lookup() { + local res="$(_scratch_xfs_db -c "ls -i -m $1")" + test "${PIPESTATUS[0]}" -eq 0 && echo "$res" +} + +# Figure out which directory entry we have to change to update the rtrmap +# inode pointer. The last line of output is inumber field within a metadata +# object; any previous lines are the accessor commands that must be fed to +# xfs_db to get to the correct directory block. +_scratch_find_rt_metadir_entry() { + local sfkey="$(_scratch_xfs_db -c 'path -m /realtime' -c print | \ + grep "\"$1\"" | \ + sed -e 's/.name.*$//g' -e 's/\[/\\[/g' -e 's/\]/\\]/g' )" + if [ -n "$sfkey" ]; then + echo 'path -m /realtime' + _scratch_xfs_db -c 'path -m /realtime' -c print | \ + grep "${sfkey}.inumber" | awk '{print $1}' + return 0 + fi + + local size=$(_scratch_xfs_db -c 'path -m /realtime' -c 'print core.size' | awk '{print $3}') + local blksz=$(_scratch_xfs_db -c 'sb 0' -c 'print blocksize' | awk '{print $3}') + local dirblklog=$(_scratch_xfs_db -c 'sb 0' -c 'print dirblklog' | awk '{print $3}') + local dirblksz=$((blksz << dirblklog )) + for ((fileoff = 0; fileoff < (size / dirblksz); fileoff++)); do + local dbkey="$(_scratch_xfs_db -c 'path -m /realtime' -c "dblock $fileoff" -c 'print' | \ + grep "\"$1\"" | \ + sed -e 's/.name.*$//g' -e 's/\[/\\[/g' -e 's/\]/\\]/g' )" + if [ -n "$dbkey" ]; then + echo 'path -m /realtime' + echo "dblock $fileoff" + _scratch_xfs_db -c 'path -m /realtime' -c "dblock $fileoff" -c print | \ + grep "${dbkey}.inumber" | awk '{print $1}' + return 0 + fi + done + + return 1 +} diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 6b03b90c2d..837286a9d3 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -48,7 +48,6 @@ offsetof(xfs_sb_t, sb_rgblklog) = 280 offsetof(xfs_sb_t, sb_rgblocks) = 272 offsetof(xfs_sb_t, sb_rgcount) = 276 offsetof(xfs_sb_t, sb_rootino) = 56 -offsetof(xfs_sb_t, sb_rrmapino) = 264 offsetof(xfs_sb_t, sb_rsumino) = 72 offsetof(xfs_sb_t, sb_sectlog) = 121 offsetof(xfs_sb_t, sb_sectsize) = 102 diff --git a/tests/xfs/333 b/tests/xfs/333 deleted file mode 100755 index 728c518402..0000000000 --- a/tests/xfs/333 +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/bash -# SPDX-License-Identifier: GPL-2.0 -# Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. -# -# FS QA Test No. 333 -# -# Set rrmapino to another inode on an non-rt rmap fs and see if repair fixes it. -# -. ./common/preamble -_begin_fstest auto quick rmap realtime - -# Import common functions. -. ./common/filter - -# real QA test starts here -_supported_fs xfs -_require_xfs_scratch_rmapbt -_disable_dmesg_check - -rm -f "$seqres.full" - -unset SCRATCH_RTDEV - -echo "Format and mount" -_scratch_mkfs > "$seqres.full" 2>&1 -rrmapino="$(_scratch_xfs_db -c 'sb 0' -c 'p rrmapino' 2>&1)" -test "${rrmapino}" = "field rrmapino not found" && _notrun "realtime rmapbt not supported" -_scratch_mount - -echo "Create some files" -$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f1 >> $seqres.full -$XFS_IO_PROG -f -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full -echo garbage > $SCRATCH_MNT/f3 -ino=$(stat -c '%i' $SCRATCH_MNT/f3) -_scratch_unmount - -echo "Corrupt fs" -_scratch_xfs_db -x -c 'sb 0' -c "write rrmapino $ino" >> $seqres.full -_try_scratch_mount 2>&1 | _filter_error_mount - -echo "Test done, mount should have failed" - -# success, all done -status=0 -exit diff --git a/tests/xfs/333.out b/tests/xfs/333.out deleted file mode 100644 index b3c698750f..0000000000 --- a/tests/xfs/333.out +++ /dev/null @@ -1,6 +0,0 @@ -QA output created by 333 -Format and mount -Create some files -Corrupt fs -mount: Structure needs cleaning -Test done, mount should have failed diff --git a/tests/xfs/337 b/tests/xfs/337 index f74baae9b0..9ea8587b27 100755 --- a/tests/xfs/337 +++ b/tests/xfs/337 @@ -53,7 +53,7 @@ echo "+ check fs" _scratch_xfs_repair -n >> $seqres.full 2>&1 || echo "xfs_repair should not fail" echo "+ corrupt image" -_scratch_xfs_db -x -c "sb" -c "addr rrmapino" -c "addr u3.rtrmapbt.ptrs[1]" \ +_scratch_xfs_db -x -c "path -m /realtime/0.rmap" -c "addr u3.rtrmapbt.ptrs[1]" \ -c "stack" -c "blocktrash -x 4096 -y 4096 -n 8 -3 -z" \ >> $seqres.full 2>&1 diff --git a/tests/xfs/338 b/tests/xfs/338 index 9f36150c7e..babadc4e1b 100755 --- a/tests/xfs/338 +++ b/tests/xfs/338 @@ -29,13 +29,33 @@ $XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f2 >> $seqres.full _scratch_unmount echo "Corrupt fs" -_scratch_xfs_db -x -c 'sb 0' -c 'addr rrmapino' \ - -c 'write core.nlinkv2 0' -c 'write core.mode 0' -c 'sb 0' \ - -c 'write rrmapino 0' >> $seqres.full -_try_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" +readarray -t rtrmap_path < <(_scratch_find_rt_metadir_entry 0.rmap) + +rtrmap_accessors=() +rtrmap_path_len="${#rtrmap_path[@]}" +for ((i = 0; i < rtrmap_path_len - 1; i++)); do + rtrmap_accessors+=(-c "${rtrmap_path[i]}") +done +rtrmap_entry="${rtrmap_path[rtrmap_path_len - 1]}" +test -n "$rtrmap_entry" || _fail "Could not find rtrmap metadir entry?" + +_scratch_xfs_db -x -c 'path -m /realtime/0.rmap' \ + -c 'write core.nlinkv2 0' -c 'write core.mode 0' \ + "${rtrmap_accessors[@]}" \ + -c "print $rtrmap_entry" \ + -c "write -d $rtrmap_entry 0" >> $seqres.full +if _try_scratch_mount >> $seqres.full 2>&1; then + echo "mount should have failed" + _scratch_unmount +else + # If the verifiers are working properly, the mount will fail because + # we fuzzed the metadata root directory. This causes loud complaints + # to dmesg, so we want to ignore those. + _disable_dmesg_check +fi echo "Repair fs" -_scratch_unmount 2>&1 | _filter_scratch +_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot _repair_scratch_fs >> $seqres.full 2>&1 echo "Try to create more files (again)" diff --git a/tests/xfs/339 b/tests/xfs/339 index 3e0b4d97ab..24a90d0ba3 100755 --- a/tests/xfs/339 +++ b/tests/xfs/339 @@ -31,7 +31,8 @@ ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 _scratch_unmount echo "Corrupt fs" -rrmapino=`_scratch_xfs_get_sb_field rrmapino` +rrmapino=$(_scratch_metadir_lookup /realtime/0.rmap) +test -n "$rrmapino" || _fail "Could not find rtrmap inode?" _scratch_xfs_set_metadata_field "u3.sfdir3.list[3].inumber.i4" $rrmapino \ 'sb 0' 'addr rootino' >> $seqres.full _scratch_mount @@ -43,7 +44,7 @@ echo "Try to create more files" $XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 echo "Repair fs" -_scratch_unmount 2>&1 | _filter_scratch +_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot _repair_scratch_fs >> $seqres.full 2>&1 echo "Try to create more files (again)" diff --git a/tests/xfs/340 b/tests/xfs/340 index 2c0014513e..6ee818becb 100755 --- a/tests/xfs/340 +++ b/tests/xfs/340 @@ -31,16 +31,31 @@ ino=$(stat -c '%i' $SCRATCH_MNT/f3) _scratch_unmount echo "Corrupt fs" -rrmapino=$(_scratch_xfs_get_sb_field rrmapino) -_scratch_xfs_db -x -c "inode $rrmapino" \ +readarray -t rtrmap_path < <(_scratch_find_rt_metadir_entry 0.rmap) + +rtrmap_accessors=() +rtrmap_path_len="${#rtrmap_path[@]}" +for ((i = 0; i < rtrmap_path_len - 1; i++)); do + rtrmap_accessors+=(-c "${rtrmap_path[i]}") +done +rtrmap_entry="${rtrmap_path[rtrmap_path_len - 1]}" +test -n "$rtrmap_entry" || _fail "Could not find rtrmap metadir entry?" + +rrmapino=$(_scratch_metadir_lookup /realtime/0.rmap) +test -n "$rrmapino" || _fail "Could not find rtrmap inode?" +_scratch_xfs_db -x -c "path -m /realtime/0.rmap" \ -c 'write core.format 2' -c 'write core.size 0' \ - -c 'write core.nblocks 0' -c 'sb 0' -c 'addr rootino' \ + -c 'write core.nblocks 0' \ + -c 'sb 0' -c 'addr rootino' \ + -c "print u3.sfdir3.list[2].inumber" \ -c "write u3.sfdir3.list[2].inumber.i4 $rrmapino" \ - -c 'sb 0' -c "write rrmapino $ino" >> $seqres.full + "${rtrmap_accessors[@]}" \ + -c "print $rtrmap_entry" \ + -c "write $rtrmap_entry $ino" >> $seqres.full _try_scratch_mount >> $seqres.full 2>&1 && echo "mount should have failed" echo "Repair fs" -_scratch_unmount 2>&1 | _filter_scratch +_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot _repair_scratch_fs >> $seqres.full 2>&1 echo "Try to create more files (again)" diff --git a/tests/xfs/341 b/tests/xfs/341 index 7d2842b579..8861e751a9 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -53,7 +53,7 @@ echo "Corrupt fs" fsbno=$(_scratch_xfs_db -c "inode $ino" -c 'bmap' | grep 'flag 0' | head -n 1 | \ sed -e 's/^.*startblock \([0-9]*\) .*$/\1/g') -_scratch_xfs_db -x -c 'sb 0' -c 'addr rrmapino' \ +_scratch_xfs_db -x -c 'path -m /realtime/0.rmap' \ -c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' >> $seqres.full _scratch_mount diff --git a/tests/xfs/342 b/tests/xfs/342 index 538c8987ef..f29bd874e9 100755 --- a/tests/xfs/342 +++ b/tests/xfs/342 @@ -47,9 +47,9 @@ ino=$(stat -c '%i' $SCRATCH_MNT/f3) _scratch_unmount echo "Corrupt fs" -_scratch_xfs_db -c 'sb 0' -c 'addr rrmapino' -c 'p u3.rtrmapbt.ptrs[1]' >> $seqres.full +_scratch_xfs_db -c 'path -m /realtime/0.rmap' -c 'p u3.rtrmapbt.ptrs[1]' >> $seqres.full -fsbno=$(_scratch_xfs_db -c 'sb 0' -c 'addr rrmapino' \ +fsbno=$(_scratch_xfs_db -c 'path -m /realtime/0.rmap' \ -c 'p u3.rtrmapbt.ptrs[1]' | sed -e 's/^.*://g') _scratch_xfs_db -x -c "inode $ino" -c "write u3.bmx[0].startblock $fsbno" >> $seqres.full _scratch_mount From patchwork Wed Dec 27 13:58:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508544 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6ECD4A04; Mon, 1 Jan 2024 00:58:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TN0KgWWD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A89A4C433C8; Mon, 1 Jan 2024 00:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070695; bh=6z7yiC1VU0pUBqdVF0TpynQAFvd8xb/S4LZTMWnLdN4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=TN0KgWWDRPxEwF+trXocEvLbGi9etZvMtaBJ5+B8jBYi3szm2YnpaomPaKn+Xlq13 2kRgKlHkQ3lPsIVltS3Su14ROmAWoL5+He/IT6tE4bQRBbNdfhlQlsrYr2FwRl0RaS a5lOtkwCERl2VUYTVtmB3VGsyOkY8CTcBgtgccklZt3vzr/Sm2AvL1J85DVqn8LEM0 QG8nLGjUgYEx3YIHp70zqKikZegp1i1hcZeoZrpRToW6ktriCZc9ILdV9AhxoMVoDj tyPzSeZLrtEQ9F8ZiJS6D+jXwqE3w0/NFOpRXX7H/IPzbHNH6o9PwXWZgd3xl437yq kIR8opWV+6nGQ== Date: Sun, 31 Dec 2023 16:58:15 +9900 Subject: [PATCH 02/13] fuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031260.1826914.7202041015850827164.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The fs population code creates a realtime rmap btree in /some/ realtime group with at least two levels. This rmapbt file isn't necessarily the one for group 0, so we need to find it programmatically. Signed-off-by: Darrick J. Wong --- common/xfs | 33 +++++++++++++++++++++++++++++++++ tests/xfs/406 | 6 ++++-- tests/xfs/407 | 6 ++++-- tests/xfs/408 | 7 +++++-- tests/xfs/409 | 7 +++++-- tests/xfs/481 | 6 ++++-- tests/xfs/482 | 7 +++++-- 7 files changed, 60 insertions(+), 12 deletions(-) diff --git a/common/xfs b/common/xfs index d3baa7a7c3..b8dd8d4a40 100644 --- a/common/xfs +++ b/common/xfs @@ -1914,6 +1914,39 @@ _scratch_xfs_find_agbtree_height() { return 1 } +# Find us the path to the inode containing a realtime btree with a specific +# height. +_scratch_xfs_find_rgbtree_height() { + local bt_type="$1" + local bt_height="$2" + local rgcount=$(_xfs_mount_rgcount $SCRATCH_DEV) + local path + local path_format + local bt_prefix + + case "${bt_type}" in + "rmap") + path_format="/realtime/%u.rmap" + bt_prefix="u3.rtrmapbt" + ;; + *) + _fail "Don't know about rt btree ${bt_type}" + ;; + esac + + for ((rgno = 0; rgno < rgcount; rgno++)); do + path="$(printf "${path_format}" "${rgno}")" + bt_level=$(_scratch_xfs_db -c "path -m ${path}" -c "p ${bt_prefix}.level" | awk '{print $3}') + # "level" is the actual level within the btree + if [ "${bt_level}" -eq "$((bt_height - 1))" ]; then + echo "${path}" + return 0 + fi + done + + return 1 +} + _require_xfs_mkfs_atomicswap() { # atomicswap can be activated on rmap or reflink filesystems. diff --git a/tests/xfs/406 b/tests/xfs/406 index 78db18077c..8c5570886b 100755 --- a/tests/xfs/406 +++ b/tests/xfs/406 @@ -26,10 +26,12 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'sb 0' 'addr rrmapino') +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "path -m $path") echo "Fuzz rtrmapbt recs" -_scratch_xfs_fuzz_metadata '' 'offline' 'sb 0' 'addr rrmapino' "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "path -m $path" "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full echo "Done fuzzing rtrmapbt recs" # success, all done diff --git a/tests/xfs/407 b/tests/xfs/407 index 5a43775b55..2460ea336c 100755 --- a/tests/xfs/407 +++ b/tests/xfs/407 @@ -26,10 +26,12 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'sb 0' 'addr rrmapino') +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 1)" || \ + _fail "could not find two-level rtrmapbt" +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "path -m $path") echo "Fuzz rtrmapbt recs" -_scratch_xfs_fuzz_metadata '' 'online' 'sb 0' 'addr rrmapino' "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "path -m $path" "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full echo "Done fuzzing rtrmapbt recs" # success, all done diff --git a/tests/xfs/408 b/tests/xfs/408 index 8049d6bead..3bed3824e8 100755 --- a/tests/xfs/408 +++ b/tests/xfs/408 @@ -4,7 +4,7 @@ # # FS QA Test No. 408 # -# Populate a XFS filesystem and fuzz every rtrmapbt keyptr field. +# Populate a XFS filesystem and fuzz every rtrmapbt key/pointer field. # Use xfs_repair to fix the corruption. # . ./common/preamble @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" + echo "Fuzz rtrmapbt keyptrs" -_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' 'sb 0' 'addr rrmapino' >> $seqres.full +_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' "path -m $path" >> $seqres.full echo "Done fuzzing rtrmapbt keyptrs" # success, all done diff --git a/tests/xfs/409 b/tests/xfs/409 index adac95fea8..ce66175c6e 100755 --- a/tests/xfs/409 +++ b/tests/xfs/409 @@ -4,7 +4,7 @@ # # FS QA Test No. 409 # -# Populate a XFS filesystem and fuzz every rtrmapbt keyptr field. +# Populate a XFS filesystem and fuzz every rtrmapbt key/pointer field. # Use xfs_scrub to fix the corruption. # . ./common/preamble @@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" + echo "Fuzz rtrmapbt keyptrs" -_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' 'sb 0' 'addr rrmapino' >> $seqres.full +_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'online' "path -m $path" >> $seqres.full echo "Done fuzzing rtrmapbt keyptrs" # success, all done diff --git a/tests/xfs/481 b/tests/xfs/481 index 48c7580ccb..d303f2c27d 100755 --- a/tests/xfs/481 +++ b/tests/xfs/481 @@ -27,10 +27,12 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'sb 0' 'addr rrmapino') +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "path -m $path") echo "Fuzz rtrmapbt recs" -_scratch_xfs_fuzz_metadata '' 'none' 'sb 0' 'addr rrmapino' "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "path -m $path" "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full echo "Done fuzzing rtrmapbt recs" # success, all done diff --git a/tests/xfs/482 b/tests/xfs/482 index 0192b94cc0..32a3012154 100755 --- a/tests/xfs/482 +++ b/tests/xfs/482 @@ -4,7 +4,7 @@ # # FS QA Test No. 482 # -# Populate a XFS filesystem and fuzz every rtrmapbt keyptr field. +# Populate a XFS filesystem and fuzz every rtrmapbt key/pointer field. # Do not fix the filesystem, to test metadata verifiers. . ./common/preamble @@ -27,8 +27,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" + echo "Fuzz rtrmapbt keyptrs" -_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' 'sb 0' 'addr rrmapino' >> $seqres.full +_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' "path -m $path" >> $seqres.full echo "Done fuzzing rtrmapbt keyptrs" # success, all done From patchwork Wed Dec 27 13:58:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508545 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2548642; Mon, 1 Jan 2024 00:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NFcUkiEo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5810DC433C7; Mon, 1 Jan 2024 00:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070711; bh=e8C2AtCF/7Yhu7cMKseIcORmI1rqaz/31kg8V+bwEwo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=NFcUkiEoptzZc3gyX/wD9+qmfXhVrBMcvZCqmbzayRxZ3z2XPxE8Ux6Y7KWqCoz84 VGGLXBPjfhe4D0HLechaYaoThEyjuXy4wIgFrgtnAMBHP2/Y3NeV4OtQxDsZJAkUqV 9gClmO6VDr7ti6DEuxGtaELaxRX75mPTMH1azDX+UieAH1fnKU+7WmQDxvd+jNg+jv zuTGtV7bTguyWlIMW+sbXg5azCQTTbJE0umrumK0CWXxBAANooY9NQTXvwu8n1+JH6 X4vg7cbYHzLvcJLJ8ztMbT/HA1a0hFWRUkVQj4HSPUxCzH0VSCc2kEAbS/wqgu+kKw 71elvAjtoc0UA== Date: Sun, 31 Dec 2023 16:58:30 +9900 Subject: [PATCH 03/13] xfs: race fsstress with realtime rmap btree scrub and repair From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031273.1826914.10723169821572634090.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Race checking and rebuilding realtime rmap btrees with fsstress. Signed-off-by: Darrick J. Wong --- tests/xfs/1817 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1817.out | 2 ++ tests/xfs/1821 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1821.out | 2 ++ tests/xfs/1857 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1857.out | 2 ++ 6 files changed, 132 insertions(+) create mode 100755 tests/xfs/1817 create mode 100644 tests/xfs/1817.out create mode 100755 tests/xfs/1821 create mode 100644 tests/xfs/1821.out create mode 100755 tests/xfs/1857 create mode 100644 tests/xfs/1857.out diff --git a/tests/xfs/1817 b/tests/xfs/1817 new file mode 100755 index 0000000000..56ce63e005 --- /dev/null +++ b/tests/xfs/1817 @@ -0,0 +1,42 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1817 +# +# Race fsstress and rtrmapbt scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime +_require_xfs_has_feature "$SCRATCH_MNT" rmapbt +_xfs_force_bdev realtime $SCRATCH_MNT + +_scratch_xfs_stress_scrub -s "scrub rtrmapbt %rgno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1817.out b/tests/xfs/1817.out new file mode 100644 index 0000000000..525ec14ed0 --- /dev/null +++ b/tests/xfs/1817.out @@ -0,0 +1,2 @@ +QA output created by 1817 +Silence is golden diff --git a/tests/xfs/1821 b/tests/xfs/1821 new file mode 100755 index 0000000000..7dbac04f52 --- /dev/null +++ b/tests/xfs/1821 @@ -0,0 +1,42 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1821 +# +# Race fsstress and realtime bitmap repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime +_xfs_force_bdev realtime $SCRATCH_MNT + +_scratch_xfs_stress_online_repair -s "repair rtbitmap" -s "repair rgbitmap %rgno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1821.out b/tests/xfs/1821.out new file mode 100644 index 0000000000..0f18ad5d88 --- /dev/null +++ b/tests/xfs/1821.out @@ -0,0 +1,2 @@ +QA output created by 1821 +Silence is golden diff --git a/tests/xfs/1857 b/tests/xfs/1857 new file mode 100755 index 0000000000..de10bbb5c4 --- /dev/null +++ b/tests/xfs/1857 @@ -0,0 +1,42 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1857 +# +# Race fsstress and rtrmapbt repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime +_require_xfs_has_feature "$SCRATCH_MNT" rmapbt +_xfs_force_bdev realtime $SCRATCH_MNT + +_scratch_xfs_stress_online_repair -s "repair rtrmapbt %rgno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1857.out b/tests/xfs/1857.out new file mode 100644 index 0000000000..b51ffd3f6c --- /dev/null +++ b/tests/xfs/1857.out @@ -0,0 +1,2 @@ +QA output created by 1857 +Silence is golden From patchwork Wed Dec 27 13:58:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508546 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71F007EF; Mon, 1 Jan 2024 00:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="POcvr6Pt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA44BC433C8; Mon, 1 Jan 2024 00:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070727; bh=XXlbWvWkUPc6diQ1nc573PK6tgbd2IypPrgPrqS6584=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=POcvr6PtplJt4YwUw+Tf3FXS2VJWSY97tNmrlUbi6KyeKTCuBhyBOk0sk/3h10Cxt ri8xbaDE5HIyqzMhWAY0NeYR+CyR7PSdFDx0bJtaLkXA8h+QlaKNywgm2FTR0g//ry eVDkpvFPqTEq6abNxJPczcOUkeRYS3tsT98ZgGsTHSfwzUQk6VuzjKkiQyi3YsO+TC MPbmuk5dWGc6a/nlvX1QKv49joKLcwVU9+ZOuId4jkE8T7U2OnNNiJa1yWgXiZICgI KeBJtRzIGaNbXka9XN0cVangmty9ksayIMut9+/mts5NyhnuuPEqtDnw6xwpo/i36b u9FBqyKmI6vyw== Date: Sun, 31 Dec 2023 16:58:46 +9900 Subject: [PATCH 04/13] xfs/856: add rtrmapbt upgrade to test matrix From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031286.1826914.4787726527598409685.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Add realtime reverse mapping btrees to the features that this test will try to upgrade. Signed-off-by: Darrick J. Wong --- tests/xfs/1856 | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/xfs/1856 b/tests/xfs/1856 index 93bdbaa531..8453d9bff2 100755 --- a/tests/xfs/1856 +++ b/tests/xfs/1856 @@ -34,11 +34,46 @@ rt_configured() test "$USE_EXTERNAL" = "yes" && test -n "$SCRATCH_RTDEV" } +# Does mkfs support rtgroups? +supports_rtgroups() +{ + $MKFS_XFS_PROG 2>&1 | grep -q 'rtgroups=' +} + +# Do we need to enable rtgroups at mkfs time to support a feature upgrade test? +need_rtgroups() +{ + local feat="$1" + + # if realtime isn't configured, we don't need rt groups + rt_configured || return 1 + + # If we don't even know what realtime rmap is, we don't need rt groups + test -z "${FEATURE_STATE["rmapbt"]}" && return 1 + + # rt rmap btrees require rt groups but rt groups cannot be added to + # an existing filesystem, so we must force it on at mkfs time + test "${FEATURE_STATE["rmapbt"]}" -eq 1 && return 0 + test "$feat" = "rmapbt" && return 0 + + return 1 +} + # Compute the MKFS_OPTIONS string for a particular feature upgrade test compute_mkfs_options() { + local feat="$1" local m_opts="" local caller_options="$MKFS_OPTIONS" + local rtgroups + + need_rtgroups "$feat" && rtgroups=1 + if echo "$caller_options" | grep -q 'rtgroups='; then + test -z "$rtgroups" && rtgroups=0 + caller_options="$(echo "$caller_options" | sed -e 's/rtgroups=*[0-9]*/rtgroups='$rtgroups'/g')" + elif [ -n "$rtgroups" ]; then + caller_options="$caller_options -r rtgroups=$rtgroups" + fi for feat in "${FEATURES[@]}"; do local feat_state="${FEATURE_STATE["${feat}"]}" @@ -170,10 +205,12 @@ post_exercise() # upgrade don't spread failure to the rest of the tests. FEATURES=() if rt_configured; then + # rmap wasn't added to rt devices until after metadir and rtgroups check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") check_repair_upgrade metadir && FEATURES+=("metadir") + supports_rtgroups && check_repair_upgrade rmapbt && FEATURES+=("rmapbt") else check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade rmapbt && FEATURES+=("rmapbt") @@ -196,7 +233,7 @@ for feat in "${FEATURES[@]}"; do upgrade_start_message "$feat" | _tee_kernlog $seqres.full > /dev/null - opts="$(compute_mkfs_options)" + opts="$(compute_mkfs_options "$feat")" echo "mkfs.xfs $opts" >> $seqres.full # Format filesystem From patchwork Wed Dec 27 13:59:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508547 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 056F97ED; Mon, 1 Jan 2024 00:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A8oWNevI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 864A9C433C8; Mon, 1 Jan 2024 00:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070742; bh=MgFLUXCk5rf9uB5i0V7IUBLm99Hr2qikmIU5DayRiA8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=A8oWNevIgjUnZPwSz0RF0i9GQWM+Ns3kHvcXw61JhqazCZcW6FuQGjn/g7SDE7PFH wNLVjYMBHpBBHDvoHHwCJUBYSI9clRPnfw+NnYBGBpIJuO4edzbOn9+3zykhXPhkgo KVsNl9Rq2QkhUPEZjuYpUXDCv2TnYltVEMhhZntLgrajab81voIwzoA0hwJPIqyQ0J nTW5AzHsqIAj1VzuEaMpHG1eUz5a4vmM8qUH5e1s6VbZK1ghNs68SnnEhY/FdMew1y A/kQ8rzgNZ3jeIfF3HbkqcsDbF+n6js11hpx+gBNMwkWj69mcc9+aOyDrAI2w0aEdN URax+x6o1aWRg== Date: Sun, 31 Dec 2023 16:59:02 +9900 Subject: [PATCH 05/13] xfs/122: update for rtgroups-based realtime rmap btrees From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031300.1826914.17433169728736943917.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Now that we've redesigned realtime rmap to require that the rt section be sharded into allocation groups of no more than 2^31 blocks, we've reduced the size of the ondisk structures and therefore need to update this test. Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 837286a9d3..f5621cac12 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -120,8 +120,8 @@ 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 +sizeof(struct xfs_rtrmap_key) = 20 +sizeof(struct xfs_rtrmap_rec) = 24 sizeof(struct xfs_rtrmap_root) = 4 sizeof(struct xfs_rtsb) = 104 sizeof(struct xfs_rud_log_format) = 16 From patchwork Wed Dec 27 13:59:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508548 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B8767EE; Mon, 1 Jan 2024 00:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BdxJ8rRe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DE98C433C8; Mon, 1 Jan 2024 00:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070758; bh=+bZjXIN47a46bHE9sLkDCYVh7WDa4PepmEvBYdmYx1o=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=BdxJ8rRe49ZltQGN2fcuc0X9CmfGsUpfydLvBSXivgNgamopraCnPkkp2gDfAfPvN HC/YVrzcuDKEFWbMseCIDPQ+saRPycyyInaqQWwgzxE9r9H90ZgKTYgSV68CDZ/XGD Z+BbJBQkiC6NpD27X0vqw6ccXnqq9dno6qacv8zRgWwdBdhJ4E+fdd9yDwvVfAIvsc EyagdOcufngZ+8tpYVEK39afThB+G+X0SMo5JttzxzN1I759D7vqgKnpdRRmQO+bMr pbUIrof+MZ9ITtvTqmYESKOOLuoIvzDc7BPLgPdr2JKK7HJ2HfFTKNyOLL6TTFkq2q jZkPfDzbFu0sA== Date: Sun, 31 Dec 2023 16:59:17 +9900 Subject: [PATCH 06/13] xfs: fix various problems with fsmap detecting the data device From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031313.1826914.17634665414796550757.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Various tests of realtime rmap functionality assumed that the data device could be picked out from the GETFSMAP output by looking for static fs metadata. This is no longer true, since rtgroups have a static superblock header at the start, so update these tests. Signed-off-by: Darrick J. Wong --- tests/xfs/272 | 2 +- tests/xfs/276 | 2 +- tests/xfs/277 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/xfs/272 b/tests/xfs/272 index c68fa9d614..d5f3a74177 100755 --- a/tests/xfs/272 +++ b/tests/xfs/272 @@ -57,7 +57,7 @@ cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total c done echo "Check device field of FS metadata and regular file" -data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') +data_dev=$(grep 'inode btree' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') test "${data_dev}" = "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?" diff --git a/tests/xfs/276 b/tests/xfs/276 index 8cc486752a..a05ca1961d 100755 --- a/tests/xfs/276 +++ b/tests/xfs/276 @@ -61,7 +61,7 @@ cat $TEST_DIR/bmap | while read ext offrange colon blockrange ag agrange total c done echo "Check device field of FS metadata and realtime file" -data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') +data_dev=$(grep 'inode btree' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') rt_dev=$(grep "${ino}[[:space:]]*[0-9]*\.\.[0-9]*[[:space:]]*[0-9]*$" $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') test "${data_dev}" != "${rt_dev}" || echo "data ${data_dev} realtime ${rt_dev}?" diff --git a/tests/xfs/277 b/tests/xfs/277 index 03208ef233..eff54a2a50 100755 --- a/tests/xfs/277 +++ b/tests/xfs/277 @@ -38,7 +38,7 @@ $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT >> $seqres.full $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT | tr '[]()' ' ' > $TEST_DIR/fsmap echo "Check device field of FS metadata and journalling log" -data_dev=$(grep 'static fs metadata' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') +data_dev=$(grep 'inode btree' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') journal_dev=$(grep 'journalling log' $TEST_DIR/fsmap | head -n 1 | awk '{print $2}') test "${data_dev}" = "${journal_dev}" || echo "data ${data_dev} journal ${journal_dev}?" From patchwork Wed Dec 27 13:59:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508549 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5219F7ED; Mon, 1 Jan 2024 00:59:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dRamzwR1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6318C433C8; Mon, 1 Jan 2024 00:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070773; bh=5tGYjlAVtTsCmR1z/8/XOITcG+nNZq/DfjTeq+f8+nc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=dRamzwR1NFkbup5MSQlhDx5lCWoFSiAe32RH1rZyx/zASVK/vM/GW9Oy8Rny627BX oQoYZvGhUEhQDOq4zBeZisLuxQWy9bo2mudu6XcsF4cTvNve1g+zwSzfPJjPlBYkny uhYyODggDLrC4Cen42OBkQ0lsunKss6MGfaozIUFNA1n3lgjOoJcfY1ygcmgEgu2lv g40zXVueVMJpYouLPJNg/KCfQ0Ceis9BnXK3VT/KwkgQmgfrnXcheJWJE+mPA1MV0x ui+abxjzkfFOGH7SJ98b8EbDBwnlQIK3LT5HfRc7ORlHX06QKwXaV+yfHe7EBJwMUA BDDwSEmlTQhYg== Date: Sun, 31 Dec 2023 16:59:33 +9900 Subject: [PATCH 07/13] xfs/341: update test for rtgroup-based rmap From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031325.1826914.2968755576593092081.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Now that we're sharding the realtime volume into multiple allocation groups, update this test to reflect the new reality. The realtime rmap btree record and key sizes have shrunk, and we can't guarantee that a quick file write actually hits the same rt group as the one we fuzzed, so eliminate the file write test since we're really only curious if xfs_repair will fix the problem. Signed-off-by: Darrick J. Wong --- tests/xfs/341 | 10 +++------- tests/xfs/341.out | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/xfs/341 b/tests/xfs/341 index 8861e751a9..561054f0bd 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -32,10 +32,10 @@ blksz="$(_get_block_size $SCRATCH_MNT)" rtextsz_blks=$((rtextsz / blksz)) # inode core size is at least 176 bytes; btree header is 56 bytes; -# rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes. +# rtrmap record is 24 bytes; and rtrmap key/pointer are 48 bytes. i_core_size="$(_xfs_get_inode_core_bytes $SCRATCH_MNT)" -i_ptrs=$(( (isize - i_core_size) / 56 )) -bt_recs=$(( (blksz - 56) / 32 )) +i_ptrs=$(( (isize - i_core_size) / 48 )) +bt_recs=$(( (blksz - 56) / 24 )) blocks=$((i_ptrs * bt_recs + 1)) len=$((blocks * rtextsz)) @@ -57,10 +57,6 @@ _scratch_xfs_db -x -c 'path -m /realtime/0.rmap' \ -c "write u3.rtrmapbt.ptrs[1] $fsbno" -c 'p' >> $seqres.full _scratch_mount -echo "Try to create more files" -$XFS_IO_PROG -f -R -c "pwrite -S 0x68 0 9999" $SCRATCH_MNT/f5 >> $seqres.full 2>&1 -test -e $SCRATCH_MNT/f5 && echo "should not have been able to write f5" - echo "Repair fs" _scratch_unmount 2>&1 | _filter_scratch _repair_scratch_fs >> $seqres.full 2>&1 diff --git a/tests/xfs/341.out b/tests/xfs/341.out index 75a5bc6c61..580d788954 100644 --- a/tests/xfs/341.out +++ b/tests/xfs/341.out @@ -2,6 +2,5 @@ QA output created by 341 Format and mount Create some files Corrupt fs -Try to create more files Repair fs Try to create more files (again) From patchwork Wed Dec 27 13:59:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508550 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1208438D; Mon, 1 Jan 2024 00:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VjMVY1+B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746F4C433C8; Mon, 1 Jan 2024 00:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070789; bh=rZQRoAcAh/3zfW2Sh1mMP3nA4r5gUeCjbevpArYJvM4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=VjMVY1+BB30RM2TzdfNcnHZjHWmf5dv0RQ0d1jnntO2y278UenRrGjYK9x5SWxnx9 XAc7ZDRqNZvxokdKRfJ0L7YIFTrPEEgQ3IUdIa2UCsCDjzZYEHJmm1HyNrIUNVxCNN 4s0ciBBD5nNnjufXMN+nve49sUtGf8o+N7dWY0MmJREwklyDDTHOM5ekG2BfMrlz/W OlMmluCz0X5rDVkUD1xPKL3XQeAws4RhtF7kMKQqz7rBHbD5XPY+C1dCNVKl87pwPZ z/9nikJPhJD8nT81aXh2ZuRYbW67nC+HFrdx8FImlEgukgNiNvuxX1vUMaS7xxat/4 3ZKbzLsCX2mrQ== Date: Sun, 31 Dec 2023 16:59:48 +9900 Subject: [PATCH 08/13] xfs/3{43,32}: adapt tests for rt extent size greater than 1 From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031339.1826914.7325295617050633178.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Both of these tests for the realtime volume can fail when the rt extent size is larger than a single block. 332 is a read-write functionality test that encodes md5sum in the output, so we need to skip it if $blksz isn't congruent with the extent size, because the fcollapse call will fail. 343 is a test of the rmap btree, so the fix here is simpler -- make $blksz the file allocation unit, and get rid of the md5sum in the golden output. Signed-off-by: Darrick J. Wong --- tests/xfs/332 | 6 +----- tests/xfs/332.out | 2 -- tests/xfs/343 | 2 ++ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/xfs/332 b/tests/xfs/332 index a2d37ee905..c1ac87adcb 100755 --- a/tests/xfs/332 +++ b/tests/xfs/332 @@ -28,7 +28,7 @@ rm -f "$seqres.full" echo "Format and mount" _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount -blksz=65536 +blksz=$(_get_file_block_size $SCRATCH_MNT) # 65536 blocks=16 len=$((blocks * blksz)) @@ -45,10 +45,6 @@ $XFS_IO_PROG -c "fpunch $blksz $blksz" \ -c "fcollapse $((9 * blksz)) $blksz" \ -c "finsert $((10 * blksz)) $blksz" $SCRATCH_MNT/f1 >> $seqres.full -echo "Check file" -md5sum $SCRATCH_MNT/f1 | _filter_scratch -od -tx1 -Ad -c $SCRATCH_MNT/f1 >> $seqres.full - echo "Unmount" _scratch_unmount diff --git a/tests/xfs/332.out b/tests/xfs/332.out index 9beff7cc37..3a7ca95b40 100644 --- a/tests/xfs/332.out +++ b/tests/xfs/332.out @@ -2,8 +2,6 @@ QA output created by 332 Format and mount Create some files Manipulate file -Check file -e45c5707fcf6817e914ffb6ce37a0ac7 SCRATCH_MNT/f1 Unmount Try a regular fsmap Try a bad fsmap diff --git a/tests/xfs/343 b/tests/xfs/343 index bffcc7d9ac..fe461847ed 100755 --- a/tests/xfs/343 +++ b/tests/xfs/343 @@ -31,6 +31,8 @@ blksz=65536 blocks=16 len=$((blocks * blksz)) +_require_congruent_file_oplen $SCRATCH_MNT $blksz + 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 From patchwork Wed Dec 27 14:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508551 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 535907ED; Mon, 1 Jan 2024 01:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OR4LtUq3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC36C433C7; Mon, 1 Jan 2024 01:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070805; bh=aatZZfEshMVICDl/LR2THfmIvimPMuKO3zsT1Z6FkzE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=OR4LtUq3oAvhnrvQsNQRbX1a7eSeXoh+loqEFM92OVfu72RAI5NHRITrziVqpY3d8 cQXEoUoz4NwssuCTuvOAVGxoLBJUDxOR1ePfVITuad9HuoAS2zAgFGKsxzpGpqnMiM T9dHH3OQOIanmU0fjPzPWs6+Un82vbLXHO5Uc4Bzh2KftGfx5mkCwAWCjxZyYIA0b5 poGDbZ12eR+jyiuiv9xxgyE3/pgrgsP85ApiFVq2LKg2MygIQUqzlKlGrd7BPOzX+d v9KSJjvZKWUERcQgW30oNMZd0VcgkVvJ/FScp0j9CRcGUElsv5i87T0AdYx52VpbHv 7us0BKLkX1+3w== Date: Sun, 31 Dec 2023 17:00:04 +9900 Subject: [PATCH 09/13] xfs: skip tests if formatting small filesystem fails From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031352.1826914.14947870409708728287.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong There are a few tests that try to exercise XFS functionality with an unusually small (< 500MB) filesystem. Formatting can fail if the test configuration also specifies a very large realtime device because mkfs hits ENOSPC when allocating the realtime metadata. The test proceeds anyway (which causes an immediate mount failure) so we might as well skip these. Signed-off-by: Darrick J. Wong --- tests/xfs/104 | 1 + tests/xfs/291 | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/xfs/104 b/tests/xfs/104 index d16f46d8e4..c3d1d18a58 100755 --- a/tests/xfs/104 +++ b/tests/xfs/104 @@ -16,6 +16,7 @@ _create_scratch() { echo "*** mkfs" _scratch_mkfs_xfs $@ | tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs + test "${PIPESTATUS[0]}" -eq 0 || _notrun "formatting small scratch fs failed" . $tmp.mkfs echo "*** mount" diff --git a/tests/xfs/291 b/tests/xfs/291 index 600dcb2eba..70e5f51cee 100755 --- a/tests/xfs/291 +++ b/tests/xfs/291 @@ -18,7 +18,8 @@ _require_command "$XFS_MDRESTORE_PROG" "xfs_mdrestore" # real QA test starts here _require_scratch logblks=$(_scratch_find_xfs_min_logblocks -n size=16k -d size=133m) -_scratch_mkfs_xfs -n size=16k -l size=${logblks}b -d size=133m >> $seqres.full 2>&1 +_scratch_mkfs_xfs -n size=16k -l size=${logblks}b -d size=133m >> $seqres.full 2>&1 || \ + _notrun "formatting small scratch fs failed" _scratch_mount # First we cause very badly fragmented freespace, then From patchwork Wed Dec 27 14:00:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508552 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 135B07FD; Mon, 1 Jan 2024 01:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PGmEneI4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D30EEC433C8; Mon, 1 Jan 2024 01:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070820; bh=IfjQZHXjRIiqHQ3FFzV1RNJqYfT5tIMuzLDYlQRjQf0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=PGmEneI4edwYxH9A9SA+BK9DjXXIrjoA/MkEg6WfilossJB8QYCaM91HAKrlBIhEA /3c3xho67XxyUGZJoJK0+zBl06YGGXYieUxMfdh5wGHy9x5OHPZKqlke848UoEZneM +aySyTr1PmVwW06jLCv2cSxdOTfZSEENbEiuIhuwvXtG4aMNGSdi22f8zTRpjoCTQB vJq4pv6cOA8Mr5mAIHdULUscweNoSSMJ6WvAr59WslULLKUk8k8PtKpYasEHoNBKOo ej3MPgF+bZAJmrlBLkLfcmwhnd+1QbSGCINpCF+oUBuT11O6CvkdBQIR4FwgCTrtrc WfY9YyoSIXgCQ== Date: Sun, 31 Dec 2023 17:00:20 +9900 Subject: [PATCH 10/13] xfs/443: use file allocation unit, not dbsize From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031365.1826914.17503370018968217272.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong We can only punch in units of file allocation boundaries, so update this test to use that instead of the fs blocksize. Signed-off-by: Darrick J. Wong --- tests/xfs/443 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/xfs/443 b/tests/xfs/443 index 56828decae..ab3cda59f3 100755 --- a/tests/xfs/443 +++ b/tests/xfs/443 @@ -40,14 +40,15 @@ _scratch_mount file1=$SCRATCH_MNT/file1 file2=$SCRATCH_MNT/file2 +file_blksz=$(_get_file_block_size $SCRATCH_MNT) # The goal is run an extent swap where one of the associated files has the # minimum number of extents to remain in btree format. First, create a couple # files with large enough extent counts (200 or so should be plenty) to ensure # btree format on the largest possible inode size filesystems. -$XFS_IO_PROG -fc "falloc 0 $((400 * dbsize))" $file1 +$XFS_IO_PROG -fc "falloc 0 $((400 * file_blksz))" $file1 $here/src/punch-alternating $file1 -$XFS_IO_PROG -fc "falloc 0 $((400 * dbsize))" $file2 +$XFS_IO_PROG -fc "falloc 0 $((400 * file_blksz))" $file2 $here/src/punch-alternating $file2 # Now run an extent swap at every possible extent count down to 0. Depending on @@ -55,12 +56,12 @@ $here/src/punch-alternating $file2 # btree format. for i in $(seq 1 2 399); do # punch one extent from the tmpfile and swap - $XFS_IO_PROG -c "fpunch $((i * dbsize)) $dbsize" $file2 + $XFS_IO_PROG -c "fpunch $((i * file_blksz)) $file_blksz" $file2 $XFS_IO_PROG -c "swapext $file2" $file1 # punch the same extent from the old fork (now in file2) to resync the # extent counts and repeat - $XFS_IO_PROG -c "fpunch $((i * dbsize)) $dbsize" $file2 + $XFS_IO_PROG -c "fpunch $((i * file_blksz)) $file_blksz" $file2 done # sanity check that no extents are left over From patchwork Wed Dec 27 14:00:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508553 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1763E7ED; Mon, 1 Jan 2024 01:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DyJlwtMc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A222C433C8; Mon, 1 Jan 2024 01:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070836; bh=hA+qaCTrGF0ZydHSDWX/oGQSqrmn1rmcf5eC/q17aoY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=DyJlwtMceWKF+qMIZl7ZRYA5b3pq/Kkq5wzGyr7gv2tfHo+zdARguY5cz0RISpG5L g9Jtfb/6oJag3lCeRjW30SGyHuSreBxBiDEdUG3kfSBaFCzF/7ueUV40uiWRLyLlpa IYxSFd2aFSGNkLPujWAyI+6tc4PPvOrxrkkfh3wQZtNTM8uVjrxjA07gkZSfOK2lAz kQk6GOsXgk2CYGE5YeCe95cyCtXr+lcWkeVZkXhmnzYeZnnzBAbksPCUq7PxghMyl4 eVSXbYldjUVHt/gKm/rKgQrEE9YnEHxgs5kCYGEVEtlwe7P8cc/mZsJecYA8VW8kCJ p82WfJG1eI/lQ== Date: Sun, 31 Dec 2023 17:00:36 +9900 Subject: [PATCH 11/13] populate: adjust rtrmap calculations for rtgroups From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031378.1826914.2094696976335341988.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Now that we've sharded the realtime volume and created per-group rmap btrees, we need to adjust downward the size of rtrmapbt records since the block counts are now 32-bit instead of 64-bit. Signed-off-by: Darrick J. Wong --- common/populate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/populate b/common/populate index dc89eee70e..d8d19bf782 100644 --- a/common/populate +++ b/common/populate @@ -450,7 +450,7 @@ _scratch_xfs_populate() { is_rt="$(_xfs_get_rtextents "$SCRATCH_MNT")" if [ $is_rmapbt -gt 0 ] && [ $is_rt -gt 0 ]; then echo "+ rtrmapbt btree" - nr="$((blksz * 2 / 32))" + nr="$((blksz * 2 / 24))" $XFS_IO_PROG -R -f -c 'truncate 0' "${SCRATCH_MNT}/RTRMAPBT" __populate_create_file $((blksz * nr)) "${SCRATCH_MNT}/RTRMAPBT" fi From patchwork Wed Dec 27 14:00:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508554 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 688ED7ED; Mon, 1 Jan 2024 01:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XJggcsGj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34FCBC433C8; Mon, 1 Jan 2024 01:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070852; bh=us6fFchlveF9YnzBfw+mkLNNtgQJsnqLggFWDd7NHgQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=XJggcsGjQKbgnL2IHg+Ie26014VTQIrkQvOXody3MfpbSQoT0CU9H4wxHbVNocplk s1dBZGKvKKVEw/TYSPRK9VVlB0d8G3O0qKHmjE0IwgqAm9e+zq00aB0gLnHO9novT/ gizP3Vs2gQdR8R5dHmDbSprn+ymTvGGl6hecRxCtHYh+CKHqogBxGnzKSW/1IM+QXP lm9fYXZPWWsR/uu44T0a6cD1RAe2OK8LaGVzrpBlmF0GTe6x+jBi2z2BUAK/cyIrsZ bMesKwkQvfUkgVusMuQ/MyETe7nZAe7wv83HsKu919p+2I1SlKXWff4Bmm5U94/qX0 1k3paAXCRRkgQ== Date: Sun, 31 Dec 2023 17:00:51 +9900 Subject: [PATCH 12/13] populate: check that we created a realtime rmap btree of the given height From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031391.1826914.10155953070500273029.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Make sure that we actually create an rt rmap btree of the desired height somewhere in the filesystem. Signed-off-by: Darrick J. Wong --- common/populate | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/common/populate b/common/populate index d8d19bf782..84ff9304e3 100644 --- a/common/populate +++ b/common/populate @@ -740,6 +740,37 @@ __populate_check_xfs_agbtree_height() { return 1 } +# Check that there's at least one rt btree with multiple levels +__populate_check_xfs_rgbtree_height() { + local bt_type="$1" + local rgcount=$(_scratch_xfs_db -c 'sb 0' -c 'p rgcount' | awk '{print $3}') + local path + local path_format + local bt_prefix + + case "${bt_type}" in + "rmap") + path_format="/realtime/%u.rmap" + bt_prefix="u3.rtrmapbt" + ;; + *) + _fail "Don't know about rt btree ${bt_type}" + ;; + esac + + for ((rgno = 0; rgno < rgcount; rgno++)); do + path="$(printf "${path_format}" "${rgno}")" + bt_level=$(_scratch_xfs_db -c "path -m ${path}" -c "p ${bt_prefix}.level" | awk '{print $3}') + # "level" is the actual level within the btree + if [ "${bt_level}" -gt 0 ]; then + return 0 + fi + done + + __populate_fail "Failed to create rt ${bt_type} of sufficient height!" + return 1 +} + # Check that populate created all the types of files we wanted _scratch_xfs_populate_check() { _scratch_mount @@ -763,6 +794,7 @@ _scratch_xfs_populate_check() { is_finobt=$(_xfs_has_feature "$SCRATCH_MNT" finobt -v) is_rmapbt=$(_xfs_has_feature "$SCRATCH_MNT" rmapbt -v) is_reflink=$(_xfs_has_feature "$SCRATCH_MNT" reflink -v) + is_rt="$(_xfs_get_rtextents "$SCRATCH_MNT")" blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")" dblksz="$(_xfs_get_dir_blocksize "$SCRATCH_MNT")" @@ -793,6 +825,8 @@ _scratch_xfs_populate_check() { test $is_finobt -ne 0 && __populate_check_xfs_agbtree_height "fino" test $is_rmapbt -ne 0 && __populate_check_xfs_agbtree_height "rmap" test $is_reflink -ne 0 && __populate_check_xfs_agbtree_height "refcnt" + test $is_rmapbt -ne 0 && test $is_rt -gt 0 && \ + __populate_check_xfs_rgbtree_height "rmap" } # Check data fork format of ext4 file From patchwork Wed Dec 27 14:01:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13508555 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77D96644; Mon, 1 Jan 2024 01:01:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CwNaXt6C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDC61C433C7; Mon, 1 Jan 2024 01:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704070868; bh=dmBTfiAJigB4Xq3+7Cdcl5eClHzGxnU3SAmz8EQDx4s=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=CwNaXt6Coz17uwtrYRU/7zW/14eAQcFAaKNP5vjAMx0WunEMLDU7x3IJcGqbHbRqD I4lHc7ni0xR61thQJgDrQ8Eu5AyaPqT45L2G4MEYI/vqUd/fcg82zTjSwhqzZ6ioIs jqyeO/oGKN1kUc1stAO3V01nlzGoEBHJhY2LyEAqHcQmt1jey08CVUAQOO9+CtFglw 1BYA9VmbBo5EYmkAi8xm/HwFIznARZqg3IZt/gCnZqu/zoykd34ZCWz+9mgPZqtqw/ ndIVvKYDIlYs0N4H69nYh+z9tt9zjM8bRsI2jvidOAON7FMguXpg57lTx3YmiOK4+s vlbBZhQ3QQSxA== Date: Sun, 31 Dec 2023 17:01:07 +9900 Subject: [PATCH 13/13] fuzzy: create missing fuzz tests for rt rmap btrees From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <170405031404.1826914.5544607212081205345.stgit@frogsfrogsfrogs> In-Reply-To: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> References: <170405031226.1826914.14340556896857027512.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Back when I first created the fuzz tests for the realtime rmap btree, I forgot a couple of things. Add tests to fuzz rtrmap btree leaf records, and node keys. Signed-off-by: Darrick J. Wong --- tests/xfs/1528 | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/1528.out | 4 ++++ tests/xfs/1529 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/1529.out | 4 ++++ tests/xfs/407 | 2 +- 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100755 tests/xfs/1528 create mode 100644 tests/xfs/1528.out create mode 100755 tests/xfs/1529 create mode 100644 tests/xfs/1529.out diff --git a/tests/xfs/1528 b/tests/xfs/1528 new file mode 100755 index 0000000000..24cbb55c23 --- /dev/null +++ b/tests/xfs/1528 @@ -0,0 +1,41 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1528 +# +# Populate a XFS filesystem and fuzz every rtrmapbt record field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair realtime + +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_xfs_scratch_rmapbt +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "path -m $path") + +echo "Fuzz rtrmapbt recs" +_scratch_xfs_fuzz_metadata '' 'both' "path -m $path" "addr u${inode_ver}.rtrmapbt.ptrs[1]" >> $seqres.full +echo "Done fuzzing rtrmapbt recs" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1528.out b/tests/xfs/1528.out new file mode 100644 index 0000000000..b51b640c40 --- /dev/null +++ b/tests/xfs/1528.out @@ -0,0 +1,4 @@ +QA output created by 1528 +Format and populate +Fuzz rtrmapbt recs +Done fuzzing rtrmapbt recs diff --git a/tests/xfs/1529 b/tests/xfs/1529 new file mode 100755 index 0000000000..3930edad47 --- /dev/null +++ b/tests/xfs/1529 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1529 +# +# Populate a XFS filesystem and fuzz every rtrmapbt keyptr field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair realtime + +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_xfs_scratch_rmapbt +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rtrmapbt" + +echo "Fuzz rtrmapbt keyptrs" +_scratch_xfs_fuzz_metadata '(rtrmapbt)' 'offline' "path -m $path" >> $seqres.full +echo "Done fuzzing rtrmapbt keyptrs" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1529.out b/tests/xfs/1529.out new file mode 100644 index 0000000000..808fcc957f --- /dev/null +++ b/tests/xfs/1529.out @@ -0,0 +1,4 @@ +QA output created by 1529 +Format and populate +Fuzz rtrmapbt keyptrs +Done fuzzing rtrmapbt keyptrs diff --git a/tests/xfs/407 b/tests/xfs/407 index 2460ea336c..bd439105e2 100755 --- a/tests/xfs/407 +++ b/tests/xfs/407 @@ -26,7 +26,7 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 -path="$(_scratch_xfs_find_rgbtree_height 'rmap' 1)" || \ +path="$(_scratch_xfs_find_rgbtree_height 'rmap' 2)" || \ _fail "could not find two-level rtrmapbt" inode_ver=$(_scratch_xfs_get_metadata_field "core.version" "path -m $path")