From patchwork Wed Feb 19 00:53: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: 13981279 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 A214319D8A7; Wed, 19 Feb 2025 00:53:43 +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=1739926423; cv=none; b=l8BwodyUYTZrIpMnlTcvq1NzAH6IOl3hIzgjQ5uHavkv8urqw7VejuZc+sAT7OgiooBS3qgo6C4iM8GIHLpcYF7thx0Wjb8ebor5L3y8IoNSKzHbm+YOIlSJ2e6/yyH2iJGS9rg3zFX9WGIYIB1j5lsImBH2e6xYViH/DDrZMzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926423; c=relaxed/simple; bh=Q0fCkuWiQmIv1f+qdwLUbg3jMoYhHySOGpOu8ojCMAk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bKSj9JRluzBVSE1JTN6UkC7vg6Sm1uAvqMIidRWh0FuleRxNAQfeIvreZY+FlXU506qe4oqywOgO7QFG2sgnFITdj8/mnod2Slew3JwiWaahMzGbzKQGe93CjBbGQSnqo/AWKSEfmtM8DmnjzY9Ge22W6FoDcfXepRL4desKSQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WG+kAjcV; 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="WG+kAjcV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72E13C4CEE2; Wed, 19 Feb 2025 00:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926423; bh=Q0fCkuWiQmIv1f+qdwLUbg3jMoYhHySOGpOu8ojCMAk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=WG+kAjcVY1O5glFpSCOmoLL8H2MQdyhXsBqVLBtzl4P8LidRi3fEEnR/Y7VQ2rJgs SlA7GqgKb5jl92z0FW8ikbrM4kdw+PGMrsMS4PU0pv1xX+2cSJhj4GxyOriwd1jmzH ouT6rBVTwJVn+/li7sXjS1zEgdUSaueoa5yQZefFw346Mxpcp306m9iYYjfEodaUjp 66uOQMBKqPLEye7JoMzne8ZvkJYuOSwowtNGPt+3yqbhp4kgnbR04ZGUF2IckRCBzA 0AooeOed4W8TlJGW9PpvOGI1mh4wVPbwYP7cKcOhjG0Smhc21VNdiwHTu86lfTylP4 bTZa2ALMPYR3w== Date: Tue, 18 Feb 2025 16:53:43 -0800 Subject: [PATCH 01/12] 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, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992588079.4078751.10255522611762331320.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 0417a40adba3e2..02f569c971a194 100644 --- a/common/xfs +++ b/common/xfs @@ -1400,7 +1400,7 @@ _scratch_get_bmx_prefix() { _scratch_get_iext_count() { - local ino=$1 + local selector=$1 local whichfork=$2 local field="" @@ -1415,7 +1415,7 @@ _scratch_get_iext_count() return 1 esac - _scratch_xfs_get_metadata_field $field "inode $ino" + _scratch_xfs_get_metadata_field $field "$selector" } # @@ -1885,3 +1885,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 Wed Feb 19 00:53:58 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: 13981280 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 A2ED019D8A7; Wed, 19 Feb 2025 00:53:59 +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=1739926439; cv=none; b=FHDW/e/2EYCyttXGF29cQtvSw9JcqGH24OVnGDSnNj4YxTw8rGVCtWgCEmHWgNfwMfx3CW9Qzw3ftTI79JSXelOZaVz4VWAUbNbJbAkxOrxg7Mrmruyph27HbDN6dTCaBhePVaSghLP5ctA1rWtkZ9ipCceA7nR8XD5tNUeFxNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926439; c=relaxed/simple; bh=YrhNwxGuK96Y9/n5sgdzifTcaMto7KGJD6ganjgPFXU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rGVYRgfb1d8glHPv8e1SWGyq8UT320YRZeaqobI7qEU+veUC7903wwqZTCPAo8HXuqTwjFWvTad47yvGqj9pro5oJKLTlydmYo2HW59nPImUTE1C3xoXczEXdP6dhYMbBiC/eJy9Pr0e57vPZaIbdTnuJirs/tSdx1VAllFMWJk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZW9++Y9h; 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="ZW9++Y9h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 148C7C4CEE2; Wed, 19 Feb 2025 00:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926439; bh=YrhNwxGuK96Y9/n5sgdzifTcaMto7KGJD6ganjgPFXU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ZW9++Y9h1jjoMuxDE9pClOVIzyM4xdgKno+6D4s0NAwAgwK2H2SHFBWqrzX7OZyNS KBFtxxsnkBtlowsE+BtfNaGmp6TQsv+wmQCfH+F4VwRHl3GPwKMVpg2RE836l145ji cvix48z+zgfJVpn86Yb4eqUone/A1dN01Wg5KziGkdzFfQJMR9rvnvWnpNuiA3rCUc 7qxSO2wJEy126AxU4P6HQrEd8CyYBwoY1p1ag9WaDriDrm5o7BeHxCCmsxzTi86X6a hbZlk0oImEsaFzBMgedoH5mdG0mITJUGjG/wB6AaLL84EPldkww9X1n7YZeGnRvxc3 fOG0VQENtipeA== Date: Tue, 18 Feb 2025 16:53:58 -0800 Subject: [PATCH 02/12] xfs/{030,033,178}: forcibly disable metadata directory trees 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: <173992588098.4078751.13636667598878254024.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 02f569c971a194..85cd9a1348e385 100644 --- a/common/xfs +++ b/common/xfs @@ -1902,3 +1902,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 Wed Feb 19 00:54:14 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: 13981281 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 CF11319D8A7; Wed, 19 Feb 2025 00:54:14 +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=1739926454; cv=none; b=lpeNZaso6Yd1/slqAT7c3iV00jIq5CFV2inH62QU7sIZ99XyQHhGw5s63O8cmf47166pewTgm56KGjGiAIfjPsLNUxmH1OGdAT4eUnfsd4vyMINKUXEIcbPAjOHxw00bMRVXDvtqt089igAnOUInrLcFx6Pgs5qOIY+t2Sr48pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926454; c=relaxed/simple; bh=eGLYfSAS1jPiC8cDgTecQA3TB5seG3X1C2zFLDZPp44=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OKmAwC2rG/agD6gUVgHaQtiDbje3fRDWJ4qYkAL9SNeEx07ifglNLxQ7nkPWL4ciTC+miEgbiX3FDrqSXYHipwinvpBA54ba9y5KkeIAygb069eicBw1QNXeVr/GrpEBQbkMBC/ctgXFdQ2Ag3S1IvLM/f1mtUrFg9xqR3IN14Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hV8sRJsx; 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="hV8sRJsx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6576C4CEE2; Wed, 19 Feb 2025 00:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926454; bh=eGLYfSAS1jPiC8cDgTecQA3TB5seG3X1C2zFLDZPp44=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=hV8sRJsx7X1WNxoAibNDudp/0l9O7aKO/bN2kpoqisf/d+3ujF9+5txEp1yWbdokk YaK7WpP09qtSSVIHEDpiR6XKgTMpI51hBJjpzTykzIC+Ej8nvESupwIY7ZcY2g4V7Y mQcQIieo5MTsjdixeCxdqv8AOy++PyyMM/0CdVKq7D1pmCHdgrDMI4CukJGAL4SLVK WpDiF+0MVugeBLHKcqKYbpOGocgzQjDWC67SCTK3+hqj1Smsp5rKCwrpFeXLwkBRkU xmcDJeFHpd77UWBKdf3ZpBLrWF/uqEXB7frJh4SSlvz8907yJBlEYiXb/Ye8IEkE9Y V71HbhMPHyhJg== Date: Tue, 18 Feb 2025 16:54:14 -0800 Subject: [PATCH 03/12] common/repair: patch up repair sb inode value complaints 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: <173992588116.4078751.15663339276086108396.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:54:29 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: 13981282 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 70B012557A; Wed, 19 Feb 2025 00:54:30 +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=1739926470; cv=none; b=DNfa2MDKhG+AE0sRE+fu4JVJ1TUgcY2M3Q9H9c6+0wjlfGiO4hRWSOUkQSedEBkgdXc4N6ib6iRgFDvzbSGsCJTeM5h8BkV/vUZfzRqc+yPuKsxlzFFkVkP7LoPm3db1v+V6eZ43Uhar6rVVhaxY0+eEuy7Cmy5DUlefcw2zQRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926470; c=relaxed/simple; bh=fPByFgcfrXOKjgxEIczajVdAf9wwpSMjnthzSZtwCOY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dcQle8/JwtHUxLi3gYABfJFo98xaTLCtxAZb575iRdiW/lvzVC3dhBk6NakCSD8rO4xxW/xiPensAb+YonZoCnBk3xEuOn6orMfDM7ea7NLhd7rH2TAx8BbhotuSYNB0rPkrVKhkv8zhjmwPcmxjycU2ZHy1HfNKYqZ/ujc8xXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Uv0U3YHF; 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="Uv0U3YHF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47E1DC4CEE6; Wed, 19 Feb 2025 00:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926470; bh=fPByFgcfrXOKjgxEIczajVdAf9wwpSMjnthzSZtwCOY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Uv0U3YHFfTmeXNptj8yYt1zuXiYRPZ19+Po8j9beBqB0E6R9i8NhsU42DKzMN+6DO di/lQ5Vg8IoSk3fk5Xc/e97i1Vazz0OrzQQCQ44/3tdR+i0WUfQuuUgiy2LeZaksok TwR++5vaGBQnfYYMTqrez1xqPcW+Cjp0bGz2Gh2+bGESJlZUuBb4cxJm3kItfOqAIG 1WjRVpfBGxJDh2TLxLpygM4cUZ0YfkMNNMRtCUN4PgshBHr9vXBTz3xRxryP2bG+7x gfyTysfD9s46FKCrSgpqm1ESYKHalj8s8Assm2dMgUjS7ygkgRGXs8/ELFDU+m/g6T WnLfwJTeLlg1w== Date: Tue, 18 Feb 2025 16:54:29 -0800 Subject: [PATCH 04/12] xfs/206: update for metadata directory support 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: <173992588135.4078751.12082973016977797784.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 Filter 'metadir=' out of the golden output so that metadata directories don't cause this test to regress. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:54:45 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: 13981283 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 0AC6A2557A; Wed, 19 Feb 2025 00:54:46 +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=1739926486; cv=none; b=EGxFNJ6RB2kER5KZhiCcI+LFqq/SHMgpPmbYpvPVOTtF7anHNQayAsDGEe4trnf5IMBZXeMpwkcVBLSL5i1zK20FSsYxec0WSllNeQvRWoyojmMtmUnASsoygkeIdoFVxb/OW+ul3HBtLMARq9vPIOBsgLdjiQvP4jKknJga7x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926486; c=relaxed/simple; bh=SUPpXk+a9ACYvbNJhaVSc67+FpracQl3j4z2TJNdYXM=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LoJy75StxxHoAzSoKq6WYZPhowBGDdvURl4FkQb8TXZ8oh2Q5m7ii12ovcXYCP48S5NydtY1OHvEELVIgJ7V2CZ/M54hdbxLUlNDkkm3O2ha/ywMY6DOU65sHAcMXl5Iyn7m7WuCB01/2vwFpjyp97GBqJZVTDspUkmfSEJkUZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f/HMoQCY; 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="f/HMoQCY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5746C4CEE2; Wed, 19 Feb 2025 00:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926485; bh=SUPpXk+a9ACYvbNJhaVSc67+FpracQl3j4z2TJNdYXM=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=f/HMoQCYhBfFQKFyKim5ij/FV2wjM5v6PEJh6W5rZJquq5x4dRGptcsZ+TEzoc9iF MDz5JC/hQsrLYlMwm6iOM+3cBlJrMcfQ/vrfW6HSIXb9DSs9gGgU85dX1PT0Es6CRP RNa+tszCESR28wEbzTpo5oIWQc3DFMdaEreZyZe5c2agJrCirRoVoRKNE3DlvekZfm D1YZZFEhTpGJEWxxwrlo/HDHN8JbOSXcMkWLISoL0HZexWdJaKYar3bemrjKE8QIt0 gl5zwokPnASEzobG/7x7ympOy2Ura2JNdfxnqbOceFoJ3HqYVfKd5GZ8hr8yJxhrgI VAyecHLWUIUlw== Date: Tue, 18 Feb 2025 16:54:45 -0800 Subject: [PATCH 05/12] 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, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992588153.4078751.7769762708703860765.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 85cd9a1348e385..eb4d99c91a8019 100644 --- a/common/xfs +++ b/common/xfs @@ -1927,3 +1927,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 Wed Feb 19 00:55:01 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: 13981284 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 1911B1C28E; Wed, 19 Feb 2025 00:55:01 +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=1739926502; cv=none; b=t9zlAFf5WjncQ33qabdqb5VIaNNooBFgBRgiO5RoTXELfdKD+5U7U+wcWnYN5Sduk0nhgwP8zNrQX55NwuF3CgQ9fRtM1ccGMqfnQL5B9tXKoWC/rPRST2iKN5NKZPAoCRla82FpCCbRC2p6bxqqAT8ri8QyVaWkYnP5Si9lCl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926502; c=relaxed/simple; bh=/2aY3XYRd4ng7wBdqXkhNSTNmTbBnT3tX8K2CzM22rQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oVBv7cVaeXlte4zKL+K+1R5ghjClUmaQJb0u+gmfdYzHc8w4OXFkJdStwFiTrGk3U0x6EoYqce2c0D8U6PqFqqulMRbxjgXg+FfIwga1jKIbXsaYJXQkFz7zKYpKERfddD2roPVhfG4Fv7j+qPn2hyUnAELvi6xkpBdc2i3DiWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VHFGiVg7; 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="VHFGiVg7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75200C4CEE2; Wed, 19 Feb 2025 00:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926501; bh=/2aY3XYRd4ng7wBdqXkhNSTNmTbBnT3tX8K2CzM22rQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=VHFGiVg7IpHwP24uB5L7jHtdGefISLhB3BiUJ0CpBzx5wjTYsbSlXfS4OMnkij5ie iG4hcl913dStEUlRK2FDMTg2Bsqd39AiDPpyDUB01iO7rleYM8lPzY7PIFHSYEZKEK omysPc7JOtnhVYwGTd6EylvXQUWxlS0C4ZMvJR6C9dtoFTRpAVxUw0luKAdB2tun/2 jVR8ipdjCfejKF2fxbWgstRkYVCBQa7/ZeNbIbzBFaVoiySQvzTwOv+OeB8XV1Fg2/ 8YeplMrEz/4syMwGm45iIpgppENTxB8m6bqOjLHdF9LlVR1F7qNoVZjQxQksDZ6dwx /Fu0rqoENmNwA== Date: Tue, 18 Feb 2025 16:55:01 -0800 Subject: [PATCH 06/12] xfs/509: adjust inumbers accounting for metadata directories 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: <173992588171.4078751.10552424872825170445.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:55:16 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: 13981285 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 A75B9170A2C; Wed, 19 Feb 2025 00:55:17 +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=1739926517; cv=none; b=RN+slrRRITQBodlfaQjZtl3NNBNz5atl0zzmHLEFcEK1lm+eK2qa+kmK9F9GhQSswM0/XbhYMsdYnc+I9EBfsqe7EMQ35SS2XJeCCEnLSKP5Qfd9NpDA8ibTR47wkEe0botwGIhvMe7NIr0w3VN/t1xoFmRW+uUEgPRFIJsTMPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926517; c=relaxed/simple; bh=HhsEnFo5yEt0Q+ySMVgu4AD+C9O2PFp30OdJuh9Io2I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OjDnYbnBvZWOx6EmwKJyxeGz7uX1y9tFfm1OkKMJGfM983h4gi4Pz3kmp8jlNG0OtRM0XnByJwUK110E7k/+vIGDoB7YZRLsMxe3HhZKnsp/a20ItoazY4DOBtEukfutgkvAUhm90gF6UaFSn0+eSToBeGOZH7qqkcCuuLgsle8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TKgLKchj; 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="TKgLKchj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C738C4CEE2; Wed, 19 Feb 2025 00:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926517; bh=HhsEnFo5yEt0Q+ySMVgu4AD+C9O2PFp30OdJuh9Io2I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=TKgLKchj0M2J0iuQmqXSqUWCoYQm6TPNBN0iXLoiZBKXNpre4Sj53MnbvUWXZ3r2t iVCWfIYzImclgQKYVK8lB8sno1fsaANSmNe2iaxsRG+Pr870THAx5WNDMvfKCdrGoy 9E7aoNUalblBYYG1aDQsTkTZ0t5FXz0eL540jMwSuM7bSYkgN5WWf3qtuX6q3CRW+P r6tncOKT6vLGu1WDQmsowoyVNv/QNYN/7rHkKZYOW3kvuAMsnSBesqNqce83zZDSly Y9KFGizXslgowGVca9XI3aFjtfhTatDPbUyVpc4zQ2otHxvlGKK3ymHN6KMWNWpTXe TniUdByJUnBfQ== Date: Tue, 18 Feb 2025 16:55:16 -0800 Subject: [PATCH 07/12] xfs: create fuzz tests for metadata directories 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: <173992588190.4078751.15589074585657780588.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 Create fuzz tests to make sure that all the validation works for metadata directories and subdirectories. The metadir fuzzer tests are tagged 'realtime' to force creation of an interesting metadata directory tree full of rtgroups inodes. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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 eb4d99c91a8019..771ef90633c6de 100644 --- a/common/xfs +++ b/common/xfs @@ -1956,3 +1956,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..799c9f355c48a3 --- /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 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 '' '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..9175ff1e95e224 --- /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 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 '' '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..da0312d788cc3f --- /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 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 '' '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..ec5fd010fc7cc7 --- /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 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 '' '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..4350f69200541e --- /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 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 '' '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..7591411d4b638a --- /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 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 '' '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 Wed Feb 19 00:55:32 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: 13981286 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 DE78146B8; Wed, 19 Feb 2025 00:55:32 +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=1739926533; cv=none; b=oOptAd1Y4mk5MxGPCn4xrGhX7MxOacOOHJcWz04wwdfqqkwgYEWndC7Hl/reKGZIo7+Uet6n6/RYrRg5G7+PvuYds+oWhNLKJg4YdVx4Ojk8BQhsSPcALtIFlIfVeWAXr6L0z2+b14ipdHQnWp7f1Pl2+3yfPI5MizIJGemSSjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926533; c=relaxed/simple; bh=IifR8vjFBLOTcIWgGqWJQLnSreQDquGjh+9n+9XMPuQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a0VwFnuQV0eDV1DROl1LuYkMOC7tL5tjbRbtI4VI5PQ7CL5n2qyHGNsI5q9PwnLUVMCyS0yMbpnL2FRpdDSDH6N7tDhFqZ1rXhL8R7nfvKLqkzRTuDps9+n0OmzPUaoMHeXX8o9w8gWuOnAw7Vi+0kYYDr6gH0XdZ1u2w7AjBIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m97RZ45y; 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="m97RZ45y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B236BC4CEE2; Wed, 19 Feb 2025 00:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926532; bh=IifR8vjFBLOTcIWgGqWJQLnSreQDquGjh+9n+9XMPuQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=m97RZ45yD0hdQzUwEuJqvfu+zPfkhMzxeuVfH5sA8G4pN6j/B1HpXSFrZIW0qUsT9 ELnqPalER0TxhLT1BJr8gmZrTK7HLPbV7Pu7S0VISvLLmzuPkQA/KyicpqxIZcfqMU 7dhEKsIhc538BAqkVCsCDbIohgEdTXrKoWYP6J7rTmFUIpMP8o5q5bwHIYDg3XW8EM 8LuZSU+RIFIZc1UoDtrAC2TT4I3UpIO0iEWqUV42awpe2exsoHXFSfLbr9VBAz9mB4 3XMCj8QOnegGqYiRNNyDfT6mzhpI07+MgzF2oxeKAFTsz+BsSVAk5KM2FWR6W86qFW nOQ6IX+URQckg== Date: Tue, 18 Feb 2025 16:55:32 -0800 Subject: [PATCH 08/12] xfs/163: bigger fs for metadir 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: <173992588208.4078751.16040969808269964576.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 Adjust filesystem size up so we can pass this test even with metadir and rtgroups enabled. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:55:47 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: 13981287 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 8281846B8; Wed, 19 Feb 2025 00:55:48 +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=1739926548; cv=none; b=Fi4sITOa8wI3tAlUnYIIZyB9qBRXlogFf16+Y4ZCC8MM74gC5E1h2TCVrnKnUF0UAIebmWiP5ex0L519fpkSZVsPJ/75fZnCiXNZJwFwWA0+r2AHnhy6umx7gHTekEWoBVIKRoLNKavIc3DydeJCiMJLhiCe5krMCcTzuvCmG0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926548; 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=qH1Mt1InIJSOmICNUJ3E+bc0cpa0C9qyedpTL6K4gEKLlVAdkiW3qg9uT4wd3xo6Gz8OUhSIOhRX5chvzO36xrfdZO8DYytFJYGj/8MFyZdWgZOs4f19Qdxjo58LHh4/ocHwWVu/FTWCauFM3rujmZR6tofxV+RVqaqkR42mjlU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q6hPZN5y; 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="Q6hPZN5y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 587D8C4CEE2; Wed, 19 Feb 2025 00:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926548; bh=3QbeNl/V+p/fnJ42oucvesTX9fQDE5vnBewFl9gkrBg=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Q6hPZN5yLBybfmbOKIQmdXdcPu1aaVObz+w/+BW6mUqskMOp490GwhNG2w8jliibX Itjnqt/nyBlAfUqjLHnAGcvyeyHU4txnO//pL1i3wwoY8+5GkGSNkVI6qZr/PwTtAN rgXWLQFYfPI4nMRC6FEdkB/9g6wN1orj5AW1jeYKF/gXNkak9gfJwqPrQKC645HyeC zercdjEAfxkh5claluHBAeRF8tLrhxRj1FNlNu/6PntGHMeYtBjGv9lvfXBC4maBMF gnR6gzXCRuFYjZuiJLV1dGMxrJ/95PK3KmYvzY1cZYArLS58pF0okAGu+IbyHrEfrP ccSv+Uz7kHKDQ== Date: Tue, 18 Feb 2025 16:55:47 -0800 Subject: [PATCH 09/12] 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, linux-xfs@vger.kernel.org, fstests@vger.kernel.org Message-ID: <173992588226.4078751.3774851302421682128.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 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" Reviewed-by: Christoph Hellwig --- 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 Wed Feb 19 00:56:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13981308 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 8A9D625761; Wed, 19 Feb 2025 00:56:04 +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=1739926564; cv=none; b=RCj1Oj0gofSZdQOxu7is0twudYnnDeE00bF2AkykWItKl+iJiyk6zhdR/+sqxXw9NJGp6NaaqwDwpaA1ll/A9f1RZ3TmLBSIHn0DAeKEBC3buF098XXIy5aOcdM19m3UXCkpU6DMywjjIjf47Pt0UxRsZODSFsiGdu018N2TN/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926564; c=relaxed/simple; bh=Q8Njvk8D6kDQ3abzvEziLAnEihgS+6Zk+gKkrxLSflw=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=W+TMnTJ41vDqouXI6RUaaXtL3WAS/+lQS6wra4ue2NFdZRL2qSIPBKhGnWSupjRDpN8owsUy9as1v+6c/wUkYTdvVG4YmEC7VFv6xXbcQntoSG2mwZFsQ0DyoYS4aF/q3iVprDifGd6Jj4cWePP2orbXNOAXcOdSpRpgwjP0Jds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ttjaa0F8; 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="Ttjaa0F8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E85A4C4CEE2; Wed, 19 Feb 2025 00:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926564; bh=Q8Njvk8D6kDQ3abzvEziLAnEihgS+6Zk+gKkrxLSflw=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Ttjaa0F8TKL1+NQamXGeZT+9/Uf+H80frri32bkFdzKyu8xpV4XR5I5Yc58djWowF hcmsIxcu8MIcLnW7FMYXa6VTPlGk8SrIEJriwFHFx9llbH4w1Z35kHyrWREctBUCXz 3jIvmYwyrR9AR0s1RgrX0Ja9TSpLtDZb9hMdeFF8VYB8SE003q8lGXRs0X/Bc0BBVT 8es8k6chJOj9vRWtuPVWXqa1t0dfvKb1nju7EPzvh75eL5vr10r9dr1AnlSBJrNXsj 2uYQfyZ/B51mcSvZdJjPV68Fy0bEGwFNbw2mmAKzJ2XJyuULQjCXqbteJThVQ2W+hk 2GEhTNHdgh6ig== Date: Tue, 18 Feb 2025 16:56:03 -0800 Subject: [PATCH 10/12] common/populate: label newly created xfs filesystems 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: <173992588245.4078751.18091181818919832636.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 When we're creating fully populated filesystems, add an obviously weird label to the filesystem images so that it's obvious that it's a test filesystem. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- common/populate | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/populate b/common/populate index c907e04efd0ea9..7690f269df8e79 100644 --- a/common/populate +++ b/common/populate @@ -280,6 +280,10 @@ _scratch_xfs_populate() { esac done + # fill the fs label with obvious emoji because nobody uses them in prod + # and blkid throws a fit + _scratch_xfs_admin -L 'I❤ From patchwork Wed Feb 19 00:56:19 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: 13981309 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 23DE61A314B; Wed, 19 Feb 2025 00:56:19 +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=1739926580; cv=none; b=md2IuHSM+P8TbPf6h/uYueA8eLc6Ye+hftaIIyD9EtyYsruSc/k3lie0eKIKlZ0GX0cz/vu4lwKjJ+sPDtI10sercO1IflULOwZK/0KdL5MMXq5K4ovCvawGUF/Elvv213vnWQFDW64gVcNR4jVj7elxr10ayBurn3FAZnBkEsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926580; c=relaxed/simple; bh=IacXE4//Pj6nulVtByUtseZzHf2rr6FiJ+rlTDowzUU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I89EDEL2dHNgsGfm+VhQ4CG4VsNzOLFYJ5/e0FhYJyE6v4XxEKpADBZFk0x0iKDp5B5oy38qCgfAQowU3xjEoZFYWkTG2k2/adZhks5IlfCxX14JDnj9T93KKmnMCwHshhD/5xq6J4teD5AQXvTh5s7+WUid6qxWlRQ/8A5rZTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i75rsg6/; 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="i75rsg6/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A8BC4CEE2; Wed, 19 Feb 2025 00:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926579; bh=IacXE4//Pj6nulVtByUtseZzHf2rr6FiJ+rlTDowzUU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=i75rsg6/CteBVUZLtvgfDg1EQvskiuBbtZ/3zxhW87csPRGSizbhUcfVIlVgkSjzg qC5B6kBgHz40ienqmnYyBRGmjm4Miv+94sdtitnWQ+uipzbXORJDEcJjZSp/FwHoQM LQUeuEm3VP226g3hzBbVjQj3JW/ark405yfk7jCFkyMz4D1L4SAKVEWb3E2C3Cyj8n 9/GLSm62pXCwKa2htdzzRjaTLj2YglChPx/GSN5aFW7KvwxIfYwVwd+McJzdkyBOrf ju4Qq14uBI2ZzjqhdhokRj/nJuLiSd5gLjRPHIE+vLIOYTi/fO8pkJpF+U942Wyyt2 pMnND2LMryIAg== Date: Tue, 18 Feb 2025 16:56:19 -0800 Subject: [PATCH 11/12] scrub: race metapath online fsck with fsstress 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: <173992588262.4078751.10550660785587990131.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 Add a pair of new tests to exercise fsstress vs. metapath repairs. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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 771ef90633c6de..c8f2ea241a2a41 100644 --- a/common/xfs +++ b/common/xfs @@ -1658,6 +1658,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 Wed Feb 19 00:56:34 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: 13981310 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 5B3522B9AA; Wed, 19 Feb 2025 00:56:35 +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=1739926595; cv=none; b=TMgxkosCpH3sBz8atZXNtKAigoWJnQF17a/Brr0hWz9/om5Tem1uGsAyJBkigSXWTlWSr64mLPeVheuo4ty/TCYt34egWzQhYV8inLuFlBXoXDzStUNvNC9Cuq8jdfEsRKHpukNpcrfO+1nRK1PCxAm61RcUS8k+yypvKB0xHEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739926595; c=relaxed/simple; bh=RlRxkb1fN1VvV9kTiHv/S/NWBIPfSDuW4PTCPAiPijE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sBsALWwc3uQRkd9ojDN0xF9TzwIVgUeJJvrhoBOGvrUNaqyUoREXjUq2xxkiuS3r5iUvN85sDSfv46ukoAMAUtm+ZgYtAroPQeSgbnr/LFav/pqwCmvQ5RSwMG0T35+EuS+t+b92m+a6tuMnImgdsL168yuRzVVhWXI6oYIJhDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kiHI/+/2; 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="kiHI/+/2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32A4AC4CEE2; Wed, 19 Feb 2025 00:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739926595; bh=RlRxkb1fN1VvV9kTiHv/S/NWBIPfSDuW4PTCPAiPijE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=kiHI/+/2Q5n5n0GjDJLjYFt3u5CAyiOdzFGXL75LVxE3+eXG1xTK7Lex4uXMXMyKc 4GlklL8jbRbstEorjwu9C9Bf2zwSfR4LYLdzwHUGwjKISHUeheC2g1qxv4IGtWzD2D OS3MZeyFkIT6Ji+lNIVYCUJjHp948ISu+5Fy1RxaG/7CDG6GxW7rnoj7kg63gEHK5e BSeeUMF6IeUliTyrlICIaDeRtlvX3V/yor+1gHSqXSzKYgGkzvgKQ/x+GzrI/Quc5S 9ud5b9XYLfMRkn6LyZe1/p2Z/vc3AO/pzRAlNgNKamWEEpMOOECtwlJ4ra9NugEz7c mbO8qfzT0pmYA== Date: Tue, 18 Feb 2025 16:56:34 -0800 Subject: [PATCH 12/12] xfs: test metapath repairs 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: <173992588278.4078751.17076800480211311441.stgit@frogsfrogsfrogs> In-Reply-To: <173992588005.4078751.14049444240868988139.stgit@frogsfrogsfrogs> References: <173992588005.4078751.14049444240868988139.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 Functional testing for metadir path checking and repairs. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- 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