From patchwork Wed Feb 19 01:03:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981358 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 8F4F8AD21; Wed, 19 Feb 2025 01:03:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927035; cv=none; b=tar5Uf+Q/G9l6kedAQuJ33oqaT1RwqsWDhQoUsxLn7zu+J5KXLfRdfEiFKJH+NVEsPzGI+G3mPJAJeAsNBbWufbocQFl8e5nROiFBXzy+1+9kInEs2TWTVQhyEZpNSWoCUjtwVQOtR5vLggqe81cHIl/sjFlSQWrbECK0p1wS0o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927035; c=relaxed/simple; bh=A99kF8ioYajMwS1mu7hQfDV/O1xCoyRtAdMXY9lr2GE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JBIffvW2tWYbOrOHxlU8XXOjg/wQ6xJhmJbdQfWy930hbpaxAEkw/hybcY/tClYxAx4tuWvM10qnDtmVN2Ypkl8vCGVWY0oOI/pWVOICwulfgSpUCRcImRw14I7B7fn9pRDuSCcpKTB1g2Bh2skYWrMAILLA0FSv9XrKJEixw7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T8na3AgF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T8na3AgF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 656F4C4CEE2; Wed, 19 Feb 2025 01:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927035; bh=A99kF8ioYajMwS1mu7hQfDV/O1xCoyRtAdMXY9lr2GE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=T8na3AgFPsgYn8wlm/xlgwC79JDEElfrxBEB+zh2vS1vDGg/kWfXA4oaOaeF42O46 1Bn/UsZrh69+EZgryAAQzqimEr6N7OfOUPOS6PIZq6yxrIZ/TZ7ysc07GIy7rctpkW 3UsBcFAaDeHBV4IDE9cI8gifbQksYxIRdEMfO54oi0sudaq7JGRB2Jd9ha1IMQl1f7 TgLxuLo+q8jDQ6hpSzOA2KQ1AFBiOVp7C+XNgI/+qtGox1MK/vJn1Jdmo7JKajKxre DzP7vrfWTwRP4Jh2/XbNPQ8qzaqOnrBBxabVSwI0w27NicGGLrBfCc0ikgbgj5gnaT x73zTxHBYwFMA== Date: Tue, 18 Feb 2025 17:03:55 -0800 Subject: [PATCH 01/13] xfs: fix tests that try to access the realtime rmap inode From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591131.4080556.9851417940463513539.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/xfs | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/122.out | 1 - tests/xfs/333 | 43 ------------------------------------------- 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(+), 66 deletions(-) delete mode 100755 tests/xfs/333 delete mode 100644 tests/xfs/333.out diff --git a/common/xfs b/common/xfs index adad37ea0710e0..1a0ececde39422 100644 --- a/common/xfs +++ b/common/xfs @@ -2135,3 +2135,44 @@ _require_xfs_rtquota_if_rtdev() { _notrun "Quotas probably not supported on realtime scratch device; set TEST_RTDEV" fi } + +# 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 /rtgroups' -c print | \ + grep "\"$1\"" | \ + sed -e 's/.name.*$//g' -e 's/\[/\\[/g' -e 's/\]/\\]/g' )" + if [ -n "$sfkey" ]; then + echo 'path -m /rtgroups' + _scratch_xfs_db -c 'path -m /rtgroups' -c print | \ + grep "${sfkey}.inumber" | awk '{print $1}' + return 0 + fi + + local size=$(_scratch_xfs_db -c 'path -m /rtgroups' -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 /rtgroups' -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 /rtgroups' + echo "dblock $fileoff" + _scratch_xfs_db -c 'path -m /rtgroups' -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 4dc7d7d0a3602b..ec5028621a8e75 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -44,7 +44,6 @@ 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_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 f68f2f01320420..00000000000000 --- a/tests/xfs/333 +++ /dev/null @@ -1,43 +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 - -_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 b3c698750f8fb1..00000000000000 --- 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 2ba508044ba16b..64429347fcba70 100755 --- a/tests/xfs/337 +++ b/tests/xfs/337 @@ -51,7 +51,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 /rtgroups/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 9648c9df485223..713a808dc8e3da 100755 --- a/tests/xfs/338 +++ b/tests/xfs/338 @@ -27,13 +27,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 /rtgroups/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 4dabe43ff298fc..caadf87987e433 100755 --- a/tests/xfs/339 +++ b/tests/xfs/339 @@ -29,7 +29,8 @@ ln $SCRATCH_MNT/f3 $SCRATCH_MNT/f4 _scratch_unmount echo "Corrupt fs" -rrmapino=`_scratch_xfs_get_sb_field rrmapino` +rrmapino=$(_scratch_metadir_lookup /rtgroups/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 @@ -41,7 +42,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 248d3233c94ed3..c4a23bcb1cfe70 100755 --- a/tests/xfs/340 +++ b/tests/xfs/340 @@ -29,16 +29,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 /rtgroups/0.rmap) +test -n "$rrmapino" || _fail "Could not find rtrmap inode?" +_scratch_xfs_db -x -c "path -m /rtgroups/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 9b12febf8d5c49..e9aea42f429ffd 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -51,7 +51,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 /rtgroups/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 5c0e916dbe32ac..3bf353dd79b29b 100755 --- a/tests/xfs/342 +++ b/tests/xfs/342 @@ -45,9 +45,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 /rtgroups/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 /rtgroups/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 Feb 19 01:04:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981359 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 42A2A286292; Wed, 19 Feb 2025 01:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927051; cv=none; b=W7opprIE+5mOgN/9DY3zzehVeoYyp5olmm4MYzlZ1AtbYE/AYZPzYuKI3G9z77mktWbkeS1MpsKpX4i8flohs2FGICOIFK9IESU+soaa6JjiTg2l5U6dmC9vcGAEctRsc7EjiPuMSYvZKGF2flJE9dZCh2qtkuSUGk9B9yJ9AvU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927051; c=relaxed/simple; bh=IPqf58z3ilpr7OBmvohUlIYNeo8nO4Jd4Y26NkjM2ag=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K71OiTv/MP2HIdYPx3O6bXixv7tGqj3zNdUtngS7AuEMWLN6snonae5Y3YemKyDqgz3AbiRMQeLnXaVH05qxBk4GJu5Eo3XxscqVyWpswK5bIh+FxQTkojREaJOJzN9y2CSmFFscE8meY3fI0ghBQah2WSMQINsVBhtOQQyLVyQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lnRirYSO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lnRirYSO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1037FC4CEE2; Wed, 19 Feb 2025 01:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927051; bh=IPqf58z3ilpr7OBmvohUlIYNeo8nO4Jd4Y26NkjM2ag=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=lnRirYSOcviZV9eG1W3qRQS3sd96vJ+HvEAKoSRs2V0Nr9W7Rbvbt2uQAyHq06hTh IMOEcgeohOfd1ETLjv82o+cBAn7fDLD72hD+6wsPFgZbrKk+n7lVDGmAIvlpXiwWaC byhuTNH+9xe5Ya7hlejdx7fgpBx7X9h7zd6z2ief1Nc0qbM0AmDCQeY83H6vp0XAzn iQdh+pSbd1ScEuouQdqLs3K0/eICQ0lcPA4/1kz9+tqIOa7xF+MWhZDO4zw+LFBHgW 2fFij++lixEdqVxQF6U+KPI+60wfG3jccm/HhVSYay+25G9KGq7ZAWfOdaACnJZ8Bl FTzIUAflWFN4g== Date: Tue, 18 Feb 2025 17:04:10 -0800 Subject: [PATCH 02/13] xfs/336: port to common/metadump From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: fstests@vger.kernel.org, hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591149.4080556.17871153207427090752.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong xfs/336 does this somewhat sketchy thing where it mdrestores into a regular file, and then does this to validate the restored metadata: SCRATCH_DEV=$TEST_DIR/image _scratch_mount Unfortunately, commit 1a49022fab9b4d causes the following regression: --- /tmp/fstests/tests/xfs/336.out 2024-11-12 16:17:36.733447713 -0800 +++ /var/tmp/fstests/xfs/336.out.bad 2025-01-04 19:10:39.861871114 -0800 @@ -5,4 +5,5 @@ Create big file Explode the rtrmapbt Create metadump file Restore metadump -Check restored fs +Usage: _set_fs_sysfs_attr +(see /var/tmp/fstests/xfs/336.full for details) This is due to the fact that SCRATCH_DEV is temporarily reassigned to the regular file. That path is passed straight through _scratch_mount to _xfs_prepare_for_eio_shutdown, but that helper _fails because the "dev" argument isn't actually a path to a block device. Fix this by porting it to the new common/metadump code that we merged last year. Cc: # v2024.12.08 Fixes: 1a49022fab9b4d ("fstests: always use fail-at-unmount semantics for XFS") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- tests/xfs/336 | 34 +++++++++++----------------------- tests/xfs/336.out | 4 +--- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/tests/xfs/336 b/tests/xfs/336 index 3f85429ea77ee6..61bc08d3cc818f 100755 --- a/tests/xfs/336 +++ b/tests/xfs/336 @@ -9,21 +9,22 @@ . ./common/preamble _begin_fstest auto rmap realtime metadump prealloc -# Override the default cleanup function. _cleanup() { cd / - rm -rf "$tmp".* $metadump_file + rm -rf "$tmp".* + _xfs_cleanup_verify_metadump } -# Import common functions. . ./common/filter +. ./common/metadump _require_command "$XFS_MDRESTORE_PROG" "xfs_mdrestore" _require_realtime _require_xfs_scratch_rmapbt _require_test_program "punch-alternating" _require_xfs_io_command "falloc" +_xfs_setup_verify_metadump rm -f "$seqres.full" @@ -34,16 +35,13 @@ cat $tmp.mkfs > "$seqres.full" 2>&1 _scratch_mount blksz="$(_get_file_block_size $SCRATCH_MNT)" -metadump_file=$TEST_DIR/${seq}_metadump -rm -rf $metadump_file - echo "Create a three-level rtrmapbt" -# 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. +# inode core size is at least 176 bytes; btree block header is 64 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_ptrs=$(( (blksz - 56) / 56 )) -bt_recs=$(( (blksz - 56) / 32 )) +i_ptrs=$(( (isize - i_core_size) / 48 )) +bt_ptrs=$(( (blksz - 64) / 48 )) +bt_recs=$(( (blksz - 64) / 24 )) blocks=$((i_ptrs * bt_ptrs * bt_recs)) _require_fs_space $SCRATCH_MNT $(( (2 * blocks * blksz) * 5 / 4096 )) @@ -56,20 +54,10 @@ $XFS_IO_PROG -f -R -c "falloc 0 $len" -c "pwrite -S 0x68 -b 1048576 0 $len" $SCR echo "Explode the rtrmapbt" $here/src/punch-alternating $SCRATCH_MNT/f1 >> "$seqres.full" $here/src/punch-alternating $SCRATCH_MNT/f2 >> "$seqres.full" -_scratch_cycle_mount - -echo "Create metadump file" _scratch_unmount -_scratch_xfs_metadump $metadump_file -a -o -# Now restore the obfuscated one back and take a look around -echo "Restore metadump" -SCRATCH_DEV=$TEST_DIR/image _scratch_xfs_mdrestore $metadump_file -SCRATCH_DEV=$TEST_DIR/image _scratch_mount -SCRATCH_DEV=$TEST_DIR/image _scratch_unmount - -echo "Check restored fs" -_check_scratch_fs $TEST_DIR/image +echo "Test metadump" +_xfs_verify_metadumps '-a -o' # success, all done status=0 diff --git a/tests/xfs/336.out b/tests/xfs/336.out index aa61973da3e844..aeaffcbbbbd13b 100644 --- a/tests/xfs/336.out +++ b/tests/xfs/336.out @@ -3,6 +3,4 @@ Format and mount Create a three-level rtrmapbt Create big file Explode the rtrmapbt -Create metadump file -Restore metadump -Check restored fs +Test metadump From patchwork Wed Feb 19 01:04:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981360 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 3952B46B8; Wed, 19 Feb 2025 01:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927067; cv=none; b=Yh2tXHm4kWIA70eCrBbcqk6PNLUGyP35EuIqGit4HfVW+3zFGL6ZCVG8lgGW56n5ZFfacMb1k56Yj/DGhBcLr4xyvibZP8wH29fSojxVZH3UWYQNY+hMIOHYv8KT/gwyjw1smVwePKFA5m0BKVTuKg1ucf4qQDs9A3rkFm8fU6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927067; c=relaxed/simple; bh=h7g65ya5mmyPcqZEz07VTn3VcYc6Ouf+4KWupov03/U=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q7CZcpfPH8mCXMyLWEEUB+e1VCUI7MRuiptaTbrLZkc5zKSPTEO/T2s9QT/YAhralAK6YEt0MmWd8cVUhmg2QQdxafKNxrboyknh8lF7gXb4pssjAfBxjYZtO4LpRMgjKWt0xYRjwnI3DNT6fOnCPuJW6IPOMqpGawXCmhxeZqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LyxpC8Ib; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LyxpC8Ib" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0615C4CEE2; Wed, 19 Feb 2025 01:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927066; bh=h7g65ya5mmyPcqZEz07VTn3VcYc6Ouf+4KWupov03/U=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=LyxpC8IbKlZqfUZuhCQtNoemDf70S34AlVbqO5QDX28mRe5CNHwrXOU3L52Gtr8/4 wNXE6j4IkY7b8v0oX9XHYsjYulOuzirAz+g82GfyAJ8sT0PvxmOz896nSc4/1LWxBI U3R3p7iRdcLMyvCZY/9WotqWUpHxewdBuuAV4S4vexiT8FBLesDThzRprWLo1yryol W0VtePI6QvAu8g0TNuUlmF9gDAlsJ/ibUpdZEw3S8YO8aTWhu/huZmnjDmcOaT2wXd +CI/r1xT4Q4HIMqo1z61HrNW7qYH31rBVkfJ/euCCEuoVYeJdBP3PwobiGHKxansqW UbbBadaBs+8ig== Date: Tue, 18 Feb 2025 17:04:26 -0800 Subject: [PATCH 03/13] fuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591168.4080556.16741355731984742368.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 1a0ececde39422..1be8cbf1c563d9 100644 --- a/common/xfs +++ b/common/xfs @@ -1827,6 +1827,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="/rtgroups/%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 7a6e8bdb535237..0219f4a2f2562e 100755 --- a/tests/xfs/406 +++ b/tests/xfs/406 @@ -24,10 +24,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 035578b97b4793..1eff49218a86bf 100755 --- a/tests/xfs/407 +++ b/tests/xfs/407 @@ -24,10 +24,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 3c7d16f0e6c6b7..1d41fd0923ae4a 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 @@ -24,8 +24,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 f3885e56010daa..f863b3bd4530ce 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 @@ -24,8 +24,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 43eb14aafb2903..a3010a76177957 100755 --- a/tests/xfs/481 +++ b/tests/xfs/481 @@ -25,10 +25,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 2b08b9aab2bb01..d0386448564b7c 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 @@ -25,8 +25,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 Feb 19 01:04:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981361 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 BF6CE286292; Wed, 19 Feb 2025 01:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927082; cv=none; b=LZ4pZ2QeyszVfeHqM8HR2LAITTRY2/V2ChQd3i34O5P21VrbTKZ8I+1X16Z+pA2RtnTW+kjAo0YF5IqTNXRHGh/t7vf52kQyFwCa4OH+qAWUGJ93vGaNQcaziQRcf7YdHVPvo3TIwKOwnouk6eJmlgAYY5FqVBPh8zfKLH4zhsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927082; c=relaxed/simple; bh=Yk3T6iB+jUswyvSovc+Vb8HrmLsT2R0Gr/UMpW3hEwU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kHGPAvEEu4H/NIdpNH7PMmqi9bLFNFmvTWsnwb5fuVSr//BLRr8dIyDaOxDNdt8IcM38de6lk6adJSticilY4oCDPM2d8kQFSO0Xm37CDQzHIMi/fph4Nz4DqXGb/VjUMDTnSHAqN23y5JIsDaOsRSui4SavEht0SONvO8r8eDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hb/S+9g/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hb/S+9g/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECDFC4CEE2; Wed, 19 Feb 2025 01:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927082; bh=Yk3T6iB+jUswyvSovc+Vb8HrmLsT2R0Gr/UMpW3hEwU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=hb/S+9g/WqePClQ2Qg9ASQY16V02oVt5n2AMdEAL1zlQFBpNyc7UI3y8wTgGel4Oi HmHVtXuCfkhiKO7pes6vSq0ZQJAHz9AxVtWxjK2NO9MxsZhjlDiwvBp6C1seyI3AUo WAc4A37EY5rqJfxaPNpCQt0PxYnEOH753CmGYJ6LjjMvGy1D4bcMn/vA8Giy15Arva UD72jlT/v+yeB6uXuSi8TZBLYqsj0+0pfLMFFpvS1lZPMYjgmnb/QYMzLns3gHve/O 26m+umUgqa1S78R8GgT3yBAN8hYkFtlhRmQGCRzHEpis8isrHJWkje8h8PUOhbdM9o JhuJeCZSUeehQ== Date: Tue, 18 Feb 2025 17:04:41 -0800 Subject: [PATCH 04/13] xfs: race fsstress with realtime rmap btree scrub and repair From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591186.4080556.3392046573752829715.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- tests/xfs/1817 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/1817.out | 2 ++ tests/xfs/1821 | 45 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1821.out | 2 ++ tests/xfs/1857 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/1857.out | 2 ++ tests/xfs/1893 | 2 +- 7 files changed, 130 insertions(+), 1 deletion(-) 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 00000000000000..501aa2c8611196 --- /dev/null +++ b/tests/xfs/1817 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2025 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 fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/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 00000000000000..525ec14ed0f057 --- /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 00000000000000..3104dc7d9e5f37 --- /dev/null +++ b/tests/xfs/1821 @@ -0,0 +1,45 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2025 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 fsstress_online_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/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 + +if _xfs_has_feature "$SCRATCH_MNT" rtgroups; then + _scratch_xfs_stress_online_repair -s "repair rtbitmap %rgno%" +elif xfs_io -c 'help scrub' | grep -q rgsuper; then + _scratch_xfs_stress_online_repair -s "repair rtbitmap 0" +else + _scratch_xfs_stress_online_repair -s "repair rtbitmap" +fi + +# 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 00000000000000..0f18ad5d88ca70 --- /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 00000000000000..d07559f3974062 --- /dev/null +++ b/tests/xfs/1857 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022-2025 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 fsstress_online_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/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 00000000000000..b51ffd3f6cdd53 --- /dev/null +++ b/tests/xfs/1857.out @@ -0,0 +1,2 @@ +QA output created by 1857 +Silence is golden diff --git a/tests/xfs/1893 b/tests/xfs/1893 index d06687fa2a1087..1f04da0028a12a 100755 --- a/tests/xfs/1893 +++ b/tests/xfs/1893 @@ -46,7 +46,7 @@ done # Metapath verbs that take a rt group number for ((rgno = 0; rgno < rgcount; rgno++)); do - for v in rtbitmap rtsummary; do + for v in rtbitmap rtsummary rtrmapbt; do testio=$(try_verb "$v" "$rgno") test -z "$testio" && verbs+=("$v $rgno") done From patchwork Wed Feb 19 01:04:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981362 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 62808286292; Wed, 19 Feb 2025 01:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927098; cv=none; b=OCsO04Sm7RFvmxYm2Qq+rBUc3Q5lfWUSoVCO+hLUSrl6pJZlVC4tYWzhkf9LfXhqGGR/UlzgdY4j9jzw0Ohpl3M5/TCd2lFSS4/JQJPyF5ZWzQyMDitPi/tLMKdPUl72izLCrpVdCuKepE763RzWEWdoJ0uukvrJiHcYGeqcZ5Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927098; c=relaxed/simple; bh=lzbQ0ox2eOEz4+fZ2wUFaKNbGzg099XkBo7eTUb9aaQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bctud+3kFa++egGAYV9aQe1yItAfx2iSRiTNKBL7xqH9I6t7+lhJnGqm5Y4nz21spn1Lt7Lp7ybXG+re1VVQyvBnOcJBxti6YxcpqDULOvBrs7LO+7hWi6hOQpMK4msms3I2On+655T9DUJvW4ieUgkq4WPSeEQGcO9qLCVq0lo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NjWtutoj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NjWtutoj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D383EC4CEE2; Wed, 19 Feb 2025 01:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927097; bh=lzbQ0ox2eOEz4+fZ2wUFaKNbGzg099XkBo7eTUb9aaQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=NjWtutojUXv403EBq5UHJM4CNejeO5UYFfevXAxYbw1xNUlLZ+jKK3hHwhttBtgn3 NU3BnBZ0gXnPnuG5Hasckh9b+h5/Ceijg0YUrWb+0pmNrK0K0O1fQ7WCd5Z4HGdHVA FSgfeAwHUQS0vl8YLGXj37fr/xVMC6z6hAnlXoUrn+qJ5LkcQImylCWxyrNotch9WR /Z3YMK0nQTUwt2NQiEKHYSsJQw/cUAfX9U+sNmmoL++KuqDXS4ifC9uvTrQ8T7zmaQ AdnwT6cbzaXho76tU91BugIz16qgraY+fMTEtMSPamq+PSkp0gDlIjidXGpu+GfefC lQe6lU8RbMRlw== Date: Tue, 18 Feb 2025 17:04:57 -0800 Subject: [PATCH 05/13] xfs: fix various problems with fsmap detecting the data device From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591205.4080556.345335448207805708.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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 filesystems write a superblock header at the start of the rt device, so update these tests. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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 3e3ceec512421d..1d0edf67600aa5 100755 --- a/tests/xfs/272 +++ b/tests/xfs/272 @@ -55,7 +55,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 69de69d86cda9c..b675e79b249a5b 100755 --- a/tests/xfs/276 +++ b/tests/xfs/276 @@ -59,7 +59,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 5cb44c33e81570..87423b96454fa4 100755 --- a/tests/xfs/277 +++ b/tests/xfs/277 @@ -36,7 +36,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 Feb 19 01:05:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981363 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 01E5F286292; Wed, 19 Feb 2025 01:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927114; cv=none; b=tRjmohzwqLs5v5TddSAmLg3TRYqEZer7TUWoL3g2cRuD8y68UyGkI3nV9FeZ/9vCXsrgpyEAV1Jql6/5efGmCVGUoSYpjC9tNI+xauKq98fb5bsmPocMz/r/aoiOautcJ47C4ZoeBXk6PicDIeZifaIJW+VrV6UWyVejCghqzbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927114; c=relaxed/simple; bh=ABeLMAhOkE9cbF0HYyNr8T3r/c/c36CgzIjClyN8PUE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Btii0zDXha4V42fABlrn4f1z/2sETEv42qbk9YKBzkyOBb1nJjwYP6MVasDaUQUqcnS5Eshgww68OM2LXog3G/Z7cbCHSCVciAjRRjVT8E3fbhJCq8FaoYyRd8JymbM1dJpHw+uDOuP0EMQC44MNiYBDlFLuzu1sdbd54EqjCQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UljYS3Mz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UljYS3Mz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 702BFC4CEE2; Wed, 19 Feb 2025 01:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927113; bh=ABeLMAhOkE9cbF0HYyNr8T3r/c/c36CgzIjClyN8PUE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=UljYS3MzE9mIKEdcpi3oEQ3Vvd2/RBVQssZjd70He7wi6g7VMAtUZBYvqKCwcxvbO DmxG2GNGmqpFAIr0g/Dj+mnOS1P+dAE8qMwo25F97O/rvzSwJYPYyw27agjx7ylkpj dRyJFz6nUUTcdB39jpkE8oWtJwGqWfxLuRgWrt47kRMkhnWbS757vzRxLMD3NjCAWQ lFtG9Y9sFW3QhPQLDT2Ae8YfoI0tUsqlOWN6MYmwboilA8nIg/MNe3tc3Yaxkvqu6q 6Ipuxk7lzpEZ22EF5Gf3fdJf+nGAMWLdpruiw8j6NIp6PBxLJYOapZXbpRk3T9aVZT EXbkhgBvFydcQ== Date: Tue, 18 Feb 2025 17:05:13 -0800 Subject: [PATCH 06/13] xfs/341: update test for rtgroup-based rmap From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591223.4080556.9240285310117453482.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 e9aea42f429ffd..fd450135b45de3 100755 --- a/tests/xfs/341 +++ b/tests/xfs/341 @@ -30,10 +30,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)) @@ -55,10 +55,6 @@ _scratch_xfs_db -x -c 'path -m /rtgroups/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 75a5bc6c61191a..580d78895417c9 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 Feb 19 01:05:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981364 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 3EBD233E1; Wed, 19 Feb 2025 01:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927129; cv=none; b=lK08bZq4dIazZiPRaD3yw2kZCNTwkvJ/g6WAbmjmyzgpZg4Vj6N2VSgcKYiwGga2GlhwjSMunfqFcaoCTEUZM4mxjoZNkVCIS7W10RRwkRl1gntn6K3hNhcOaEgKSBg4RYFo5fz9XFwwvX57dhoQA4Pr0eokJiydxXw7U2809fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927129; c=relaxed/simple; bh=51My6Yz8u8TCfrys2FUYZ7haFXFP0ZDBf9M+3Zmm88I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YMyqqVvc1ZujYv0Xy6s0jeW+4ieUZGGOn8YFDs1E/R35D1dtL4Eojs87gYXSfdQHpWMKYdgXrH0N/Js3NzibcFAaOTVl8VMepX27BFo8/sf7KTpmw3c4Rqb3qZ+XFsHm10q5ypWrLAcwryREWeCMjcUaUFBpDHvmxo6OkYJee+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=otkXZgIh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="otkXZgIh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1552FC4CEE2; Wed, 19 Feb 2025 01:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927129; bh=51My6Yz8u8TCfrys2FUYZ7haFXFP0ZDBf9M+3Zmm88I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=otkXZgIh/lQDpDgxl5oVkzPwWGfqt3Gk6GpfE3huA2qvhcL29lef/BwBl5nqdBLje CNdY1IbM5WbpsL1Nw5ziCwCiv/WnJxB/jwbBsD2TLF8NoRu6VfJ8XcApLz+P4cBK/A KUGBGTZR23kaZn49Htq98ncsewpDMjvBx8QYnppHjDgtjz6cMmFQ/x58lhnEYOMSff 6wztetqq4f3JQEI8Xb9pa7+bnyiEheaiH3i6/bbaOPFV4amttKjvVl0BEPk1W8zQFd ytJeGGsc9DPbO2qLcYXjH6SvAe+5p/2EXEZz3naBs5qfen4h8ihPndpGED3qKmuEVA PBxmscExls/HA== Date: Tue, 18 Feb 2025 17:05:28 -0800 Subject: [PATCH 07/13] xfs/3{43,32}: adapt tests for rt extent size greater than 1 From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591239.4080556.3578802214204172288.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- 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 93c94bcdccf07e..fd91ebab164f34 100755 --- a/tests/xfs/332 +++ b/tests/xfs/332 @@ -26,7 +26,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)) @@ -43,10 +43,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 9beff7cc3704c0..3a7ca95b403e77 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 a5834cab123e7d..d5ac96d085ee6b 100755 --- a/tests/xfs/343 +++ b/tests/xfs/343 @@ -29,6 +29,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 Feb 19 01:05:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981365 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 3C6F9AD21; Wed, 19 Feb 2025 01:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927145; cv=none; b=COAZ7J96IWgC3Ld7dNLQFIzcIFEbwKl6MBUn/2LVu4R3JjlWYw0PQByvcxH1aDdWFo0X1XFjzMBqKSnmfuuMUioQk+WMn6Z35Hx1ufkXJ4VkHkx7BSOv1nWTJMLgiOryN+xT6Wl0P7gVb3Q23r3YFKSdfqQd7PEe7jLGNQt7wiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927145; c=relaxed/simple; bh=KmJL6a23nBzXecyC+5PvsCKQ+lzhfnxauKGFBbEGYW4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sL4QASYqjsygv2Tj8jwPV7Pc+Q+S1xJGdV5D+e0i7kwuvvr+vhMnMjp8JmZr9Ys+di/5wlFoCo6mwzC/oHtVPj9NAqq9t8J+2nx3EW4h0mEOkO5lpOeUGRBK03VjZYYNcXZnk40L2Ma6ZlAX2You1L9kEvNKlOImttM9hu0gAmM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CEn3nKy7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CEn3nKy7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADC97C4CEE2; Wed, 19 Feb 2025 01:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927144; bh=KmJL6a23nBzXecyC+5PvsCKQ+lzhfnxauKGFBbEGYW4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=CEn3nKy789rqndDNcCMqefJlDiz83hOghtltnWj73R3xDADG6aD1jnzw9pNTcuTwE Yc8/o+glfzZI5auSwwN34TuC1C2dlWwdisQLVsWULPrqlqBNg/7XuNEGeS5AMhd8YL xOXZjhoBUGWCMK0bs2eh/246BBQO35CqN6GyY9vhwpjMgahmYHsv+2HFcU6sB9dbTc X18uH550Ei/UN79vne6w9nbJYLiylPvXL16jzIcXi0QJeTi7tPcvFEpCQf3kFWK/Ql SLpJjuNCGNVzKH7vveZPK6DzhlMZ94CvdIVFcB7oPBRYmm4qFP/gIDNHzBwXwyHw9b SBj5FkuMEYRzw== Date: Tue, 18 Feb 2025 17:05:44 -0800 Subject: [PATCH 08/13] xfs/291: use _scratch_mkfs_sized instead of opencoding the logic From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591258.4080556.3753644406313565446.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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 _scratch_mkfs_xfs_sized accepts arbitrary mkfs arguments, this test doesn't need to open-code the helper just to add the dir block and log size arguments. Clean this up, which will also help us to avoid problems with rtrmap if the rt devices is large enough to cause format failures with the 133M data device size. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- tests/xfs/291 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/291 b/tests/xfs/291 index 777968a9240df6..1a8cda4efb3357 100755 --- a/tests/xfs/291 +++ b/tests/xfs/291 @@ -26,7 +26,7 @@ _xfs_setup_verify_metadump _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_sized $((133 * 1048576)) '' -n size=16k -l size=${logblks}b >> $seqres.full 2>&1 _scratch_mount # First we cause very badly fragmented freespace, then From patchwork Wed Feb 19 01:05:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981366 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 E5D0D1BDCF; Wed, 19 Feb 2025 01:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927161; cv=none; b=ICR8oZIVTruslrBuKywBdk63XCJ5tA6tjlILWkfX8fG3wFrK/5P/9CRFkHHSqmMs88wi0ZOndO9c96lNXt+TbJOIyXcJmRLl/S5S9Ey482/3k5mksoLo+LbhYMN17VJJGOk40fuVDc2J+SOkBTezxrXi84gHn6NRnBg1fWyEme8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927161; c=relaxed/simple; bh=shT/DFMZXyZzO9hua2+Jk4dp45ClIHw1gCYOX8cvR/w=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PLEeTIhAbKHwlA6petF0uOWICUYv2pb4S7Mao4XP/cIDlCCbleZzmVbKo/15WowT05HUNXpmeqM6fP7Zu0vYIPygW/qntZbK8wCwrw8XICQr38FVrNe+h13dt6zP5JtdVtrBqd7ma1P1SdGrQzg/MLLcqZUkW8q+FV9/CNb58dE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B6wUde4c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B6wUde4c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53BDFC4CEE6; Wed, 19 Feb 2025 01:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927160; bh=shT/DFMZXyZzO9hua2+Jk4dp45ClIHw1gCYOX8cvR/w=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=B6wUde4cFN3DMF4WuddOdQ7VYcnDD/JEJnZt8vCFURXHLMluoJRw2efhJ1kFHd8W0 4GzJv/K2r8WTdrhJOC0sMYdzGM9VDBl9eTp9sNT4NUSrAR9ujO4mSeV86Rx1bDCCyw lNB4ThOnmuw/DkAOIu4tQGtbnjWpuNBYJgDbJDOGaAQ069+TDm1fDNDV6xviKzKgJn YqnXTsvHB2o34WU24a0LDVcQv52xTIU+nj83DzTiRIPsYkpHRorKC/40QNpGLubDym jjJFb6NiqYszKvgn5SAjqjF7B/UXJL7dVSpA0Ldj8pf2moKbtmg5T6KCVgdZW0ySE2 Fmfzb7XDOsfbg== Date: Tue, 18 Feb 2025 17:05:59 -0800 Subject: [PATCH 09/13] xfs: skip tests if formatting small filesystem fails From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591276.4080556.2717402179307349211.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/104 b/tests/xfs/104 index cd625d6b74aaaf..e95a3b25c3e514 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" From patchwork Wed Feb 19 01:06:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981381 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 7BEFA28628D; Wed, 19 Feb 2025 01:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927176; cv=none; b=YUFemPAZOpqT0wPp0dYwoa/APA3oSLvX+YL/YtpHLdXiOgR3ARItZ5czxpd8BMT8GnIUbE7jKjOkOBZj/TPZQhq/8WwrLD0ADO8iIPZaQHag1cmMz8izMSroeUZ3a/fqUzdfhMov3ywXkR6f6aroasYFR2lTmJAEA7/GzfJB2O8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927176; c=relaxed/simple; bh=+SUfAL8wjjdlus8Hk1ECOxHa3I3B8xgeYisT8j1H03w=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q5JPCmghGye42aC/PFaayBiKoFyFRbHMLENz1zCuT4lKjW3e8vp4c4j8qh1q1SWdorOzNkpnBeJ1FN95r3UfM4wXEaovdxaUHIqv3hzxfJzzbNDoJHd7dmECYbdVheDriTI6gj/puS6Trq8NrfO7mYqqt7YVciAdCPISq0+N2m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=njUcYFB7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="njUcYFB7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFD4EC4CEE2; Wed, 19 Feb 2025 01:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927175; bh=+SUfAL8wjjdlus8Hk1ECOxHa3I3B8xgeYisT8j1H03w=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=njUcYFB7QafsvP/H2IqY3SRfazTDwgtBW/puthL4s60pAn2ViO1q0zrDaqY1XrRE4 IvtOHhxgwjzLvNmSzh6LYNDq1+OPnVv/zs8neuHxOP4Skuja5vTapY3c/ORms3qwNk dTmToxjhS8JstlHqeyq1P0XWSTNZ5/op+H8UFRTIUpPoEA2YbtFl7m3ExWW0NA85b4 OtNu+pZjuuS2BLoHK5SzeBd3pgElb1MtB5uuw7yh/0kzVeq/MgGmKX+U9VyFGVYRj0 pOqPZH5ExkhtWP89cYAx+/x2E7MXaItvBXu+A0I5jjeVdA4qdlY8uPaaSPznyKyXQi r6XuEHhOl9oNw== Date: Tue, 18 Feb 2025 17:06:15 -0800 Subject: [PATCH 10/13] xfs/443: use file allocation unit, not dbsize From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591294.4080556.4260451757807530626.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- tests/xfs/443 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/xfs/443 b/tests/xfs/443 index 8db51a834d094e..0e3c6519a3c0f7 100755 --- a/tests/xfs/443 +++ b/tests/xfs/443 @@ -38,14 +38,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 @@ -53,12 +54,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 "exchangerange $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 Feb 19 01:06:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981382 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 0D74828628D; Wed, 19 Feb 2025 01:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927192; cv=none; b=ETSBv3eXyvOYfC/RnKuYzXhzlPowSRvbFuENrlGDOXWiTaQd2p+CGglB2mjOgwKg0lDESXgOgeeD86IaSiR7hjW2GDIXuhgR2jpOpF7+UC0gKV0e+ZtQSP3W7m+ucNpFK1UsCT+DK63iJ3Hcu5TeWSNBMWoReoarwNMZDnrx8n8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927192; c=relaxed/simple; bh=usVYIugv9KwA/y9EWfVX3GZhu8a1LZP2vPwY2Ww+Dvs=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LHHZ62hS/iZJ6cDvz4XXiuzhsT80hgQaF4KEmDI6xLlmXhgSFxqWoJ9iL0podRta2No/DIz7MDmaPDpYQjBvGXxapF8jgd5sRtvqPzNYkiM29YIBG0tAaRuazi55aysSo5VAcg9BJUjBcQXlpUbxTNARLDU+nvIJGAe9gF+QNVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oNOwStNs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oNOwStNs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8281AC4CEE2; Wed, 19 Feb 2025 01:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927191; bh=usVYIugv9KwA/y9EWfVX3GZhu8a1LZP2vPwY2Ww+Dvs=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=oNOwStNsQlaJ+3TYdKcHqJGBZbBVw95SKyEZBgeehJ/fzB7OZoB5LC1q3TzUlhZJc 96oPRADYE7u8L8uetAm5RKDSJbhz5Q1ejCvmVM/mhL8ye5/JcSWxhobCvB8gAFfAL7 1FBVce9Rv2BO8/UIGUerSr4AUuhEVIoDJGF6fVu4cdpnuXMsnkjaGRJ6jGZX5evsmT jkNBswp6Fxbmb2/gw3UdlBeFXvPkkW4ALLbhYW9MChSTF46N4iipHodFp/WxPTAo5q VeLIcllMBNhXqQ0v3X9OCwdUYk8IrS0ZC/V1/zI6ZQ3KwYNdbnOuakQ16vWEXuMgXL LyLp8MxSEFLFw== Date: Tue, 18 Feb 2025 17:06:31 -0800 Subject: [PATCH 11/13] populate: adjust rtrmap calculations for rtgroups From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591313.4080556.12323562393894296677.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/populate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/populate b/common/populate index ade3ace886f4d4..1741403fafd9aa 100644 --- a/common/populate +++ b/common/populate @@ -463,7 +463,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 Feb 19 01:06:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981383 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 B6D921E4AB; Wed, 19 Feb 2025 01:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927207; cv=none; b=BV00a8Zz0XhIvjx0vTYGx1bYVSV0+8jQSFJK3Csdx87ZpYGJPDnVgUHFwGk1lrx7mq2YzJEETI1jRYClELg00YwDzqLUYIlOfhIDaOzjYqiMrp8k9VA9axCGzw/2FGfckK483hNjYWlLrOcIJk5l+Zn7Ogkz1mDtobLnEPZuIYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927207; c=relaxed/simple; bh=hKos3fui9F2+OmCnT6yWsN51EouiC6jy3WG+gpfAY0M=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VWKdNZdQ1PTBm3QfhY67FZD0TZjIae8BszZkWfGa/zgwRsXmmkDltHR5J9Asotutxm6RfRtBC1i4V45/GX4oFeOxxA2WsVmqmEKDr18IbE/T+MCoPoXfwwSpBXzQoIoCpc7d9Z+P9yvLAPJSVZ4E1cfpapH8ovLrBrb4bHjs198= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UEJulNSL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UEJulNSL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F0EC4CEE2; Wed, 19 Feb 2025 01:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927207; bh=hKos3fui9F2+OmCnT6yWsN51EouiC6jy3WG+gpfAY0M=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=UEJulNSLyFTck6UqM28lGJ2l8Wg52rPJgSUK34x0pETRurdxcSGnZzTeHl1QqK/UY va4QcxZJN2LGMyy25UNsyJdgC9UQowwSu2gupMRH16PwQFARTsftPBw2jlmDzVpTfG Y9rbchodl53reEHNc9gzR6Dad2ftQ02E4w4PyyZ2m7RY/k7Gq6ltx5u2JE3hgyLNya vsS8ODBGRI3RbNXaHbeEqrE6+tyb370Jf1dGUZ6nYCm1YknJdS/zF+uLsYKvUUKg8f lGyRC5QAY9nrhU5pPdD+1gW25S8jIWl+KbAHixJWcoSHc57sGrMnmmHH3FtOQ5Xl4a ZDYRqBfavCcJA== Date: Tue, 18 Feb 2025 17:06:46 -0800 Subject: [PATCH 12/13] populate: check that we created a realtime rmap btree of the given height From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591331.4080556.11286805171906703815.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- common/populate | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/common/populate b/common/populate index 1741403fafd9aa..dd80f0796a4d36 100644 --- a/common/populate +++ b/common/populate @@ -766,6 +766,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="/rtgroups/%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 @@ -789,6 +820,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")" @@ -819,6 +851,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 Feb 19 01:07:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981384 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 E413228628D; Wed, 19 Feb 2025 01:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927223; cv=none; b=gSmmRuokm4Sp2GfpRNhjUFfKRlfFt4QTFydrL5gifIx72ZChPoz6uCi0hweKlgxBL4iAsC5wD3uz/vKxP7V9DGibDHUKcxNwK0zYWKdY2/3GdYF2YlN7w8u6ZYS6P3etKtUZuarnvKXnuxffrC1Nt5bOhCbXu73/fsSmqACp5Y0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739927223; c=relaxed/simple; bh=x4O8hj36ddzwoViWvcwqNTDa9dfOzV9ZP5ld/BkZOyY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mfdzkDtDEo2DLxD2VN6l4+pz8TpCoWpzFT6FFEPto61yCGPfDpLwMQQmNJhAVHTA8931H1yASQVKmLKbtuiZKudH3ABM6Bwda7Gj6/jaJqvV0JwGjZPpNDExPdR4Ejf0DDFkpMofkWqm35zerZmkR4xO57PZmxOgXyeZqMwb1h8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TGPIv0Lr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TGPIv0Lr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA7D2C4CEE2; Wed, 19 Feb 2025 01:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739927222; bh=x4O8hj36ddzwoViWvcwqNTDa9dfOzV9ZP5ld/BkZOyY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=TGPIv0LrLaXqBiPIwYl0Lq3fmEQS+uZ0T841eceKVj2GcRq8nN7C8IcoLCKRXH2jo UJ/n3FVy7+Arz3BU8UnB0Jg9ZjmM51kCY4oWLobZtIT+Y5BSsuEYHoNxEuqMSvW+Cd pFQx76Nq7/QxiHg1XOauxjVPRkCavUyoGgrCGXPjTMHqVspanIEBzOuFbaS3mAuviH unoLo6w/KJniJFNqoxYCLzQDV0zEg8KMbFDFz/tjWfWnSn9h7DxBG+CG/azLeyoCK9 LaNtVP2qGgWd3jir26Nc0+rwjKO36FClIqt04IOyDzxcfEjtJ4KxopbB/mfctZTvzZ wkUseFdpUEWgg== Date: Tue, 18 Feb 2025 17:07:02 -0800 Subject: [PATCH 13/13] fuzzy: create missing fuzz tests for rt rmap btrees From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992591349.4080556.636964987283271719.stgit@frogsfrogsfrogs> In-Reply-To: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> References: <173992591052.4080556.14368674525636291029.stgit@frogsfrogsfrogs> 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" Reviewed-by: Christoph Hellwig --- tests/xfs/1528 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/1528.out | 4 ++++ tests/xfs/1529 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1529.out | 4 ++++ tests/xfs/407 | 2 +- 5 files changed, 84 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 00000000000000..15420555ed89ac --- /dev/null +++ b/tests/xfs/1528 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 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 scrub repair fuzzers_bothrepair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_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 00000000000000..b51b640c40a268 --- /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 00000000000000..0a9cce43d831bc --- /dev/null +++ b/tests/xfs/1529 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 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 scrub repair fuzzers_bothrepair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_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 00000000000000..808fcc957f91e0 --- /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 1eff49218a86bf..a46ecb0cd5eb93 100755 --- a/tests/xfs/407 +++ b/tests/xfs/407 @@ -24,7 +24,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")