From patchwork Thu Jan 16 23:32:12 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: 13942663 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 75FA41F1506; Thu, 16 Jan 2025 23:32: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=1737070333; cv=none; b=bdtn5RE5DGBX5xKbltRzXa0S2CC1PDYIsQpY577mOunbkb86y+RHVKzlMnhEQDVGz7vxbhoyFyPvOdS/PVXQOi5Ky/Vcua4nAvvrYwFoYPHJ06KHCuufPabqBIZHE/Si8pSh5DR+iKtr7c0WjMJGA4+ii7Mn+Hdn8coE+ZJSoQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070333; c=relaxed/simple; bh=jWTgIPZulYRTdqG8E1uS+mbp2fiKKtVNN0C5jVOQFFw=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QDuaW/PfiX4fOiTtzeI/zbRFupajfj5cEWLqr5r9O/FPnZ9nW5TmTIJKRRjK9DfIuavpdeGWBYFhQhzHqxp/M6PYYxtbW66IfINFsNe8wEkft3rNipD4O7sWj673hc4E6URymn4siHf1NvjzAiisqALtvU+Gq/SdDYG33DjgYcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=id4+aG2k; 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="id4+aG2k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF023C4CED6; Thu, 16 Jan 2025 23:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070333; bh=jWTgIPZulYRTdqG8E1uS+mbp2fiKKtVNN0C5jVOQFFw=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=id4+aG2kfoNsaFdn70CKQTs5cf2EaLR7F7sgWvI07/x55z730RnLe5dNF/SYXEMXp cZLxMZ8Um+xwG9rb4rantZqxK0Ps5QxOo9bEKzIiQTYPzRNCEZfVxj6DAIvRaxQqr5 4VkARkKr+xebt+7/FOoID1anxJGpIqs1fuhJoRJx2qfrlQRQh5JftPWY98nc0Ydesi f/dnEKHP81jnOUA8u/bfLblfH7wAiJr39USoGJTCqKXyuDwAVSam2itp/0nb0LwEHZ Wl/V/ERpokA2+PrOmBmYI7UBtjR9N/38TnJeiQOdUbCY7KJFn418i8cm1Nu6YynvYU t/3f1rzIaJcOw== Date: Thu, 16 Jan 2025 15:32:12 -0800 Subject: [PATCH 01/11] various: fix finding metadata inode numbers when metadir is enabled From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975181.1928284.18198198372285762402.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong There are a number of tests that use xfs_db to examine the contents of metadata inodes to check correct functioning. The logic is scattered everywhere and won't work with metadata directory trees, so make a shared helper to find these inodes. Signed-off-by: "Darrick J. Wong" --- common/xfs | 21 +++++++++++++++++++-- tests/xfs/007 | 16 +++++++++------- tests/xfs/529 | 5 ++--- tests/xfs/530 | 6 ++---- tests/xfs/739 | 9 ++------- tests/xfs/740 | 9 ++------- tests/xfs/741 | 9 ++------- tests/xfs/742 | 9 ++------- tests/xfs/743 | 9 ++------- tests/xfs/744 | 9 ++------- tests/xfs/745 | 9 ++------- tests/xfs/746 | 9 ++------- 12 files changed, 48 insertions(+), 72 deletions(-) diff --git a/common/xfs b/common/xfs index c68bd6d7c773ac..092b3dc6f3bdc5 100644 --- a/common/xfs +++ b/common/xfs @@ -1406,7 +1406,7 @@ _scratch_get_bmx_prefix() { _scratch_get_iext_count() { - local ino=$1 + local selector=$1 local whichfork=$2 local field="" @@ -1421,7 +1421,7 @@ _scratch_get_iext_count() return 1 esac - _scratch_xfs_get_metadata_field $field "inode $ino" + _scratch_xfs_get_metadata_field $field "$selector" } # @@ -1891,3 +1891,20 @@ _wipe_xfs_properties() setfattr --remove="$name" "$1" done } + +# Return the xfs_db selector for a superblock-rooted metadata file on the +# scratch filesystem. The sole argument is the name of the field within the +# superblock. This helper cannot be used to find files under the metadata +# directory tree. +_scratch_xfs_find_metafile() +{ + local metafile="$1" + local sb_field + + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" + if echo "$sb_field" | grep -q -w 'not found'; then + return 1 + fi + echo "inode $sb_field" + return 0 +} diff --git a/tests/xfs/007 b/tests/xfs/007 index 2535f04cac36a5..e35a069f9bd5c5 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -21,6 +21,11 @@ _require_xfs_quota _scratch_mkfs_xfs | _filter_mkfs > /dev/null 2> $tmp.mkfs . $tmp.mkfs +get_qfile_nblocks() { + local selector="$(_scratch_xfs_find_metafile "$1")" + _scratch_xfs_db -c "$selector" -c "p core.nblocks" +} + do_test() { qino_1=$1 @@ -30,12 +35,9 @@ do_test() echo "*** umount" _scratch_unmount - QINO_1=`_scratch_xfs_get_sb_field $qino_1` - QINO_2=`_scratch_xfs_get_sb_field $qino_2` - echo "*** Usage before quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 _qmount echo "*** turn off $off_opts quotas" @@ -65,8 +67,8 @@ do_test() _scratch_unmount echo "*** Usage after quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 } # Test user and group first diff --git a/tests/xfs/529 b/tests/xfs/529 index 14bdd2eebf7047..aab8668c76f46c 100755 --- a/tests/xfs/529 +++ b/tests/xfs/529 @@ -161,9 +161,8 @@ done _scratch_unmount >> $seqres.full echo "Verify uquota inode's extent count" -uquotino=$(_scratch_xfs_get_metadata_field 'uquotino' 'sb 0') - -nextents=$(_scratch_get_iext_count $uquotino data || \ +selector="$(_scratch_xfs_find_metafile uquotino)" +nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/530 b/tests/xfs/530 index 95ab32f1e1f828..4a41127e3b820f 100755 --- a/tests/xfs/530 +++ b/tests/xfs/530 @@ -102,10 +102,8 @@ _scratch_unmount >> $seqres.full echo "Verify rbmino's and rsumino's extent count" for rtino in rbmino rsumino; do - ino=$(_scratch_xfs_get_metadata_field $rtino "sb 0") - echo "$rtino = $ino" >> $seqres.full - - nextents=$(_scratch_get_iext_count $ino data || \ + selector="$(_scratch_xfs_find_metafile "$rtino")" + nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/739 b/tests/xfs/739 index 52c90b91b218df..5fd6caa5bce2f8 100755 --- a/tests/xfs/739 +++ b/tests/xfs/739 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/740 b/tests/xfs/740 index fb616a16362a6c..c8990034773b32 100755 --- a/tests/xfs/740 +++ b/tests/xfs/740 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/741 b/tests/xfs/741 index ea1c2d98516fdb..96c2315c524311 100755 --- a/tests/xfs/741 +++ b/tests/xfs/741 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/742 b/tests/xfs/742 index bbc186f8472b64..301ae7b9574320 100755 --- a/tests/xfs/742 +++ b/tests/xfs/742 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/743 b/tests/xfs/743 index 8021d7ecdc9009..039624f711c0a6 100755 --- a/tests/xfs/743 +++ b/tests/xfs/743 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/744 b/tests/xfs/744 index 0e719dcebf03d2..13f63b9ceb1756 100755 --- a/tests/xfs/744 +++ b/tests/xfs/744 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/745 b/tests/xfs/745 index 3549ad08772c2c..56a6d58ef9f4ca 100755 --- a/tests/xfs/745 +++ b/tests/xfs/745 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/746 b/tests/xfs/746 index 5afc71ad19c6e6..935b2e5acba5d4 100755 --- a/tests/xfs/746 +++ b/tests/xfs/746 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done From patchwork Thu Jan 16 23:32: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: 13942664 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 B30941CEAD3; Thu, 16 Jan 2025 23:32:28 +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=1737070348; cv=none; b=nl3unaptolmf0LmAwAbbKtv43wrko4LUJqz+mD/NSOof/E4Ilvzq1UQZ0+tnULHeEr3Cj/td/lpMISOvfW34ICShYvpWoZV4s82IL7ZXeLm9ntuR+nL7vKo9oOWhcVpWTtoAEviGGwX2BPL0oi6wxp9l9SP2JY2B1UHh4WJSoKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070348; c=relaxed/simple; bh=HRHVDg5464kdEFenLG+y7WCFPUqFPxgG3cEfwnqHrZ0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t9FE/TeBIu7ATkX257HECo/RzDAG8a/1R02f1PCIMNWV1o+R5Bqm3JtZJVNF/KN2fWr7C6tDscVYOQVLFjWPhErjI275RuHBExSRfbp+9BmB3lwzgXhXL1SfzaR498LxMGMgOi6jDqALuZGxhenawenN86t46MdungAavQmONp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y31lauu8; 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="Y31lauu8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D43BC4CED6; Thu, 16 Jan 2025 23:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070348; bh=HRHVDg5464kdEFenLG+y7WCFPUqFPxgG3cEfwnqHrZ0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Y31lauu85AdWnMV9ALDHSl9kj9WdB90nH9kxSyZ+42yhMmfzWU2JwyFs5y+jzoX37 GMtXIQChMcBUryH4loVrIu+xNVT7SEVEQp2U2o1icV1xD6SOeBEwLxQbaJtxcbp4I0 bmfZQ+RJEmEIoTmjWHrzinkDTlMyPR4Fw6rHUPRAQ2bKdbw6BINnqDdZ//GWY3h9qg C152OwQxvniJLWayk/MraRKIkbB2gyUbY350ArtllnyaMkrvStgUaPk37faEN8XrrO ATFjOc1/z9N5eXRsAHncFKSUvIpjt2HGQNYqOxkgWi3WAXffLdDZgDqPCxurL8fWN0 mo+Q/F/Z/40Qg== Date: Thu, 16 Jan 2025 15:32:28 -0800 Subject: [PATCH 02/11] xfs/{030,033,178}: forcibly disable metadata directory trees From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975196.1928284.971193659670502234.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The golden output for thests tests encode the xfs_repair output when we fuzz various parts of the filesystem. With metadata directory trees enabled, however, the golden output changes dramatically to reflect reconstruction of the metadata directory tree. To avoid regressions, add a helper to force metadata directories off via MKFS_OPTIONS. Signed-off-by: "Darrick J. Wong" --- common/xfs | 25 +++++++++++++++++++++++++ tests/xfs/030 | 1 + tests/xfs/033 | 1 + tests/xfs/178 | 1 + 4 files changed, 28 insertions(+) diff --git a/common/xfs b/common/xfs index 092b3dc6f3bdc5..ee7fe7b92a4950 100644 --- a/common/xfs +++ b/common/xfs @@ -1908,3 +1908,28 @@ _scratch_xfs_find_metafile() echo "inode $sb_field" return 0 } + +# Force metadata directories off. +_scratch_xfs_force_no_metadir() +{ + # Remove any mkfs-time quota options because those are only supported + # with metadir=1 + for opt in uquota gquota pquota; do + echo "$MKFS_OPTIONS" | grep -q -w "$opt" || continue + + MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e "s/,$opt//g" -e "s/ $opt/ /g")" + MOUNT_OPTIONS="$MOUNT_OPTIONS -o $opt" + done + + # Replace any explicit metadir option with metadir=0 + if echo "$MKFS_OPTIONS" | grep -q 'metadir='; then + MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/metadir=[0-9]*/metadir=0/g' -e 's/metadir\([, ]\)/metadir=0\1/g')" + return + fi + + # Inject metadir=0 if there isn't one in MKFS_OPTIONS and mkfs supports + # that option. + if grep -q 'metadir=' $MKFS_XFS_PROG; then + MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" + fi +} diff --git a/tests/xfs/030 b/tests/xfs/030 index 7ce5ffce38693c..22fbdb2fdbc999 100755 --- a/tests/xfs/030 +++ b/tests/xfs/030 @@ -48,6 +48,7 @@ _check_ag() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir DSIZE="-dsize=100m,agcount=6" diff --git a/tests/xfs/033 b/tests/xfs/033 index d7b02a9c51b3f0..e0b0dd58212d61 100755 --- a/tests/xfs/033 +++ b/tests/xfs/033 @@ -51,6 +51,7 @@ _filter_bad_ids() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir # devzero blows away 512byte blocks, so make 512byte inodes (at least) _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null diff --git a/tests/xfs/178 b/tests/xfs/178 index a22e626706ec49..0cc0e3f5bb88b4 100755 --- a/tests/xfs/178 +++ b/tests/xfs/178 @@ -50,6 +50,7 @@ _dd_repair_check() # fix filesystem, new mkfs.xfs will be fine. _require_scratch +_scratch_xfs_force_no_metadir _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs # By executing the followint tmp file, will get on the mkfs options stored in From patchwork Thu Jan 16 23:32:43 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: 13942665 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 BDDBE1F151E; Thu, 16 Jan 2025 23:32: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=1737070364; cv=none; b=S2WgG9X8bjBtlTC/iAOuMTJJ5rcPnpJPBlrcbf4GSuEAdHAARu9QbH0IwLd8wPb5PqARHBfLu5OCkZ6aXFFklcoTvqG0kFza29WtgIqrMdkLJfxQjcbbKpNuFH+6hOTLu7OnVHdOy48z6r+4PcJBzkO3+MrRGcjyKQ8/tpMVPec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070364; c=relaxed/simple; bh=eGLYfSAS1jPiC8cDgTecQA3TB5seG3X1C2zFLDZPp44=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h1Tec/lajcgCCF91Ueop2zvvfXLhtBDk/j5QIqLVHV1aKl456HQwtQqk7qdYWnYBjNPVOLLvrp7hdLuf++sSZyZhfrp61CbaQwtpayMJE8FhYPZdwfD29HES4yTDym0Oet1A3v+kQrLBDUUAN0GQG3PYG33xeXMsihXcHdWPdLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eLcUV4bD; 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="eLcUV4bD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6247CC4CED6; Thu, 16 Jan 2025 23:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070364; bh=eGLYfSAS1jPiC8cDgTecQA3TB5seG3X1C2zFLDZPp44=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=eLcUV4bD5svNxjfEaQUFWL4V5ehmo44X9FQcVcgtpLVYRQP65WV9twe+9CJkkHNWU LcVL8g7ppYtmpl2c+pP+4gLnzRFvT3FjlwWxut3Z/mvOgIDPpv4itatXlm01F2EPfv Xouud8387VVb8eFnTIb1a8Gf7aLURwts0TFNM46AaQ35iHb2K71tI2U5UkmWJeg8dB EDlg2InCHRMCsNTzXB5PFXPcnQVyQ8WPan7nQgWpdxSg6izy4dl0tQu8lTQdecMCM3 YVlLdlTn+Wm/ciAEI6DbkKXkhf/OV6A4MP1v9qIMWItIgH5oaqaJG/ulygqV4j5ZsZ zGNfzL9F6rYeQ== Date: Thu, 16 Jan 2025 15:32:43 -0800 Subject: [PATCH 03/11] common/repair: patch up repair sb inode value complaints From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975212.1928284.8954448177376997104.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Now that we've refactored xfs_repair to be more consistent in how it reports unexpected superblock inode pointer values, we have to fix up the fstests repair filters to emulate the old golden output. Signed-off-by: "Darrick J. Wong" --- common/repair | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/repair b/common/repair index 0dae830520f1e9..a79f9b2b3571ce 100644 --- a/common/repair +++ b/common/repair @@ -28,6 +28,10 @@ _filter_repair() perl -ne ' # for sb /- agno = / && next; # remove each AG line (variable number) +s/realtime bitmap inode pointer/realtime bitmap ino pointer/; +s/sb realtime bitmap inode value/sb realtime bitmap inode/; +s/realtime summary inode pointer/realtime summary ino pointer/; +s/sb realtime summary inode value/sb realtime summary inode/; s/(pointer to) (\d+)/\1 INO/; # Changed inode output in 5.5.0 s/sb root inode value /sb root inode /; From patchwork Thu Jan 16 23:32: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: 13942666 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 ACDD11F1506; Thu, 16 Jan 2025 23:33: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=1737070380; cv=none; b=UZ2bDxfiTjWvmlAVgQeCYQR8/qxvOKaeASSaY2Et2D8F6LPCnw4iUjCxnFDwBnksc2Ih1LjntOP0f2wmZzxtmcztBwhsmdSYxdT4IGwCHuijlTIfAsyXsLIaN/E5ndRzhVSemYpiZKfU41AsV6Q4OfmhSlM3XzP9/okuSUGis2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070380; c=relaxed/simple; bh=fPByFgcfrXOKjgxEIczajVdAf9wwpSMjnthzSZtwCOY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AyBZQo5zt36ER3UC1AM39yu5oSrZg0sqSAkF3GZP/pOi8an5Hv7CUdz3vXdpUVuJLcXVOBV0AuNJUfDCOdGw8c9396xGYyBJUvmMBIlatdbW72Y6Ug+sKlrOanqEocLx8AYQ2z+4tzsq+KwNJD/RY+iq+2utLclh+FvIAcp7BnY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nwQnk/oo; 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="nwQnk/oo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AA78C4CED6; Thu, 16 Jan 2025 23:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070380; bh=fPByFgcfrXOKjgxEIczajVdAf9wwpSMjnthzSZtwCOY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=nwQnk/oo+F4Lu1Bels8U0wMD2f6TmOxupttpXfCogK4/5HhR2coj9caGOF3anQyuS 1lYT480AEFO1a8YvzmYaD3PeUnaemSfEEx0ndYwfxua7e5JqiyokkFPFjhbQEkXtJZ S6aes8WtMI2AD/ciq9GJ/o7q+ORZSwDlFOpwesMs1UPeg65HextsuH4IPwjYyA2xec 0tkhEKWT8ib2SyQ+OH8fjYq1MVYjIKXepoAwwUaJ87FZIZc/muYlGjdx11L8mL0GDq ItkUo9Lie2Ie8l6rPHxWVENXZzMzjoQe5/zOk7JdaWQVe8pzeQrVMWQUtF8GU5Ny7/ tnhn1ltLIZqfQ== Date: Thu, 16 Jan 2025 15:32:59 -0800 Subject: [PATCH 04/11] xfs/206: update for metadata directory support From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975227.1928284.672339443089833194.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Filter 'metadir=' out of the golden output so that metadata directories don't cause this test to regress. Signed-off-by: "Darrick J. Wong" --- tests/xfs/206 | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/206 b/tests/xfs/206 index 1297433188e868..ef5f4868e9bdca 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -63,6 +63,7 @@ mkfs_filter() -e "s/, lazy-count=[0-9]//" \ -e "/.*crc=/d" \ -e "/exchange=/d" \ + -e '/metadir=.*/d' \ -e 's/, parent=[01]//' \ -e "/^Default configuration/d" } From patchwork Thu Jan 16 23:33: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: 13942667 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 06D05158520; Thu, 16 Jan 2025 23:33: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=1737070396; cv=none; b=j0JkSRNn6SYWhelpGnjJC63qnDEKph8s/uOy/zZbu94+AcIDFUz//7DG/tfAKGPYuj0JBidQpQwXMTtqRBDXOOVxhaQ3fap5JGxJXOvU96PYNWtram9kYbSQYZfpKVjElfp27B7CKn+t76JsEmP2Udf5JLYG8A8kS9/Gu/miykQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070396; c=relaxed/simple; bh=kQKD2PPWqKkNFKzz61pe9WaIKW7eHNudoHNM+cqXayU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hqm61UlyNSryiqdk/uHMWbxWgQTRlFs1/M8kKZNnhweCBFi6TLlbj8p2uLwNZNofxCSbgcN7aJJZQP1yedvxwUXVDBhim/KNd/LYudCeaUBxEnyfNanp7O5V4N5svbmdWWftwp4L10M7KwjD6XiiHSZszEn4nvCF1DSdqF4LF6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sq72KKa0; 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="sq72KKa0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1554C4CEDF; Thu, 16 Jan 2025 23:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070395; bh=kQKD2PPWqKkNFKzz61pe9WaIKW7eHNudoHNM+cqXayU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=sq72KKa0MLFjFO2Jz07WD4h7ERDlZuLnzCOMdJ7Z1SL1lSVzGYcQwa0f9gzLJPdSE 2iuK+1kMIc+nGDc+utb5W1485lukmKqxuGNsMoeikp7CzmiWKRn67yx/mLP1dwxLyZ g2kXAhtjNR6NWPesFec+ZVQSGM3isB+vwFCAMeJnggEuSBOeEpstmxln/T9hfnTAGT n7NvX2wL+Tkpp1hC+Xtqr2Hatc7Y7mX5OqQAyGgiZWNnMxc2WMW3YAX96OBzPo0Efx AvBGEGclulFB6XxD3iB+45iDGzXKcnEwymYnoV9+DEsi+XjjNGG0mitjHwJotG7sYr an0fRGu46lDjg== Date: Thu, 16 Jan 2025 15:33:15 -0800 Subject: [PATCH 05/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975243.1928284.10227784414578717433.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Prior to the new metadir feature in XFS, the rtbitmap and rtsummary files were included in icount, though their bcount contribution is zero due to rt and quota not being supported together. With the new metadir feature in XFS, no files in the metadata directory tree are counted in quota. Hence we must adjust the icount of any quota report down by two to avoid breaking golden outputs. Signed-off-by: "Darrick J. Wong" --- common/filter | 7 +++++-- common/xfs | 29 +++++++++++++++++++++++++++++ tests/xfs/050 | 5 +++++ tests/xfs/153 | 5 +++++ tests/xfs/299 | 1 + tests/xfs/330 | 6 +++++- 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/common/filter b/common/filter index 7e02ded377cc9b..1ebfd27e898e01 100644 --- a/common/filter +++ b/common/filter @@ -624,11 +624,14 @@ _filter_getcap() # Filter user/group/project id numbers out of quota reports, and standardize # the block counts to use filesystem block size. Callers must set the id and -# bsize variables before calling this function. +# bsize variables before calling this function. The HIDDEN_QUOTA_FILES variable +# (by default zero) is the number of root files to filter out of the inode +# count part of the quota report. _filter_quota_report() { test -n "$id" || echo "id must be set" test -n "$bsize" || echo "block size must be set" + test -n "$HIDDEN_QUOTA_FILES" || HIDDEN_QUOTA_FILES=0 tr -s '[:space:]' | \ perl -npe ' @@ -636,7 +639,7 @@ _filter_quota_report() s/^\#0 \d+ /[ROOT] 0 /g; s/6 days/7 days/g' | perl -npe ' - $val = 0; + $val = '"$HIDDEN_QUOTA_FILES"'; if ($ENV{'LARGE_SCRATCH_DEV'}) { $val = $ENV{'NUM_SPACE_FILES'}; } diff --git a/common/xfs b/common/xfs index ee7fe7b92a4950..a16ec56df0f665 100644 --- a/common/xfs +++ b/common/xfs @@ -1933,3 +1933,32 @@ _scratch_xfs_force_no_metadir() MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" fi } + +# Decide if a mount filesystem has metadata directory trees. +_xfs_mount_has_metadir() { + local mount="$1" + + # spaceman (and its info command) predate metadir + test ! -e "$XFS_SPACEMAN_PROG" && return 1 + $XFS_SPACEMAN_PROG -c "info" "$mount" | grep -q 'metadir=1' +} + +# Compute the number of files that are not counted in quotas. +_xfs_calc_hidden_quota_files() { + local mount="$1" + + if _xfs_mount_has_metadir "$mount"; then + # Prior to the metadir feature, the realtime bitmap and summary + # file were "owned" by root and hence accounted to the root + # dquots. The metadata directory feature stopped accounting + # metadata files to quotas, so we must subtract 2 inodes from + # the repquota golden outputs to keep the tests going. + # + # We needn't adjust the block counts because the kernel doesn't + # support rt quota and hence the rt metadata files will always + # be zero length. + echo -2 + else + echo 0 + fi +} diff --git a/tests/xfs/050 b/tests/xfs/050 index 78303bf784d05e..1e40ab90a843e8 100755 --- a/tests/xfs/050 +++ b/tests/xfs/050 @@ -30,9 +30,14 @@ _require_scratch _require_xfs_quota _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/153 b/tests/xfs/153 index d5e43082c1cd35..2ce22b8c44b298 100755 --- a/tests/xfs/153 +++ b/tests/xfs/153 @@ -35,9 +35,14 @@ _require_idmapped_mounts _require_test_program "vfs/mount-idmapped" _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/299 b/tests/xfs/299 index 710eb89c2ac0e7..3986f8fb904e5d 100755 --- a/tests/xfs/299 +++ b/tests/xfs/299 @@ -155,6 +155,7 @@ _qmount_option "uquota,gquota,pquota" _qmount bsize=$(_get_file_block_size $SCRATCH_MNT) +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) bsoft=$(( 100 * $bsize )) bhard=$(( 500 * $bsize )) diff --git a/tests/xfs/330 b/tests/xfs/330 index d239a64085c76c..30c09ff5906e12 100755 --- a/tests/xfs/330 +++ b/tests/xfs/330 @@ -24,7 +24,10 @@ _require_nobody do_repquota() { - repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r + repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r | \ + perl -npe ' + $val = '"$HIDDEN_QUOTA_FILES"'; + s/(^root\s+--\s+\S+\s+\S+\s+\S+\s+)(\S+)/$1@{[$2 - $val]}/g' } rm -f "$seqres.full" @@ -33,6 +36,7 @@ echo "Format and mount" _scratch_mkfs > "$seqres.full" 2>&1 export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" _scratch_mount >> "$seqres.full" 2>&1 +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) quotacheck -u -g $SCRATCH_MNT 2> /dev/null quotaon $SCRATCH_MNT 2> /dev/null From patchwork Thu Jan 16 23:33: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: 13942668 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 10F20158520; Thu, 16 Jan 2025 23:33: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=1737070412; cv=none; b=iZvit4xEDjMVlVp4S1fo5fbqKCQvUbeXZWXiZQhIODydBov7T9ZOytFOG3DHtb8oRbboRB8h1nJ7VkHNe34z9hqP1r229zeQTqTFr4Xg9+j36X4ZoXpOT6863o9gNKkZkm1lUF7A03twmqhOxnzYgKi4vSM5WsRF+PNxvG9W0uM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070412; c=relaxed/simple; bh=/2aY3XYRd4ng7wBdqXkhNSTNmTbBnT3tX8K2CzM22rQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q8WhwUfa7u0Zr6y8Q74LvrrEldX9LaIwNwlLvrbbAW5VEoz4rcZg3yAyC1+gBBasozo7biV3WPneNuiI29tXi8pJz6Afnve0ky/mzjUrWeZ2qQOasiHtjzsVAKEm4ndD+beCfCsPsJb6IHJkYpsFa7Z6s/5knniP4AmaFsWeO9k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cu/5PaTp; 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="cu/5PaTp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BA9EC4CED6; Thu, 16 Jan 2025 23:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070411; bh=/2aY3XYRd4ng7wBdqXkhNSTNmTbBnT3tX8K2CzM22rQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=cu/5PaTpK97ldKVOVKI5NM7ghxCvw7v/RRmqiq7AfGKThqCZdHFIqjSVB4edIBE1I IotyDQCcYVbJEDT/QTWfIqu0Szkkksa2pfQuXVBrFwVQ9WzAznNeYj+Bf8x6jaaybR vsU7ml6S477voXOtJHo0lgINRvTEY9ouQaxYz1nEV/4NQGWAMDyC0BNLFIsEtgRzud voQRzcFhm+C5e3FTJiotmfw1WnwaK1thmh86iWnd2SVaMeHV6YdQKJjytSVFv7qGFG z+0h4C+qN8D/RtHoIMdgPY7fm7E9/1oszIbY2RSQ+ZgJn+JBdCUOgmmfGP3wu7Xg4t x6Y4nDWvpMBjg== Date: Thu, 16 Jan 2025 15:33:31 -0800 Subject: [PATCH 06/11] xfs/509: adjust inumbers accounting for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975258.1928284.5211483955090328413.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The INUMBERS ioctl exports data from the inode btree directly -- the number of inodes it reports is taken from ir_freemask and includes all the files in the metadata directory tree. BULKSTAT, on the other hand, only reports non-metadata files. When metadir is enabled, this will (eventually) cause a discrepancy in the inode counts that is large enough to exceed the tolerances, thereby causing a test failure. Correct this by counting the files in the metadata directory and subtracting that from the INUMBERS totals. Signed-off-by: "Darrick J. Wong" --- tests/xfs/509 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/xfs/509 b/tests/xfs/509 index 53c6bd9c0772a1..9b07fecc5d1a10 100755 --- a/tests/xfs/509 +++ b/tests/xfs/509 @@ -91,13 +91,13 @@ inumbers_count() bstat_versions | while read v_tag v_flag; do echo -n "inumbers all($v_tag): " nr=$(inumbers_fs $SCRATCH_MNT $v_flag) - _within_tolerance "inumbers" $nr $expect $tolerance -v + _within_tolerance "inumbers" $((nr - METADATA_FILES)) $expect $tolerance -v local agcount=$(_xfs_mount_agcount $SCRATCH_MNT) for batchsize in 71 2 1; do echo -n "inumbers $batchsize($v_tag): " nr=$(inumbers_ag $agcount $batchsize $SCRATCH_MNT $v_flag) - _within_tolerance "inumbers" $nr $expect $tolerance -v + _within_tolerance "inumbers" $((nr - METADATA_FILES)) $expect $tolerance -v done done } @@ -142,9 +142,28 @@ _require_xfs_io_command inumbers DIRCOUNT=8 INOCOUNT=$((2048 / DIRCOUNT)) +# Count everything in the metadata directory tree. +count_metadir_files() { + # Each possible path in the metadata directory tree must be listed + # here. + local metadirs=('/rtgroups') + local db_args=('-f') + + for m in "${metadirs[@]}"; do + db_args+=('-c' "ls -m $m") + done + + local ret=$(_scratch_xfs_db "${db_args[@]}" 2>/dev/null | grep regular | wc -l) + test -z "$ret" && ret=0 + echo $ret +} + _scratch_mkfs "-d agcount=$DIRCOUNT" >> $seqres.full 2>&1 || _fail "mkfs failed" _scratch_mount +METADATA_FILES=$(count_metadir_files) +echo "found $METADATA_FILES metadata files" >> $seqres.full + # Figure out if we have v5 bulkstat/inumbers ioctls. has_v5= bs_root_out="$($XFS_IO_PROG -c 'bulkstat_single root' $SCRATCH_MNT 2>>$seqres.full)" From patchwork Thu Jan 16 23:33: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: 13942669 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 9035E1F1529; Thu, 16 Jan 2025 23:33: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=1737070427; cv=none; b=DBPdhli4G+bIR0VOut2YQVd+FJjnMipjoLO76qLscV1jKjXfDAsAS8uD8P5ZtajcRvCrY9ccFLJFLUTry94bdkXTW4Rx6i9xaaLqkvKqHQ0Ie2GQWjgLcJFxXMjhvQJsJuC70AqBsGlQIF8KeHq7vQBmqI6U9mBDRuUuVKV62ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070427; c=relaxed/simple; bh=oC8CBSsQ8hfdJGmVqNS3FZyuYM77guWRvM0m54cqSg4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a83GzNsIaqumix6Rb6eFfLUO9bm6iyY0oGnpSCyoSfpQ+lKWD5SrEwiE+lNRcGO1cxSwdkOtH51TMYDQO2uPlwFGyXCBYTbo9BECFCNAH1xeA2cz7A3eA3gVdpDnTaNTbJe2V+EszooEEaAzFNXG8oG4uBgH5KeKFPhV7ZNUY04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E7gFXZ1C; 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="E7gFXZ1C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 198F2C4CED6; Thu, 16 Jan 2025 23:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070427; bh=oC8CBSsQ8hfdJGmVqNS3FZyuYM77guWRvM0m54cqSg4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=E7gFXZ1CzX9oVLRhnOMA19xiPdBl5Ll+zm6MkgQu6OKODtfn+mn999UPp6PNrGq5u zd6YGqd0pSyZyTpR/T1R1VKuF3B1dcCTWl7SUeQSrQMuTKnLLbm0FeIk91L6YBtQhZ JEP/55XEmFWPBfI6m/h9795d3i5Wi8tvAbPYs+X8JNZds6/SIxCQApjQ5BFd+4/RvH YtFrYS4OxT3GXdpCVxWAmGiNgWxF8HIfdMrGclcxWLs2wgBLj3NQ0Gs0Jkzne41FX6 NcSTONO5dWuo1ypGBbJSC3OB43OfY/zHu+XlRamfeTUBXvAH8HSVMBoRcwgkge9kXz fIKld2aBqjLIw== Date: Thu, 16 Jan 2025 15:33:46 -0800 Subject: [PATCH 07/11] xfs: create fuzz tests for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975274.1928284.1884490707781994968.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Create fuzz tests to make sure that all the validation works for metadata directories and subdirectories. Signed-off-by: "Darrick J. Wong" --- common/xfs | 22 ++++++++++++++++++++++ tests/xfs/1546 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1546.out | 4 ++++ tests/xfs/1547 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1547.out | 4 ++++ tests/xfs/1548 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1548.out | 4 ++++ tests/xfs/1549 | 35 +++++++++++++++++++++++++++++++++++ tests/xfs/1549.out | 4 ++++ tests/xfs/1550 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1550.out | 4 ++++ tests/xfs/1551 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1551.out | 4 ++++ tests/xfs/1552 | 34 ++++++++++++++++++++++++++++++++++ tests/xfs/1552.out | 4 ++++ tests/xfs/1553 | 35 +++++++++++++++++++++++++++++++++++ tests/xfs/1553.out | 4 ++++ 17 files changed, 328 insertions(+) create mode 100755 tests/xfs/1546 create mode 100644 tests/xfs/1546.out create mode 100755 tests/xfs/1547 create mode 100644 tests/xfs/1547.out create mode 100755 tests/xfs/1548 create mode 100644 tests/xfs/1548.out create mode 100755 tests/xfs/1549 create mode 100644 tests/xfs/1549.out create mode 100755 tests/xfs/1550 create mode 100644 tests/xfs/1550.out create mode 100755 tests/xfs/1551 create mode 100644 tests/xfs/1551.out create mode 100755 tests/xfs/1552 create mode 100644 tests/xfs/1552.out create mode 100755 tests/xfs/1553 create mode 100644 tests/xfs/1553.out diff --git a/common/xfs b/common/xfs index a16ec56df0f665..1c5daaa977aef1 100644 --- a/common/xfs +++ b/common/xfs @@ -1962,3 +1962,25 @@ _xfs_calc_hidden_quota_files() { echo 0 fi } + +_require_xfs_mkfs_metadir() +{ + _scratch_mkfs_xfs_supported -m metadir=1 >/dev/null 2>&1 || \ + _notrun "mkfs.xfs doesn't have metadir features" +} + +_require_xfs_scratch_metadir() +{ + _require_xfs_mkfs_metadir + _require_scratch + + _scratch_mkfs -m metadir=1 &> /dev/null + _require_scratch_xfs_features METADIR + _try_scratch_mount + res=$? + if [ $res -ne 0 ]; then + _notrun "mounting with metadir not supported by filesystem type: $FSTYP" + else + _scratch_unmount + fi +} diff --git a/tests/xfs/1546 b/tests/xfs/1546 new file mode 100755 index 00000000000000..482ea0ef6ea6be --- /dev/null +++ b/tests/xfs/1546 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1546 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers scrub fuzzers_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1546.out b/tests/xfs/1546.out new file mode 100644 index 00000000000000..b72891a7583c04 --- /dev/null +++ b/tests/xfs/1546.out @@ -0,0 +1,4 @@ +QA output created by 1546 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1547 b/tests/xfs/1547 new file mode 100755 index 00000000000000..f9ad773b6c7de6 --- /dev/null +++ b/tests/xfs/1547 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1547 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers repair fuzzers_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1547.out b/tests/xfs/1547.out new file mode 100644 index 00000000000000..983cc01343e5f4 --- /dev/null +++ b/tests/xfs/1547.out @@ -0,0 +1,4 @@ +QA output created by 1547 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1548 b/tests/xfs/1548 new file mode 100755 index 00000000000000..010841b6cbf955 --- /dev/null +++ b/tests/xfs/1548 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1548 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers fuzzers_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1548.out b/tests/xfs/1548.out new file mode 100644 index 00000000000000..9e395bb059436d --- /dev/null +++ b/tests/xfs/1548.out @@ -0,0 +1,4 @@ +QA output created by 1548 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1549 b/tests/xfs/1549 new file mode 100755 index 00000000000000..f02513a0afd225 --- /dev/null +++ b/tests/xfs/1549 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1549 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers scrub repair fuzzers_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1549.out b/tests/xfs/1549.out new file mode 100644 index 00000000000000..22b3d215e32e7b --- /dev/null +++ b/tests/xfs/1549.out @@ -0,0 +1,4 @@ +QA output created by 1549 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1550 b/tests/xfs/1550 new file mode 100755 index 00000000000000..cbd6c7207a36f4 --- /dev/null +++ b/tests/xfs/1550 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1550 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers scrub fuzzers_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1550.out b/tests/xfs/1550.out new file mode 100644 index 00000000000000..7694cd670bd25b --- /dev/null +++ b/tests/xfs/1550.out @@ -0,0 +1,4 @@ +QA output created by 1550 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1551 b/tests/xfs/1551 new file mode 100755 index 00000000000000..fbce8c9fdc2a75 --- /dev/null +++ b/tests/xfs/1551 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1551 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers repair fuzzers_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1551.out b/tests/xfs/1551.out new file mode 100644 index 00000000000000..4c3360d08b34f8 --- /dev/null +++ b/tests/xfs/1551.out @@ -0,0 +1,4 @@ +QA output created by 1551 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1552 b/tests/xfs/1552 new file mode 100755 index 00000000000000..023284dfca8e2c --- /dev/null +++ b/tests/xfs/1552 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1552 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers fuzzers_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1552.out b/tests/xfs/1552.out new file mode 100644 index 00000000000000..6636b1b656c926 --- /dev/null +++ b/tests/xfs/1552.out @@ -0,0 +1,4 @@ +QA output created by 1552 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1553 b/tests/xfs/1553 new file mode 100755 index 00000000000000..a82b3be2f59b5f --- /dev/null +++ b/tests/xfs/1553 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1553 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers scrub repair fuzzers_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1553.out b/tests/xfs/1553.out new file mode 100644 index 00000000000000..0298fcfddbf15a --- /dev/null +++ b/tests/xfs/1553.out @@ -0,0 +1,4 @@ +QA output created by 1553 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir From patchwork Thu Jan 16 23:34: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: 13942670 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 49E611F153D; Thu, 16 Jan 2025 23:34: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=1737070443; cv=none; b=Iy7Hs8871HAeXLBB0GAdwYw52WjBiRJrfW+XSR6pipUzseJ6/WZp95OrrOVNoBS1hXkbglPhmgmwg3414nANLZveAX++8+AaPYo/+e33nd1TuAmfcz+qY8c3HPfHLRzgj24hFrJI6qAFdp5osA+A7JPEQWbFdwGdw6ythqAObqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070443; c=relaxed/simple; bh=IifR8vjFBLOTcIWgGqWJQLnSreQDquGjh+9n+9XMPuQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RzFBMWvPFoP9Uqj0Io/FEva7q5kT7rnx6PUBOAdh9ozQY51tkTNC6nb4v3imIHG3nK6Hg1vLAkeY8i4J+dJ1d4lu+IW0PUober06Z91jzvMrxXrvrqpq1JT4GqzDj8STCaJ/BCN6oHh+JKMT1kNFlrYAl7Ia2BcPPYQjNQljW6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oEe9PjTq; 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="oEe9PjTq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B846FC4CED6; Thu, 16 Jan 2025 23:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070442; bh=IifR8vjFBLOTcIWgGqWJQLnSreQDquGjh+9n+9XMPuQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=oEe9PjTqZSywuxa4dyxzHp1wtnNWj4HC869r5RjC8c7YLf9122WLH6S3wbELVMd3R X4N0anlG+yV6ku1zAG98YyMFNdGLoCxJf4JjS0Ht/RiuJ3lNrTwNuhz7mHKX+a0a0F NjzVT2vU4tNsIgf97vMonQsNczOy5GxnouLyeP+ZxOnVKzMdwMUMgDySTKeLbxFJ+g MiK7rTh7hRN6eUJkdvu4yiNaHv/GYS52/nVj40NnwVpPW2idaXe7Ay3uMByULPcstA y34iZGxuI77fDvBzaJJzOGtBVc4JaFDI6dDS8FzHIMbaZkdaMcFPPQ0aBBR+BLKrS0 hMQNc4EVmDG0w== Date: Thu, 16 Jan 2025 15:34:02 -0800 Subject: [PATCH 08/11] xfs/163: bigger fs for metadir From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975289.1928284.8057584815780423729.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Adjust filesystem size up so we can pass this test even with metadir and rtgroups enabled. Signed-off-by: "Darrick J. Wong" --- tests/xfs/163 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/163 b/tests/xfs/163 index 75c3113dc2fd03..015a82cdffaa68 100755 --- a/tests/xfs/163 +++ b/tests/xfs/163 @@ -42,7 +42,7 @@ echo "Format and mount" # agcount = 1 is forbidden on purpose, and need to ensure shrinking to # 2 AGs isn't feasible yet. So agcount = 3 is the minimum number now. -_scratch_mkfs -dsize="$((512 * 1024 * 1024))" -dagcount=3 2>&1 | \ +_scratch_mkfs -dsize="$((900 * 1024 * 1024))" -dagcount=3 2>&1 | \ tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs t_dblocks=$dblocks From patchwork Thu Jan 16 23:34:17 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: 13942671 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 F119D1F3FC0; Thu, 16 Jan 2025 23:34:18 +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=1737070460; cv=none; b=eJDBO/+d3P3fn/iQSLmAi2/4+aDhhW3q7WA1ZwRmvBGezr9+9susqp5V7mJ3K2CNRS1JhwcZs/nlim+eqCWHEoETJ1YKmGwnFmTMM0kg+X0bt4uYTk8F31Q3i8xJmGySi7fSqSCtd5hU1nfOfmuWY35l/2/qM9S5hoU8cP7CInY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070460; c=relaxed/simple; bh=3QbeNl/V+p/fnJ42oucvesTX9fQDE5vnBewFl9gkrBg=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CMjpkfOnNH9OeZEYcHIGrM1YCzvccpzrbzvKgBXJLwpo//8IXalC2jesxeCPXfNBwoBv1FIcwAgM0uNoN+n0UCfl1PiuCLs7YMyFg3p3BU3hoJ7sFcOmfkEM8cgdDWupu2w7qAGA8rD2TfTkVuSXPlnqH/g4w4GaXQsTYn5YTno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sJBbv1a3; 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="sJBbv1a3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D17C4CED6; Thu, 16 Jan 2025 23:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070458; bh=3QbeNl/V+p/fnJ42oucvesTX9fQDE5vnBewFl9gkrBg=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=sJBbv1a3KUUJC//R3raJaS2G4P3+EU/30RuD0JJ4K0CUZFeOf+TT16sZDdNKOASxI /yM0CkNsWq9y5tKCYi05CMAz9gbgvXJdfYuDo7rLz3cM7sI+mgr53LygVxnYz7BLfp RhDE851nyfjA/xCpad9Naf8sDHY7YuyYvmTvzp21DRQIXg5cbqa/KNGl7h5COSPXnh iYcxppZ/ApkwdlPnAfHlLAM0Ko2chTGq8i/Yb6mSASyC2NarWldLCH1jzNgnn/vE+e cBYf/ompPUHpKHT+HRfPcpgezFz1rIMJLtnZ1kjcoomRz3IpX5VNZ+wqco/b/J9P21 wxGdoT2JFComA== Date: Thu, 16 Jan 2025 15:34:17 -0800 Subject: [PATCH 09/11] xfs/122: disable this test for any codebase that knows about metadir From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975304.1928284.3391584079916474820.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong All of the ondisk structure size checks from this test were copied to the build time checks in xfs_ondisk.h. This means that the kernel and xfsprogs build processes check the structure sizes, which means that fstests no longer needs to do that. Signed-off-by: "Darrick J. Wong" --- tests/xfs/122 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/xfs/122 b/tests/xfs/122 index a968948841de14..e96ef2fe93042b 100755 --- a/tests/xfs/122 +++ b/tests/xfs/122 @@ -15,6 +15,12 @@ _begin_fstest other auto quick clone realtime _require_command "$INDENT_PROG" indent +# We ported all the ondisk size checks to xfs_ondisk.h in both the kernel and +# xfsprogs libxfs when we added the metadir feature. If mkfs supports metadir +# then we don't have to run this test anymore. +$MKFS_XFS_PROG --help 2>&1 | grep -q metadir && \ + _notrun "struct size checks moved to libxfs/xfs_ondisk.h" + # Starting in Linux 6.1, the EFI log formats were adjusted away from using # single-element arrays as flex arrays. _wants_kernel_commit 03a7485cd701 \ From patchwork Thu Jan 16 23:34:33 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: 13942672 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 8D0AC158520; Thu, 16 Jan 2025 23:34:34 +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=1737070474; cv=none; b=lt8SPmMBUGy5P0B6B0giBwSJwtNSU3GMGqY1EP2Pze8P8kzeQaV2MuwDI2hOMRo1JAkFSIrHrapKqxpChqaWEdkcvaMFObNf0Mjgv23KybtWjh4rOcn13M8UqOP9RmwsceFSrC8EKWSsq9P+xpwB1IQreM8EUye04a27wgVFsGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070474; c=relaxed/simple; bh=cTN8QDFyMHsSG76d6Uok+F1oLjzK7k8DgxwBZ+h+YXA=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NkDcvM4iSETdQ90QgQ1+bPhm0ml95kei/qC/of+QUsefc1GQL7DDLDyGmTrXbCkTA2c3asoK4Z7nrk8Gbjm6ddlkieyHj1V3rz4AQ6mtkfIRMq7p35km/DfCfmEK5P986krECn+CbIDv0d/hPv4NBWS5kj+5Fvo6kYlE262mDss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DqGqZyUX; 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="DqGqZyUX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14A81C4CED6; Thu, 16 Jan 2025 23:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070474; bh=cTN8QDFyMHsSG76d6Uok+F1oLjzK7k8DgxwBZ+h+YXA=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=DqGqZyUXLFdRw7yMxLig0OVdZRCGP1tPr8ugWozQ41aFsZ+YxW8/POD+g80yevdes 46rV98UgykmKNsB2YnQcr8l939E+yE8H/LMPWCDx6Wli40B1f6/KER9B5KOO5PrKhT FuDzUJeeAT8tvgdu+9ITCMiKHAcpLhK+O/HUFscYCWgDDA1dib09wU0p3VpdGxd8Zl 3NFMe7KK9IkhfWaiTn/bpus2cx8sk/2Igm4tU51LCJmAli8VtFeycpuHyMuVDeTZ4J 9LgnKZU68UZ+MltbIOPdSgnWSZawVMxmqlC5Fs2QsKHEmIf2Bv2QVBslWTkQvSuDFJ pg9vIRlTQjXog== Date: Thu, 16 Jan 2025 15:34:33 -0800 Subject: [PATCH 10/11] scrub: race metapath online fsck with fsstress From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975320.1928284.12262575850185873579.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Add a pair of new tests to exercise fsstress vs. metapath repairs. Signed-off-by: "Darrick J. Wong" --- common/xfs | 3 ++ tests/xfs/1892 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1892.out | 2 ++ tests/xfs/1893 | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1893.out | 2 ++ 5 files changed, 140 insertions(+) create mode 100755 tests/xfs/1892 create mode 100644 tests/xfs/1892.out create mode 100755 tests/xfs/1893 create mode 100644 tests/xfs/1893.out diff --git a/common/xfs b/common/xfs index 1c5daaa977aef1..b8e24c2e0ce8fe 100644 --- a/common/xfs +++ b/common/xfs @@ -1664,6 +1664,9 @@ _xfs_filter_mkfs() if (/^realtime\s+=([\w|\/.-]+)\s+extsz=(\d+)\s+blocks=(\d+), rtextents=(\d+)/) { print STDERR "rtdev=$1\nrtextsz=$2\nrtblocks=$3\nrtextents=$4\n"; print STDOUT "realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX\n"; + } + if (/^\s+=\s+rgcount=(\d+)\s+rgsize=(\d+) extents/) { + print STDERR "rgcount=$1\nrgextents=$2\n"; }' } diff --git a/tests/xfs/1892 b/tests/xfs/1892 new file mode 100755 index 00000000000000..13310353564554 --- /dev/null +++ b/tests/xfs/1892 @@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1892 +# +# Race fsstress and metadata directory tree path corruption detector 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 + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null +. $tmp.mkfs +_scratch_mount + +verbs=() + +try_verb() +{ + $XFS_IO_PROG -x -c "scrub metapath $*" "$SCRATCH_MNT" 2>&1 +} + +# Metapath verbs that don't require arguments +for v in quotadir usrquota grpquota prjquota rtdir; do + testio=$(try_verb "$v") + test -z "$testio" && verbs+=("$v") +done + +# Metapath verbs that take a rt group number +for ((rgno = 0; rgno < rgcount; rgno++)); do + for v in rtbitmap rtsummary rtrmapbt rtrefcbt; do + testio=$(try_verb "$v" "$rgno") + test -z "$testio" && verbs+=("$v $rgno") + done +done +test "${#verbs[@]}" -gt 0 || _notrun "no metapath verbs detected" + +args=() +for v in "${verbs[@]}"; do + args+=("scrub metapath $v") +done + +echo "${verbs[@]}" >> $seqres.full +_scratch_xfs_stress_scrub "${args[@]}" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1892.out b/tests/xfs/1892.out new file mode 100644 index 00000000000000..afc84c43ed2dcc --- /dev/null +++ b/tests/xfs/1892.out @@ -0,0 +1,2 @@ +QA output created by 1892 +Silence is golden diff --git a/tests/xfs/1893 b/tests/xfs/1893 new file mode 100755 index 00000000000000..d06687fa2a1087 --- /dev/null +++ b/tests/xfs/1893 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024-2025 Oracle. All Rights Reserved. +# +# FS QA Test No. 1893 +# +# Race fsstress and metadata directory tree path 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 + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs | _filter_mkfs 2>$tmp.mkfs >/dev/null +. $tmp.mkfs +_scratch_mount + +verbs=() + +try_verb() +{ + $XFS_IO_PROG -x -c "repair metapath $*" "$SCRATCH_MNT" 2>&1 | \ + sed -e '/did not need repair/d' +} + +# Metapath verbs that don't require arguments +for v in quotadir usrquota grpquota prjquota rtdir; do + testio=$(try_verb "$v") + test -z "$testio" && verbs+=("$v") +done + +# Metapath verbs that take a rt group number +for ((rgno = 0; rgno < rgcount; rgno++)); do + for v in rtbitmap rtsummary; do + testio=$(try_verb "$v" "$rgno") + test -z "$testio" && verbs+=("$v $rgno") + done +done +test "${#verbs[@]}" -gt 0 || _notrun "no metapath verbs detected" + +args=() +for v in "${verbs[@]}"; do + args+=("repair metapath $v") +done + +echo "${verbs[@]}" >> $seqres.full +_scratch_xfs_stress_online_repair "${args[@]}" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/1893.out b/tests/xfs/1893.out new file mode 100644 index 00000000000000..64d6b1b2bcd09e --- /dev/null +++ b/tests/xfs/1893.out @@ -0,0 +1,2 @@ +QA output created by 1893 +Silence is golden From patchwork Thu Jan 16 23:34:49 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: 13942673 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 CDF721F153D; Thu, 16 Jan 2025 23:34:49 +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=1737070489; cv=none; b=LLXZTn/L8ZU8w9WQHA1TERkThJLkoi1okcnQfWA0aRhJ5B7rRIwngOH0S/TLxiuQwj18dM40NAjmyY2jiipFcZ74LM7HXbN6G+3MZJLFxBDbE/V61ahWNevsD4AUSPr2rPPI1VGuaxTCYSkZCbK6H/gBYdMh3s9MEYutND4bvlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737070489; c=relaxed/simple; bh=RlRxkb1fN1VvV9kTiHv/S/NWBIPfSDuW4PTCPAiPijE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gjVHqUhhHnEE67CcRoNsnDXi2CkXf5j/MhCh1GxoAUucdwijQs9TTwxD2VgJ5ASHVfUb1hKp0otNGY4ccSSrFzD72zzf25YTBWLPWlUU7nelfz1ErVjVDwFMxeY7l01WzK23IIuJ3QYqDn86ZpOsRUYy9Nv8TcLz8V3ACoTWEf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SyOLUncC; 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="SyOLUncC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4F17C4CED6; Thu, 16 Jan 2025 23:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737070489; bh=RlRxkb1fN1VvV9kTiHv/S/NWBIPfSDuW4PTCPAiPijE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=SyOLUncCIGj/cJ+ivObNoU4XN22C9B0FrR1BFJ4pqMeZehK52O5yMd5XqTX44e6RF pYNyAuJrgPA/KxAlUuOC86um+0mpoaoyqGghktMo1Vk64ggW1n6z2rTufuLME2ICYb SxBG2rtSGOKbZ6lbZFo0kKrZSj61u75Tw5f6Qxcwm/qK7rU5dZYz+Li2wAh5IWYZMS 3FJW76BC2gHJ1fgXhHQTxzUXNtIm2mWbUf8hwRbrfOBiZ5izrIWJtLPuphs/zO5sBx BPfUxpB9krBW6btDBQ9v+Fd+17rgXqxzN9tH2PFqVYRzfwq5x8U9gccmjzPBHZQW6T 2UxuMG6Pw/4iA== Date: Thu, 16 Jan 2025 15:34:49 -0800 Subject: [PATCH 11/11] xfs: test metapath repairs From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: hch@lst.de, fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <173706975335.1928284.10620285969077946573.stgit@frogsfrogsfrogs> In-Reply-To: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> References: <173706975151.1928284.10657631623674241763.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Functional testing for metadir path checking and repairs. Signed-off-by: "Darrick J. Wong" --- tests/xfs/1874 | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1874.out | 19 ++++++++ 2 files changed, 138 insertions(+) create mode 100755 tests/xfs/1874 create mode 100644 tests/xfs/1874.out diff --git a/tests/xfs/1874 b/tests/xfs/1874 new file mode 100755 index 00000000000000..2e1af9222fa0bf --- /dev/null +++ b/tests/xfs/1874 @@ -0,0 +1,119 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023-2025 Oracle. All Rights Reserved. +# +# FS QA Test 1874 +# +# Functional test of using online repair to fix metadir paths. +# +. ./common/preamble +_begin_fstest auto online_repair + +. ./common/filter +. ./common/inject +. ./common/fuzzy +. ./common/quota + +_require_xfs_db_command "link" +_require_xfs_db_command "unlink" +_require_scratch +_require_xfs_stress_online_repair + +prepare_fs() { + # Format filesystem + _scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full + _scratch_mount + + _require_xfs_has_feature "$SCRATCH_MNT" rmapbt + _require_xfs_has_feature "$SCRATCH_MNT" realtime + _require_xfs_has_feature "$SCRATCH_MNT" metadir + _require_xfs_has_feature "$SCRATCH_MNT" parent + + root_inum="$(stat -c '%i' $SCRATCH_MNT)" + __stress_scrub_check_commands "%dir%" '' '' 'scrub metapath' + _scratch_unmount + + # Stash the /rtgroups inode number and gen + rt_metadir_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups') + rt_metadir_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups') + + # Stash the /rtgroups/0.rmap inode number and gen + rbm_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups/0.rmap') + rbm_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups/0.rmap') + + # Fuzz parent pointer in rtgroup 0 rmap file + _scratch_xfs_db -x \ + -c 'path -m /rtgroups/0.rmap' \ + -c "write -d a.sfattr.list[0].parent_dir.inumber $root_inum" >> $seqres.full +} + +simple_online_repair() { + echo "check /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -c "scrub directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -c "scrub parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -c "scrub metapath rtrmapbt 0" $SCRATCH_MNT + + echo "check nlinks" | _tee_kernlog + $XFS_IO_PROG -c "scrub nlinks" $SCRATCH_MNT + + # Destroying a metadir path (e.g. /rtgroups/0.rmap) cannot be done + # offline because then the mount will fail. Hence we must use a + # specific sequence of online repairs to remove the metadir path link. + # Only then can we use the metapath scrubber to restore the link. + + # Force repair the parent directory. Since /rtgroups/0.rmap has a bad + # parent pointer, the "0.rmap" entry in /rtgroups will not be created. + echo "fix /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + # Force repair the parent pointer. Since the "0.rmap" entry in + # /rtgroups no longer exists and no other directories count the + # rtgroup 0 rmap as a parent, this will fail cross-referencing after + # the repair. + echo "fix /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + # Now that we've completely erased the /rtgroups/0.rmap path, check + # that the link is indeed lost, and restore the link. + echo "fix /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -x -c "repair metapath rtrmapbt 0" $SCRATCH_MNT + + # Make sure we're not missing any link count + echo "fix nlinks" | _tee_kernlog + $XFS_IO_PROG -x -c "repair nlinks" $SCRATCH_MNT +} + +echo Part 1: Use raw ioctls to detect the error and fix it. +prepare_fs +_scratch_mount +simple_online_repair +_check_scratch_fs +_scratch_unmount + +echo Part 2: Use xfs_scrub to detect the error and fix it. +prepare_fs +_scratch_mount +echo "fix with xfs_scrub" | _tee_kernlog +_scratch_scrub &>> $seqres.full +echo "xfs_scrub returned $?" >> $seqres.full +_check_scratch_fs +_scratch_unmount + +echo Part 3: Use xfs_repair to detect the error and fix it. +prepare_fs +echo "fix with xfs_repair" | _tee_kernlog +echo repair?? >> $seqres.full +_scratch_xfs_repair &>> $seqres.full +echo "xfs_repair returned $?" >> $seqres.full +_scratch_mount +_check_scratch_fs +_scratch_unmount + +echo "done with test" | _tee_kernlog +# success, all done +status=0 +exit diff --git a/tests/xfs/1874.out b/tests/xfs/1874.out new file mode 100644 index 00000000000000..ff4497363d8063 --- /dev/null +++ b/tests/xfs/1874.out @@ -0,0 +1,19 @@ +QA output created by 1874 +Part 1: Use raw ioctls to detect the error and fix it. +check /rtgroups dir +Corruption detected during cross-referencing. +check /rtgroups/0.rmap pptr +Corruption detected during cross-referencing. +check /rtgroups/0.rmap metapath +check nlinks +fix /rtgroups dir +fix /rtgroups/0.rmap pptr +Corruption remains. +Corruption still detected during cross-referencing. +fix /rtgroups/0.rmap metapath +fix nlinks +Part 2: Use xfs_scrub to detect the error and fix it. +fix with xfs_scrub +Part 3: Use xfs_repair to detect the error and fix it. +fix with xfs_repair +done with test