From patchwork Fri Oct 11 01:38:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831882 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 9F28CC2ED; Fri, 11 Oct 2024 01:38:23 +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=1728610703; cv=none; b=qD4eyLQyloK/rKtZ1+qcZeA6Eqs1fjWgx1M2p5rauvraSyLEtShFtT4dnDptPCBxJHxDBrTpQmFN8LHls7n3OsL38zDWYFG1dQMRxPzXZ6xcFp7S0WQMpD3whhS6qjfCDtZ3XPdFHdcECrW6Qgn8k6PbIzWes4Whhf6bRz4LCCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610703; c=relaxed/simple; bh=/9VC27kp4jgzUR7bN9SnlYVuFvuR9zzbblpr9dxsNOQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IGpxJawFQceyptnfCABNQbkVu0LYD5M21ZVLbUeJPOdakBwsNxTJTkR5uoIxg/xBYdVZ8IXARLHpkUhse0Nhq296DkB9Pjb/h4IS5pnsr0x4rCQxGKWqyxfur5AFU7fNAuVXcBKL0GVqd10w+LZA1Tn4tAcLniUH7stoTJ4nPpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PsZc11eB; 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="PsZc11eB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D843C4CEC5; Fri, 11 Oct 2024 01:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610703; bh=/9VC27kp4jgzUR7bN9SnlYVuFvuR9zzbblpr9dxsNOQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=PsZc11eBBCgtXJredt8bY7UgAF3NtIUyQ36WB6uQa9JE1nr73hDvDebv7x1hFYJzc Ntv6hl+IemsXiK4+lzC2y6hSuvG93ldQW4uwT4Yhql6NA89yDDtJf8H9Nf++FDbiaI I2klQ2d6VCTQDbZgqxdMa7xoI8Tox8F65ET80ZZfR5UjjKFmrxesvn1nKpXRBM7fOm ExjziCrlaqKMC4foFFqXIdNBuSAUyrxhW3kXg5IP0UfEz/vuY9+iI88b/xLQ+GvYG/ 5yk/OcxjbSDAecVWh0KSamridDRdRG6NHRVogGxUzfFWUorN/xQX2jfFkuRTOOpc2i 6Vn48ojpK9jTg== Date: Thu, 10 Oct 2024 18:38:22 -0700 Subject: [PATCH 01/11] xfs/122: fix metadirino From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658013.4187056.15782325436304198634.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fix xfs/122 to work properly with metadirino. Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 4dc7d7d0a3602b..64109489896fd5 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -35,6 +35,7 @@ offsetof(xfs_sb_t, sb_logsunit) = 196 offsetof(xfs_sb_t, sb_lsn) = 240 offsetof(xfs_sb_t, sb_magicnum) = 0 offsetof(xfs_sb_t, sb_meta_uuid) = 248 +offsetof(xfs_sb_t, sb_metadirino) = 264 offsetof(xfs_sb_t, sb_pquotino) = 232 offsetof(xfs_sb_t, sb_qflags) = 176 offsetof(xfs_sb_t, sb_rblocks) = 16 From patchwork Fri Oct 11 01:38:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831883 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 4D433C2ED; Fri, 11 Oct 2024 01:38:38 +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=1728610719; cv=none; b=Jvi6LeHTMpdebzcTPhtY45sVA07H+9V7EEsUrhc/bHsqBu3xuhbFUKTWNN2GWUJoYLQdnLM3adjORYuU8XE9Y2ph39u+icYO3v/2tpsgRvcl6cRoxsfdnr+b7ye7feY8kDrMRoprI9Q6IOgB73gnItDIZodSWnlxRUemhrCAM9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610719; c=relaxed/simple; bh=s0ai5DTScLKwEvTTcc041vfaNz/lvK1e9d6Tni/62oY=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S1suulJkEOfFYFZ10Coh9Ue1GJ95RhMtSDxShApIjsuqcSuP+EtHSZDzylo4BsMpdQy24qiUCI4DQY+Nj0DQyk9MvplEnUrjIuzRfulJcuy2YUWELFDCQAhaRWiG+UP05vrsHoby6OUpTf24gEcN3f+MelUjXKfj0MLGqHK/1L4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u6WO2qyD; 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="u6WO2qyD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4337C4CEC5; Fri, 11 Oct 2024 01:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610718; bh=s0ai5DTScLKwEvTTcc041vfaNz/lvK1e9d6Tni/62oY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=u6WO2qyDNoqfiUTn3tdJYP2Tvdp+JT7UxcqPv58+dIfJGyb8FhtY5fwtfla20YjaL 2Z1kTIknf+zJL1sgnd+ZZk6bz3duxNhR2/E9lV3mlz1T0UC6DwO+NDPAn8afv8aJ67 wLyCQNiBWo8USwDdn7wY7NfUW/JYFQz8HKJWMV//ZBRHGertAM26IkTYLciJe3SjrG dz8uvi53cewb1FJkw6XEZo76+R4yga7S5OwjJrrtpKyqW2Ezhw798683yj3xaeJDfI ows0YX+OmSjkNAt/7yqaqB8YTKSibuRNrS2qKvImqnxTiiIf4TJ4tRicI0nO14Pl1f FLa03hz97tPmw== Date: Thu, 10 Oct 2024 18:38:38 -0700 Subject: [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658028.4187056.18362387796681471507.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong There are a 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 62e3100ee117a7..ae32710072671e 100644 --- a/common/xfs +++ b/common/xfs @@ -1385,7 +1385,7 @@ _scratch_get_bmx_prefix() { _scratch_get_iext_count() { - local ino=$1 + local selector=$1 local whichfork=$2 local field="" @@ -1400,7 +1400,7 @@ _scratch_get_iext_count() return 1 esac - _scratch_xfs_get_metadata_field $field "inode $ino" + _scratch_xfs_get_metadata_field $field "$selector" } # @@ -1870,3 +1870,20 @@ _wipe_xfs_properties() setfattr --remove="$name" "$1" done } + +# Return the xfs_db selector for a superblock-rooted metadata file on the +# scratch filesystem. The sole argument is the name of the field within the +# superblock. This helper cannot be used to find files under the metadata +# directory tree. +_scratch_xfs_find_metafile() +{ + local metafile="$1" + local sb_field + + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" + if echo "$sb_field" | grep -q -w 'not found'; then + return 1 + fi + echo "inode $sb_field" + return 0 +} diff --git a/tests/xfs/007 b/tests/xfs/007 index 2535f04cac36a5..e35a069f9bd5c5 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -21,6 +21,11 @@ _require_xfs_quota _scratch_mkfs_xfs | _filter_mkfs > /dev/null 2> $tmp.mkfs . $tmp.mkfs +get_qfile_nblocks() { + local selector="$(_scratch_xfs_find_metafile "$1")" + _scratch_xfs_db -c "$selector" -c "p core.nblocks" +} + do_test() { qino_1=$1 @@ -30,12 +35,9 @@ do_test() echo "*** umount" _scratch_unmount - QINO_1=`_scratch_xfs_get_sb_field $qino_1` - QINO_2=`_scratch_xfs_get_sb_field $qino_2` - echo "*** Usage before quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 _qmount echo "*** turn off $off_opts quotas" @@ -65,8 +67,8 @@ do_test() _scratch_unmount echo "*** Usage after quotarm ***" - _scratch_xfs_db -c "inode $QINO_1" -c "p core.nblocks" - _scratch_xfs_db -c "inode $QINO_2" -c "p core.nblocks" + get_qfile_nblocks $qino_1 + get_qfile_nblocks $qino_2 } # Test user and group first diff --git a/tests/xfs/529 b/tests/xfs/529 index 14bdd2eebf7047..aab8668c76f46c 100755 --- a/tests/xfs/529 +++ b/tests/xfs/529 @@ -161,9 +161,8 @@ done _scratch_unmount >> $seqres.full echo "Verify uquota inode's extent count" -uquotino=$(_scratch_xfs_get_metadata_field 'uquotino' 'sb 0') - -nextents=$(_scratch_get_iext_count $uquotino data || \ +selector="$(_scratch_xfs_find_metafile uquotino)" +nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/530 b/tests/xfs/530 index 8a182bd6a3928a..f6c88cd12e187c 100755 --- a/tests/xfs/530 +++ b/tests/xfs/530 @@ -102,10 +102,8 @@ _scratch_unmount >> $seqres.full echo "Verify rbmino's and rsumino's extent count" for rtino in rbmino rsumino; do - ino=$(_scratch_xfs_get_metadata_field $rtino "sb 0") - echo "$rtino = $ino" >> $seqres.full - - nextents=$(_scratch_get_iext_count $ino data || \ + selector="$(_scratch_xfs_find_metafile "$rtino")" + nextents=$(_scratch_get_iext_count "$selector" data || \ _fail "Unable to obtain inode fork's extent count") if (( $nextents > 10 )); then echo "Extent count overflow check failed: nextents = $nextents" diff --git a/tests/xfs/739 b/tests/xfs/739 index a4f553d818c2be..a143325e3facb6 100755 --- a/tests/xfs/739 +++ b/tests/xfs/739 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/740 b/tests/xfs/740 index 971bf31e3239b1..e867d591fd99cb 100755 --- a/tests/xfs/740 +++ b/tests/xfs/740 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'online' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/741 b/tests/xfs/741 index 4e24fb4e2fef31..ea4aa75b24741b 100755 --- a/tests/xfs/741 +++ b/tests/xfs/741 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/742 b/tests/xfs/742 index eabe766d725c07..967e384f659f72 100755 --- a/tests/xfs/742 +++ b/tests/xfs/742 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'offline' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/743 b/tests/xfs/743 index b5cec7d71a4002..82b87b33792cdd 100755 --- a/tests/xfs/743 +++ b/tests/xfs/743 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/744 b/tests/xfs/744 index e2d097c2f0d59f..4840e78c4427ab 100755 --- a/tests/xfs/744 +++ b/tests/xfs/744 @@ -26,13 +26,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'both' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'both' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done diff --git a/tests/xfs/745 b/tests/xfs/745 index d139aeefdd8a37..6cc3805d4c9df8 100755 --- a/tests/xfs/745 +++ b/tests/xfs/745 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtbitmap" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.bitmap') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.bitmap') -else - path=('sb' 'addr rbmino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rbmino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtbitmap" # success, all done diff --git a/tests/xfs/746 b/tests/xfs/746 index 696d024532982a..b6ec74524b0eaa 100755 --- a/tests/xfs/746 +++ b/tests/xfs/746 @@ -25,13 +25,8 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz rtsummary" -is_metadir=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /realtime/0.summary') -if [ -n "$is_metadir" ]; then - path=('path -m /realtime/0.summary') -else - path=('sb' 'addr rsumino') -fi -_scratch_xfs_fuzz_metadata '' 'none' "${path[@]}" 'dblock 0' >> $seqres.full +path="$(_scratch_xfs_find_metafile rsumino)" +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'dblock 0' >> $seqres.full echo "Done fuzzing rtsummary" # success, all done From patchwork Fri Oct 11 01:38:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831884 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 E7390C2ED; Fri, 11 Oct 2024 01:38:54 +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=1728610735; cv=none; b=KQmYCn1WOHIilWxNmbyP28s8lU2lj0aB90LDRg+NhrMuA15UBartYR2CxKFe1lv8XR61X94iC3yKmEqssa2emd1iF7+vVBXUa6xcPnu+fwrXlxxujLxqXw2sqbKIz6L/wUjHKmY41jtU5YBTCNmyQDQ+UZdbGrllkxAbkKNeits= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610735; c=relaxed/simple; bh=pjs3VXMwd5WdEc7oXC3aEGDxKinjiU6VcMtm+NtAzhU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VzPYRU0ST8vKeXw/WwuBv4lOXdrd2iZMDZAlDP77yV2L5dWAa3rxzDvO7ps9VUHO80GdJZ1IpE2oQHj3c4XcwClUwN/Mmoh8uL+ViS7S1AEKMuxNYr92H2fUeAtwYXCDX9UVJhe2TwhClJZHtZhELkzo91IaV/2GEW9oRafp7oU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VJLIyij6; 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="VJLIyij6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E600C4CEC5; Fri, 11 Oct 2024 01:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610734; bh=pjs3VXMwd5WdEc7oXC3aEGDxKinjiU6VcMtm+NtAzhU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=VJLIyij6jWagAFK84n+SrhX9m1LjoFbJYJULbOoTEsOWdFGZDGOqYvlbfJ5V7atKH rYYiUl1lgQUWt/yIdLaENyc7sZ1UjvzNehUg+ROs6zvIKQSTbu5AMUqe+tQCyeJNkN xiDIKD0ti3uloVkizEVwFX74NtkGct14Iy869RWLBpJO77ncZL/FG1M9e8ae/TAU7/ pWL3FWK0QhSjr/rDXfdXDcnTW+MKc4PFw+ilp4FAZ2l4jNpfBWmPaWuFa8G+S/v/Op KiqbpTvD9iJCScswt1Zq+L1diVS+obh86y5xPQ1TvnYITpGckz/trQUjlZMuUGiHup 1w2BBzElCaXsA== Date: Thu, 10 Oct 2024 18:38:53 -0700 Subject: [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658043.4187056.14504092342033103535.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The 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 | 13 +++++++++++++ tests/xfs/030 | 1 + tests/xfs/033 | 1 + tests/xfs/178 | 1 + 4 files changed, 16 insertions(+) diff --git a/common/xfs b/common/xfs index ae32710072671e..20217ea7365a4d 100644 --- a/common/xfs +++ b/common/xfs @@ -1887,3 +1887,16 @@ _scratch_xfs_find_metafile() echo "inode $sb_field" return 0 } + +# Force metadata directories off. +_scratch_xfs_force_no_metadir() +{ + if echo "$MKFS_OPTIONS" | grep -q 'metadir='; then + MKFS_OPTIONS="$(echo "$MKFS_OPTIONS" | sed -e 's/metadir=[0-9]*/metadir=0/g' -e 's/metadir\([, ]\)/metadir=0\1/g')" + return + fi + + if grep -q 'metadir=' $MKFS_XFS_PROG; then + MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" + fi +} diff --git a/tests/xfs/030 b/tests/xfs/030 index 7ce5ffce38693c..22fbdb2fdbc999 100755 --- a/tests/xfs/030 +++ b/tests/xfs/030 @@ -48,6 +48,7 @@ _check_ag() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir DSIZE="-dsize=100m,agcount=6" diff --git a/tests/xfs/033 b/tests/xfs/033 index d7b02a9c51b3f0..e0b0dd58212d61 100755 --- a/tests/xfs/033 +++ b/tests/xfs/033 @@ -51,6 +51,7 @@ _filter_bad_ids() _require_scratch _require_no_large_scratch_dev +_scratch_xfs_force_no_metadir # devzero blows away 512byte blocks, so make 512byte inodes (at least) _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs >/dev/null diff --git a/tests/xfs/178 b/tests/xfs/178 index a22e626706ec49..0cc0e3f5bb88b4 100755 --- a/tests/xfs/178 +++ b/tests/xfs/178 @@ -50,6 +50,7 @@ _dd_repair_check() # fix filesystem, new mkfs.xfs will be fine. _require_scratch +_scratch_xfs_force_no_metadir _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs # By executing the followint tmp file, will get on the mkfs options stored in From patchwork Fri Oct 11 01:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831885 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 81F0DD2FB; Fri, 11 Oct 2024 01:39:10 +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=1728610750; cv=none; b=qWOC/YCEAqXK7LQPkkLDw/JJr8DTR6SYgkgFm1VTQcFkUXu+l8VAvYYOnCrRDuNFEWiFUBHSWZTyb0UjU6GPDAMBHiE6ffOPkiYTXWffGDQ1JICZC98DIxyVUXlswPLdE8JI7v8RvHk2oNthaDTh2vHi7gq0duGGxY1D1B9CIgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610750; c=relaxed/simple; bh=RCpBLW8f1X1nKon5OraOTm78Gw4dmejOF+tA/gYj33I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a1nStR6240BQ81qKP5o4nCYVHiqEO2C7OJzukNEqBCCsa7D/aNfd9HfWLNyfv6cMZrSUJ411XuHdxYfxH9aeGJZmEw5xC53s6qMsbPfgx3cbbHV36oN/NyCBBH1gLJ+ee0Y3DFmi/hmUMU7zxCUbIqYfZguoY4xPJXtUZxmsMRE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PayRBMb/; 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="PayRBMb/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 138D6C4CEC5; Fri, 11 Oct 2024 01:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610750; bh=RCpBLW8f1X1nKon5OraOTm78Gw4dmejOF+tA/gYj33I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=PayRBMb/prwrxpPB3u1hcLqCMua9d5Jy9HP335oXy3Ae9RQG47FJ9jdrXVPGu36ly h5V1HEQvvsx9tcu/p/CaJmnIyGXw+BPqRBG4jMyGz5ttIjlvCd0dOed5RbUO+f3iNM gAfkV+QnJfxJWQ/kvFFS/tSCPCJqkm7gNn1ojBXeuOBizW4XHxdlL9PkuVJViwbJZO Gd320Czi3lqI8RNgP3T/jVPp4o5XrpUMlNQ/UZZ7xJLfey41kKT44mklxaEhqlzj50 DMdQ0sdPZjnO38RqdngEvxEb0dz3uZLOQHlmrjF6ZTF5vV7d0CiAWuIdXngrfUH4nd gmhRebd4kXasw== Date: Thu, 10 Oct 2024 18:39:09 -0700 Subject: [PATCH 04/11] common/repair: patch up repair sb inode value complaints From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658058.4187056.2385244245034025475.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Now that we've 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 8945d0028c47a4..c3afcfb3e6966a 100644 --- a/common/repair +++ b/common/repair @@ -28,6 +28,10 @@ _filter_repair() perl -ne ' # for sb /- agno = / && next; # remove each AG line (variable number) +s/realtime bitmap inode pointer/realtime bitmap ino pointer/; +s/sb realtime bitmap inode value/sb realtime bitmap inode/; +s/realtime summary inode pointer/realtime summary ino pointer/; +s/sb realtime summary inode value/sb realtime summary inode/; s/(pointer to) (\d+)/\1 INO/; # Changed inode output in 5.5.0 s/sb root inode value /sb root inode /; From patchwork Fri Oct 11 01:39:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831886 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 46EDCEEA9; Fri, 11 Oct 2024 01:39:25 +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=1728610768; cv=none; b=VTxHnMeufQn3sZ38aslSmgH6Yy+VB1qF9M1vDnDgVLkrUE1iKAgO1U8c9fki+CjqdqpeFlMbA8KFN6FMTH1QdFLX5Jpc3ZK4f3Xqi/EMj3y43fdz6oHM8007RtS1gVIXxJ3ElDfAA3KXErxNpL4o5LDk/59FrSZ+6NgWZxRZDak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610768; c=relaxed/simple; bh=oqjvkm0PnXzl6YOECnpywfiM5l8JO4iHUBCX7RR05gk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MQgZ3+vGp/riG+RveH4xqu8RLMw+g5MSmUAY1CLTePHP6etyQLfUdxfMYa7jx4rhNyNilXxXJ/oc3WGMl7J/R1UVErWifUIVo4r+4AJlOyLfPiOaevfA5N+RLG+v5A44va83i4g1uWOuFPv2Y6NjFYrZphB3HhDvYa7doHOubJo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NzTi6Zoj; 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="NzTi6Zoj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B080BC4CEC5; Fri, 11 Oct 2024 01:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610765; bh=oqjvkm0PnXzl6YOECnpywfiM5l8JO4iHUBCX7RR05gk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=NzTi6Zoj9fazP0qmD9WCKRaQHjgb4SD3weMNM3PMYO26t1mWy4u2pH/QkAcdigxpx FvvulWcYiUUFCEnvfKULfq4Yhimwrr9I8d3tlkw7F9uGxg8IQ+oVh2WghnzY+RS9PL /UU7aAFQpTzjDjxzxMNvuOw1qzbILo0nMBRxlMnq+L+Td3WOlr/fABvTzCIjRfdnqQ bZIRNqTUMncoMjs0PP4X025i7gAYGgbtx5acPzrYgJhB7cQ6I9A8TVfRYlUKZt5gvO LfLalS3wljwfRSb0BVfw+Xe8NW2SeTd4OulCNnvMfudGU2B5m4BeMcibM6BNylG4Hp xuVSXjVHBsOig== Date: Thu, 10 Oct 2024 18:39:25 -0700 Subject: [PATCH 05/11] xfs/206: update for metadata directory support From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658073.4187056.12493388618887137873.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 Fri Oct 11 01:39:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831887 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 7314BD299; Fri, 11 Oct 2024 01:39:41 +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=1728610781; cv=none; b=ZyMVRVzV8+2/rsq2cU8l9pOZbBswv6Gr4XCWZQ+tBKDfwgvzpznt8QwayM8z8mfmE8dA1oKoXeGxBHJoXFWESYDjfnxEJZ7/zwPMhPaXUol9Zi4ONL6HlLAcfHrV7Yy8eEruKSccYYh/Mh5hSDOjfvLuukJoQvdwzZxHv8XNpok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610781; c=relaxed/simple; bh=iW2B/Ed1s1NWQsPBl0AWYn2XHxnQCdibQ4fvROy2dSg=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yo4S28sAnlT8LxtsFk64Uxsu3AFz13PUe1lipTK06S0JmM5lzOK8GMhdo891hvxIGPnlu5mTZ8VK8LGVqXSiDTIL9XYCs16GmoVufu6vuA3vJOejnQcBwbL87jHYFyYCWxRQQGUxEGnufGJ2mCF34/8nCXZdXu6dnPHtTVYIR0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OGllhbG1; 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="OGllhbG1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D978C4CEC5; Fri, 11 Oct 2024 01:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610781; bh=iW2B/Ed1s1NWQsPBl0AWYn2XHxnQCdibQ4fvROy2dSg=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=OGllhbG1l86XTdT8B0tJrBOsbcgpQvYifJ2Fk7Pzss6Nz/JtYkMVJJTlFwLHKtMpU IKEcMHHt5DFnMCyYhjCIODfpP6ACbQGjvAZPamWNcx40CmoNq23Yo3JA0YMLMcrW98 OnOl0MmP/1TXubm4LnWXXipv11mhwKJwwtmkj0HFxQQxBFgziZwe0PHBFsK7Lq36s7 G06EmmeYnvCXLBSrTQ66LJvWrkEZfpI2TCpmdXnX+aPXL1B18KJtx2pEs55RZ7xbrB ZyoQjrrgRiqD3yxHaW2lprL0YtkM+VE0tMFsrUEE2yM3y+l71gxQTejqLDMewqctcT 7zh/pF7sZRfhw== Date: Thu, 10 Oct 2024 18:39:40 -0700 Subject: [PATCH 06/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: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658088.4187056.15515963882798325572.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 36d51bd957dd53..03f60672c0e106 100644 --- a/common/filter +++ b/common/filter @@ -618,11 +618,14 @@ _filter_getcap() # Filter user/group/project id numbers out of quota reports, and standardize # the block counts to use filesystem block size. Callers must set the id and -# bsize variables before calling this function. +# bsize variables before calling this function. The HIDDEN_QUOTA_FILES variable +# (by default zero) is the number of root files to filter out of the inode +# count part of the quota report. _filter_quota_report() { test -n "$id" || echo "id must be set" test -n "$bsize" || echo "block size must be set" + test -n "$HIDDEN_QUOTA_FILES" || HIDDEN_QUOTA_FILES=0 tr -s '[:space:]' | \ perl -npe ' @@ -630,7 +633,7 @@ _filter_quota_report() s/^\#0 \d+ /[ROOT] 0 /g; s/6 days/7 days/g' | perl -npe ' - $val = 0; + $val = '"$HIDDEN_QUOTA_FILES"'; if ($ENV{'LARGE_SCRATCH_DEV'}) { $val = $ENV{'NUM_SPACE_FILES'}; } diff --git a/common/xfs b/common/xfs index 20217ea7365a4d..f95a5a6d1d970e 100644 --- a/common/xfs +++ b/common/xfs @@ -1900,3 +1900,32 @@ _scratch_xfs_force_no_metadir() MKFS_OPTIONS="-m metadir=0 $MKFS_OPTIONS" fi } + +# Decide if a mount filesystem has metadata directory trees. +_xfs_mount_has_metadir() { + local mount="$1" + + # spaceman (and its info command) predate metadir + test ! -e "$XFS_SPACEMAN_PROG" && return 1 + $XFS_SPACEMAN_PROG -c "info" "$mount" | grep -q 'metadir=1' +} + +# Compute the number of files that are not counted in quotas. +_xfs_calc_hidden_quota_files() { + local mount="$1" + + if _xfs_mount_has_metadir "$mount"; then + # Prior to the metadir feature, the realtime bitmap and summary + # file were "owned" by root and hence accounted to the root + # dquots. The metadata directory feature stopped accounting + # metadata files to quotas, so we must subtract 2 inodes from + # the repquota golden outputs to keep the tests going. + # + # We needn't adjust the block counts because the kernel doesn't + # support rt quota and hence the rt metadata files will always + # be zero length. + echo -2 + else + echo 0 + fi +} diff --git a/tests/xfs/050 b/tests/xfs/050 index 7baaaeaa3efcf9..4ce56d375e945b 100755 --- a/tests/xfs/050 +++ b/tests/xfs/050 @@ -30,9 +30,14 @@ _require_scratch _require_xfs_quota _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/153 b/tests/xfs/153 index d5e43082c1cd35..2ce22b8c44b298 100755 --- a/tests/xfs/153 +++ b/tests/xfs/153 @@ -35,9 +35,14 @@ _require_idmapped_mounts _require_test_program "vfs/mount-idmapped" _scratch_mkfs >/dev/null 2>&1 +orig_mntopts="$MOUNT_OPTIONS" +_qmount_option "uquota" _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +# needs quota enabled to compute the number of metadata dir files +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) _scratch_unmount +MOUNT_OPTIONS="$orig_mntopts" bsoft=$(( 200 * $bsize )) bhard=$(( 1000 * $bsize )) diff --git a/tests/xfs/299 b/tests/xfs/299 index 710eb89c2ac0e7..3986f8fb904e5d 100755 --- a/tests/xfs/299 +++ b/tests/xfs/299 @@ -155,6 +155,7 @@ _qmount_option "uquota,gquota,pquota" _qmount bsize=$(_get_file_block_size $SCRATCH_MNT) +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) bsoft=$(( 100 * $bsize )) bhard=$(( 500 * $bsize )) diff --git a/tests/xfs/330 b/tests/xfs/330 index d239a64085c76c..30c09ff5906e12 100755 --- a/tests/xfs/330 +++ b/tests/xfs/330 @@ -24,7 +24,10 @@ _require_nobody do_repquota() { - repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r + repquota $SCRATCH_MNT | grep -E '^(fsgqa|root|nobody)' | sort -r | \ + perl -npe ' + $val = '"$HIDDEN_QUOTA_FILES"'; + s/(^root\s+--\s+\S+\s+\S+\s+\S+\s+)(\S+)/$1@{[$2 - $val]}/g' } rm -f "$seqres.full" @@ -33,6 +36,7 @@ echo "Format and mount" _scratch_mkfs > "$seqres.full" 2>&1 export MOUNT_OPTIONS="-o usrquota,grpquota $MOUNT_OPTIONS" _scratch_mount >> "$seqres.full" 2>&1 +HIDDEN_QUOTA_FILES=$(_xfs_calc_hidden_quota_files $SCRATCH_MNT) quotacheck -u -g $SCRATCH_MNT 2> /dev/null quotaon $SCRATCH_MNT 2> /dev/null From patchwork Fri Oct 11 01:39:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831888 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 15933D2FB; Fri, 11 Oct 2024 01:39:57 +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=1728610797; cv=none; b=fwmpd2hCJ/gLCkUbvkrHX1exXhEsU4MUcn9MQtqmvZDhxstBBiHks6WrGITfBX7H3Lo3KzMALuElJ3oL+sJoX6UfFMUnDCl8jcfbwuvP83ycRzvtNLDGitH6+Z5uwo4fZabxdIk2Y/bSwtDQGtCs0B7yNKf/yU1WrW8T9rgskgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610797; c=relaxed/simple; bh=zuvucxL1strdJQr94nCWbaKvbzc/z3BnauNYC/vHtd0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fhjsm+qBxTV4oo1TAJE4yN3GXU84XRF48VUHaxE75fgUA+3qQT5FuOcUR4ecsPRH275qxlxGSm6laF9plMERcRBKJAlGzDl/rhOWFyY2f0NXmo+bQQmSUtg6JBpf67bt5g9VM3FaMIToAxauuWWtBvyrnG0+2ob0+h+p+S18/LE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aMP6YZoU; 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="aMP6YZoU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3ABBC4CEC5; Fri, 11 Oct 2024 01:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610797; bh=zuvucxL1strdJQr94nCWbaKvbzc/z3BnauNYC/vHtd0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=aMP6YZoUQ3piJU2iJ0qx+7YgJotS/CFu4JdTtiO6f/MWnRdQupWoqxRinVjR4UO2V VtGs4Z5/vU/MhBz3Gqt2WmZrPyfXV9ViYAieVMMsa+LnK2B9XKSVo0R2y1qsCVEMRF RH7R1hd+CZQqU41Wm5Xn5q1/SNvS1giyGUW2bBL7H56pfpqVhrsl9/XEUMS4T3gLFA O0u6827iW5Uwfo8/f7jJT6nYPgB6ZSxWY/57Lyr5N9eoWlCsjd6RwDxFRH2NpR9/Xf 9neP+w1Mb1AxvBJRudIDo6bx4AuSA9E8BgV56ekQLZuT7/9b5oxoJkaeP++wC9kI4E uAY979CTTzFEw== Date: Thu, 10 Oct 2024 18:39:56 -0700 Subject: [PATCH 07/11] xfs/509: adjust inumbers accounting for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658104.4187056.9848487655097432837.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The 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 Fri Oct 11 01:40:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831889 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 A6C3D175AB; Fri, 11 Oct 2024 01:40:12 +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=1728610812; cv=none; b=h/kJW3UbmnXwA3Obj+9G49APkmcmhopMt+QOmnMCBapLFkPjuUE72xclgXuyIbtbtP6wDZtXnFeh7X3a9ejHqsc51ZpR4fIKvFd0fPUj7XR3RQuHdsWxvebuYgkOl8aKxj1p3WSJa1EtE+RPe5Q9e1NZW+4YEkdQs80JULLN2yI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610812; c=relaxed/simple; bh=D2otW8uklWCXr7nnUWyWYvSTNCb8GUReQR8dK4iyXW8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mJ2YZtaWevNJVa21zRvluvu9ysFqV2MRh+Vc2ra2ppbSsRxWPPloPe2aQUJz63mJQ8xJx81oPcKXpwuMbhHGqdjSQ1LSm2AwZMzRX2TF54qWmTwFRfUqeHRfRf9XMQoV5yeFjxmJFs+OpMe7D13gRgBstkxqHPkJ4snztMcxTFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=D9rmJ4x0; 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="D9rmJ4x0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D905C4CECE; Fri, 11 Oct 2024 01:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610812; bh=D2otW8uklWCXr7nnUWyWYvSTNCb8GUReQR8dK4iyXW8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=D9rmJ4x0qD97YYWmrr3QgQlF5icN817Wx2H7lsIN9tocXfbYT66SJ3xMw0Gm3183P 6MxuzpkLvnAu95d+XaMDEh67CtoeWHbd6ydTIrZJlLiAD1jXxZD0WAl+FE4BnzUE1f DOI/cCtwRd5G3q2nWp7n28mEs19sCYB05eGNTKc2Xl7iC4xrHYcpejtJywDEMHszwN B2jsMlIu6WfDnU7AqIE9YlzFsYcqV3Nqie+TM6WPpD9omi6L6fbmZ80PyzmWLKhHfy 7iRNPz6Dm+iU0OuGg8ZgfiWaPOOUbr/OwPVCg0QZcfUIaI4BIrNaIg0PbJD6NjWURB TPyibG4sFMlzg== Date: Thu, 10 Oct 2024 18:40:12 -0700 Subject: [PATCH 08/11] xfs/122: adjust for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658119.4187056.17816529487224170367.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Adjust this test for the metadir feature. Signed-off-by: Darrick J. Wong --- tests/xfs/122.out | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/xfs/122.out b/tests/xfs/122.out index 64109489896fd5..f47904bc75e6de 100644 --- a/tests/xfs/122.out +++ b/tests/xfs/122.out @@ -36,6 +36,7 @@ offsetof(xfs_sb_t, sb_lsn) = 240 offsetof(xfs_sb_t, sb_magicnum) = 0 offsetof(xfs_sb_t, sb_meta_uuid) = 248 offsetof(xfs_sb_t, sb_metadirino) = 264 +offsetof(xfs_sb_t, sb_metadirpad) = 204 offsetof(xfs_sb_t, sb_pquotino) = 232 offsetof(xfs_sb_t, sb_qflags) = 176 offsetof(xfs_sb_t, sb_rblocks) = 16 @@ -92,7 +93,7 @@ sizeof(struct xfs_dir3_leaf) = 64 sizeof(struct xfs_dir3_leaf_hdr) = 64 sizeof(struct xfs_disk_dquot) = 104 sizeof(struct xfs_dqblk) = 136 -sizeof(struct xfs_dsb) = 264 +sizeof(struct xfs_dsb) = 272 sizeof(struct xfs_dsymlink_hdr) = 56 sizeof(struct xfs_exchange_range) = 40 sizeof(struct xfs_extent_data) = 24 From patchwork Fri Oct 11 01:40:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831890 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 4A3F2D53F; Fri, 11 Oct 2024 01:40: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=1728610828; cv=none; b=XtxFrPkZdYQhOtStMZ560kg8w9okP2EhCL8tBKOy+pZMPIET8CNFc7/52v5rCRL5g/M43UVtcAI2/LZzu3yxzkETiSVLsvS3JU79Cd7DWis+38EzuJMqT9I550TmwpmhK8CG+T/D0AbISBtP9gyiVE3a0kulFzF3pDVPbp5RhSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610828; c=relaxed/simple; bh=zy33KlbzmQb7hfMYC0dLuL9G6+YnLR5OzByHpbkFP9g=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EgmDtKdHWlVvAG3R6EeqUrnGCv3Andicb96dDWVKDij1GA/wC9QJLAlMoH8DR+ksX1G9nwhJa4GmLR7FTVAco/uqyvH3K51cqGkAQmg+swwjXDvcaiDxltwbDu4dlf1d45rgq8R9g1Yn5vNgy1qI6msC/IIreVxINTDv7PoV9YI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ozySzmf8; 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="ozySzmf8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238A6C4CEC5; Fri, 11 Oct 2024 01:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610828; bh=zy33KlbzmQb7hfMYC0dLuL9G6+YnLR5OzByHpbkFP9g=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ozySzmf8WFQWwRft1h2KugvLbsz6kcsR6fON/ygFdVapVuNjCip4ASpRY2MXRRkI/ gtNWZcHF5BFXe1h8jY3ZfHephWM+f4BZE3jKdhN+jHV2WGJ66+sosKn8Sk8ky20xoi 001g3YgechcKjBifL5DHMLnjLTCpOTJv3ucYz7p0cZakgUiUWTpLFbRjaOnSozWFxo T73IimRgPsP5hUlOTVRUbIXS0SsU9BfnD1nWwjziuyvuGSAtzcx2RIXI9Peqc813vF vbd69KHcoDZRMT1xYNZyojv03lbGi5gUIQ15GOqPwnry8E/+oCa59n2SxyK5hnWfhi 2m++BJy3Fiypw== Date: Thu, 10 Oct 2024 18:40:27 -0700 Subject: [PATCH 09/11] xfs: create fuzz tests for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658134.4187056.2066555135807219372.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 f95a5a6d1d970e..39cb04ff2cddcd 100644 --- a/common/xfs +++ b/common/xfs @@ -1929,3 +1929,25 @@ _xfs_calc_hidden_quota_files() { echo 0 fi } + +_require_xfs_mkfs_metadir() +{ + _scratch_mkfs_xfs_supported -m metadir=1 >/dev/null 2>&1 || \ + _notrun "mkfs.xfs doesn't have metadir features" +} + +_require_xfs_scratch_metadir() +{ + _require_xfs_mkfs_metadir + _require_scratch + + _scratch_mkfs -m metadir=1 &> /dev/null + _require_scratch_xfs_features METADIR + _try_scratch_mount + res=$? + if [ $res -ne 0 ]; then + _notrun "mounting with metadir not supported by filesystem type: $FSTYP" + else + _scratch_unmount + fi +} diff --git a/tests/xfs/1546 b/tests/xfs/1546 new file mode 100755 index 00000000000000..e41ee0d4a6c759 --- /dev/null +++ b/tests/xfs/1546 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1546 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1546.out b/tests/xfs/1546.out new file mode 100644 index 00000000000000..b72891a7583c04 --- /dev/null +++ b/tests/xfs/1546.out @@ -0,0 +1,4 @@ +QA output created by 1546 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1547 b/tests/xfs/1547 new file mode 100755 index 00000000000000..b82c2ef6a87aed --- /dev/null +++ b/tests/xfs/1547 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1547 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1547.out b/tests/xfs/1547.out new file mode 100644 index 00000000000000..983cc01343e5f4 --- /dev/null +++ b/tests/xfs/1547.out @@ -0,0 +1,4 @@ +QA output created by 1547 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1548 b/tests/xfs/1548 new file mode 100755 index 00000000000000..b2ca3016842e3a --- /dev/null +++ b/tests/xfs/1548 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1548 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1548.out b/tests/xfs/1548.out new file mode 100644 index 00000000000000..9e395bb059436d --- /dev/null +++ b/tests/xfs/1548.out @@ -0,0 +1,4 @@ +QA output created by 1548 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1549 b/tests/xfs/1549 new file mode 100755 index 00000000000000..f0b01c9ce1e177 --- /dev/null +++ b/tests/xfs/1549 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1549 +# +# Populate a XFS filesystem and fuzz every metadir root field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /') + +echo "Fuzz metadir root" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /' >> $seqres.full +echo "Done fuzzing metadir root" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1549.out b/tests/xfs/1549.out new file mode 100644 index 00000000000000..22b3d215e32e7b --- /dev/null +++ b/tests/xfs/1549.out @@ -0,0 +1,4 @@ +QA output created by 1549 +Format and populate +Fuzz metadir root +Done fuzzing metadir root diff --git a/tests/xfs/1550 b/tests/xfs/1550 new file mode 100755 index 00000000000000..b8da04676cd6b3 --- /dev/null +++ b/tests/xfs/1550 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1550 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_scrub to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_online_repair realtime + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1550.out b/tests/xfs/1550.out new file mode 100644 index 00000000000000..7694cd670bd25b --- /dev/null +++ b/tests/xfs/1550.out @@ -0,0 +1,4 @@ +QA output created by 1550 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1551 b/tests/xfs/1551 new file mode 100755 index 00000000000000..df721d9b34dae2 --- /dev/null +++ b/tests/xfs/1551 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1551 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Use xfs_repair to fix the corruption. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_scrub dangerous_repair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1551.out b/tests/xfs/1551.out new file mode 100644 index 00000000000000..4c3360d08b34f8 --- /dev/null +++ b/tests/xfs/1551.out @@ -0,0 +1,4 @@ +QA output created by 1551 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1552 b/tests/xfs/1552 new file mode 100755 index 00000000000000..8672cb3c08bedf --- /dev/null +++ b/tests/xfs/1552 @@ -0,0 +1,34 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1552 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Do not fix the filesystem, to test metadata verifiers. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_norepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1552.out b/tests/xfs/1552.out new file mode 100644 index 00000000000000..6636b1b656c926 --- /dev/null +++ b/tests/xfs/1552.out @@ -0,0 +1,4 @@ +QA output created by 1552 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir diff --git a/tests/xfs/1553 b/tests/xfs/1553 new file mode 100755 index 00000000000000..b98ad67904c31f --- /dev/null +++ b/tests/xfs/1553 @@ -0,0 +1,35 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022-2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1553 +# +# Populate a XFS filesystem and fuzz every metadir subdir field. +# Try online repair and, if necessary, offline repair, +# to test the most likely usage pattern. + +. ./common/preamble +_begin_fstest dangerous_fuzzers dangerous_bothrepair + +_register_cleanup "_cleanup" BUS + +. ./common/filter +. ./common/populate +. ./common/fuzzy + +_require_xfs_scratch_metadir +_require_scratch_xfs_fuzz_fields +_disable_dmesg_check + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +inode_ver=$(_scratch_xfs_get_metadata_field "core.version" 'path -m /rtgroups') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /rtgroups' >> $seqres.full +echo "Done fuzzing metadir subdir" + +# success, all done +status=0 +exit diff --git a/tests/xfs/1553.out b/tests/xfs/1553.out new file mode 100644 index 00000000000000..0298fcfddbf15a --- /dev/null +++ b/tests/xfs/1553.out @@ -0,0 +1,4 @@ +QA output created by 1553 +Format and populate +Fuzz metadir subdir +Done fuzzing metadir subdir From patchwork Fri Oct 11 01:40:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831911 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 EF27E1078F; Fri, 11 Oct 2024 01:40: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=1728610844; cv=none; b=f7YqsgQLguqA9iqdXR+AuzxMmoH/6FLL96OVwnTuf3cradFmknOfCiXecoGwvqri3bbfZNkRSleLKdEGjtuXIayLEemvbFzeNWz9z7AWMFfUjwmHKFaG+KBe8LfyCTlWTSQ+TY+gAfeD0tjK9mJxz/z0miO0jtWpz07l3pUW+1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610844; c=relaxed/simple; bh=IcBZqzFoW0T1E5hAq/B6WxtZSPbrvka7PN+YPPQZKxM=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=seNUmZI6mgkjVdZ7gfP4h0+3rU9f9kJBV8qAzlFItkItESrgUGYWrmtmk5hw096n+G6hiYH+7s6hsqMZzUHwL75T5y0VCysCq2Cdfq7/3iMOBZzliHxCufSmlA5FYV3tyNg/dVreK8bMY522qDm+J1+wbu082sGqEnEDpV2M6Js= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EUVNJDQA; 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="EUVNJDQA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEC07C4CEC5; Fri, 11 Oct 2024 01:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610843; bh=IcBZqzFoW0T1E5hAq/B6WxtZSPbrvka7PN+YPPQZKxM=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=EUVNJDQAb8ROyGq6rpYDTKoeNpRcym+TjfXQx4ypZ7dteahUKpJ9N8gpaiSHd3+PM 6LZJq/HlCGl0QqAqBp6WfaSB2hNZXrQJAk7mY+eP1kuAevY983Vrh108gUgARDV5AW FSeFJtwvUrljmhAT2AD3a1p6b1XXRhtAd9GjclbaT+YhXotgSopq6odUmRjcb9hSS9 2VYQiWmtRXKCRKAaJuMFI8peIHcSGvihvW/Wrq19lM5ADO7+GBWWxReGRATIgizNEJ peTGXDQ9J5j/NYCqzGzxA+L2RXZmoZniLJEK+DKsAHe+NP7uLnxO7pVMK6qcz5OQDb 2aegjsZSu1yFA== Date: Thu, 10 Oct 2024 18:40:43 -0700 Subject: [PATCH 10/11] xfs/163: bigger fs for metadir From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658149.4187056.14339832597478812540.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 2bd94060222f96..04b09d15afadfe 100755 --- a/tests/xfs/163 +++ b/tests/xfs/163 @@ -35,7 +35,7 @@ echo "Format and mount" # agcount = 1 is forbidden on purpose, and need to ensure shrinking to # 2 AGs isn't feasible yet. So agcount = 3 is the minimum number now. -_scratch_mkfs -dsize="$((512 * 1024 * 1024))" -dagcount=3 2>&1 | \ +_scratch_mkfs -dsize="$((900 * 1024 * 1024))" -dagcount=3 2>&1 | \ tee -a $seqres.full | _filter_mkfs 2>$tmp.mkfs >/dev/null . $tmp.mkfs t_dblocks=$dblocks From patchwork Fri Oct 11 01:40:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13831912 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 C2E6417543; Fri, 11 Oct 2024 01:40: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=1728610859; cv=none; b=dXyRaxcwxkUhaPQtZHzCqYr3iiIbL3MWH5QqK583hJOXbMQl6rz9U5uTC+Rr5TigAPfRHlXu+8uwJZ9FKmrcTny4KdELlmqjJ3e2RDXZe/VgzdaxR4Z1to0+rJLHboSyirzMp+tZTVL0c0o7qibWVPyqpSiETIzZFWvXFP3IoRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728610859; c=relaxed/simple; bh=t1oMc7glNenMc6FbLw1gl0UfcVr1qyPt+gyFFa3qgT0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=plEHXFG1vVNZe4rKEKcwnhUG6NSnjYIYFgm9afZfSsDlBChcj0Yjwjm8REywwJaJLR9nwR/9jOLck0Bem3JTp1iS9eXH8SGEQgG4kOCM49BU1adMFMH+37R6yBvwMnQyS/yA8wf5lQIf3UUHt9KAw/rjFpIHSaDmyR8K9FlvD+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pv8kO4i6; 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="pv8kO4i6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E43DC4CEC5; Fri, 11 Oct 2024 01:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728610859; bh=t1oMc7glNenMc6FbLw1gl0UfcVr1qyPt+gyFFa3qgT0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=pv8kO4i66Y/2KPDH2ixPvdS1rGzX+PtuRnh5e83Jpud9fZ8Of7pmmLx2VeWH/vgGK uLaYos1ubXZxH6gZEZhLmD5ee6X0/3WyWvXN28uZHuDIJ6hAHg0gDuEuKerE7lYiIB d92/roUiXZXoSm45zNWC656ugOnWmESVYmHDU1QJmS/XIg/nzL/7FfuBaMGpfVNsa6 /3D/yV/oJVqebGnsZ+6tEIwDsJwYy8yuZaesmmeLLpxVOO/jv1nMBUlmZy7wzmhvok 0FwIymhXa7F0szzL2B4V+gJazWMp9oYpdOWczLt6P1X3ezkPg0/i9qAVwNhZNp3ikN dQyLo2gqYwGkA== Date: Thu, 10 Oct 2024 18:40:58 -0700 Subject: [PATCH 11/11] xfs: test metapath repairs From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, fstests@vger.kernel.org Message-ID: <172860658165.4187056.7707069103931704194.stgit@frogsfrogsfrogs> In-Reply-To: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> References: <172860657983.4187056.5472629319415849070.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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..9a5eda43d38fdc --- /dev/null +++ b/tests/xfs/1874 @@ -0,0 +1,119 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2023-2024 Oracle. All Rights Reserved. +# +# FS QA Test 1874 +# +# Functional test of using online repair to fix metadir paths. +# +. ./common/preamble +_begin_fstest auto online_repair + +. ./common/filter +. ./common/inject +. ./common/fuzzy +. ./common/quota + +_require_xfs_db_command "link" +_require_xfs_db_command "unlink" +_require_scratch +_require_xfs_stress_online_repair + +prepare_fs() { + # Format filesystem + _scratch_mkfs | _filter_mkfs 2> $tmp.mkfs >> $seqres.full + _scratch_mount + + _require_xfs_has_feature "$SCRATCH_MNT" rmapbt + _require_xfs_has_feature "$SCRATCH_MNT" realtime + _require_xfs_has_feature "$SCRATCH_MNT" metadir + _require_xfs_has_feature "$SCRATCH_MNT" parent + + root_inum="$(stat -c '%i' $SCRATCH_MNT)" + __stress_scrub_check_commands "%dir%" '' '' 'scrub metapath' + _scratch_unmount + + # Stash the /rtgroups inode number and gen + rt_metadir_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups') + rt_metadir_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups') + + # Stash the /rtgroups/0.rmap inode number and gen + rbm_inum=$(_scratch_xfs_get_metadata_field v3.inumber 'path -m /rtgroups/0.rmap') + rbm_gen=$(_scratch_xfs_get_metadata_field core.gen 'path -m /rtgroups/0.rmap') + + # Fuzz parent pointer in rtgroup 0 rmap file + _scratch_xfs_db -x \ + -c 'path -m /rtgroups/0.rmap' \ + -c "write -d a.sfattr.list[0].parent_dir.inumber $root_inum" >> $seqres.full +} + +simple_online_repair() { + echo "check /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -c "scrub directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -c "scrub parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + echo "check /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -c "scrub metapath rtrmapbt 0" $SCRATCH_MNT + + echo "check nlinks" | _tee_kernlog + $XFS_IO_PROG -c "scrub nlinks" $SCRATCH_MNT + + # Destroying a metadir path (e.g. /rtgroups/0.rmap) cannot be done + # offline because then the mount will fail. Hence we must use a + # specific sequence of online repairs to remove the metadir path link. + # Only then can we use the metapath scrubber to restore the link. + + # Force repair the parent directory. Since /rtgroups/0.rmap has a bad + # parent pointer, the "0.rmap" entry in /rtgroups will not be created. + echo "fix /rtgroups dir" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R directory $rt_metadir_inum $rt_metadir_gen" $SCRATCH_MNT + + # Force repair the parent pointer. Since the "0.rmap" entry in + # /rtgroups no longer exists and no other directories count the + # rtgroup 0 rmap as a parent, this will fail cross-referencing after + # the repair. + echo "fix /rtgroups/0.rmap pptr" | _tee_kernlog + $XFS_IO_PROG -x -c "repair -R parent $rbm_inum $rbm_gen" $SCRATCH_MNT + + # Now that we've completely erased the /rtgroups/0.rmap path, check + # that the link is indeed lost, and restore the link. + echo "fix /rtgroups/0.rmap metapath" | _tee_kernlog + $XFS_IO_PROG -x -c "repair metapath rtrmapbt 0" $SCRATCH_MNT + + # Make sure we're not missing any link count + echo "fix nlinks" | _tee_kernlog + $XFS_IO_PROG -x -c "repair nlinks" $SCRATCH_MNT +} + +echo Part 1: Use raw ioctls to detect the error and fix it. +prepare_fs +_scratch_mount +simple_online_repair +_check_scratch_fs +_scratch_unmount + +echo Part 2: Use xfs_scrub to detect the error and fix it. +prepare_fs +_scratch_mount +echo "fix with xfs_scrub" | _tee_kernlog +_scratch_scrub &>> $seqres.full +echo "xfs_scrub returned $?" >> $seqres.full +_check_scratch_fs +_scratch_unmount + +echo Part 3: Use xfs_repair to detect the error and fix it. +prepare_fs +echo "fix with xfs_repair" | _tee_kernlog +echo repair?? >> $seqres.full +_scratch_xfs_repair &>> $seqres.full +echo "xfs_repair returned $?" >> $seqres.full +_scratch_mount +_check_scratch_fs +_scratch_unmount + +echo "done with test" | _tee_kernlog +# success, all done +status=0 +exit diff --git a/tests/xfs/1874.out b/tests/xfs/1874.out new file mode 100644 index 00000000000000..ff4497363d8063 --- /dev/null +++ b/tests/xfs/1874.out @@ -0,0 +1,19 @@ +QA output created by 1874 +Part 1: Use raw ioctls to detect the error and fix it. +check /rtgroups dir +Corruption detected during cross-referencing. +check /rtgroups/0.rmap pptr +Corruption detected during cross-referencing. +check /rtgroups/0.rmap metapath +check nlinks +fix /rtgroups dir +fix /rtgroups/0.rmap pptr +Corruption remains. +Corruption still detected during cross-referencing. +fix /rtgroups/0.rmap metapath +fix nlinks +Part 2: Use xfs_scrub to detect the error and fix it. +fix with xfs_scrub +Part 3: Use xfs_repair to detect the error and fix it. +fix with xfs_repair +done with test