From patchwork Fri Dec 30 22:20:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 718D3C46467 for ; Sat, 31 Dec 2022 03:07:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236268AbiLaDGb (ORCPT ); Fri, 30 Dec 2022 22:06:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236304AbiLaDGY (ORCPT ); Fri, 30 Dec 2022 22:06:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45DF9DFA; Fri, 30 Dec 2022 19:06:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB0FDB81EAA; Sat, 31 Dec 2022 03:06:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88F8FC433D2; Sat, 31 Dec 2022 03:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672455981; bh=3t+x6wcvdnCnEZRkx5dETm8hgR3phjDiGKquSVrrHA4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=SpoR0U5aPJBRpnbPVg3sfwQQuA7UmNEHxwVl4IVqv9kuB45aNT7L8Mo6j0ykJeQS3 6DdNV8RBgv9rLqyKRn0hW5wC29VdJd6PogDRV/hqJ4St8kHEImRT0mEst0Ls5mGn+0 FFI2j6MkczT+sP+9n+P1FFjgmT8a40wXrocsRPVcDoyjk4fGIBG2OZAo3xxyoVMPov pjO83ONJFo35WbDSPXIedUdA9Jb8wtRrYgw6HOiNgg0V1uze9orgPLCBc+KPRAPbq0 Xhsg7UFKrBkXPdHl6ft+0hx/NnMPeKFYniE3kTg+s1u90a/HyxqplHdpXkSeB9Hq5c lMUFgYUWb3TKg== Subject: [PATCH 1/9] xfs/122: fix metadirino From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:32 -0800 Message-ID: <167243883260.736753.15941517302628210329.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 21549db7fd..eee6c1ee6d 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 Dec 30 22:20:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C160FC4332F for ; Sat, 31 Dec 2022 03:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236311AbiLaDHC (ORCPT ); Fri, 30 Dec 2022 22:07:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236286AbiLaDGl (ORCPT ); Fri, 30 Dec 2022 22:06:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7404DFA; Fri, 30 Dec 2022 19:06:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C707B81EA8; Sat, 31 Dec 2022 03:06:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24B4DC433D2; Sat, 31 Dec 2022 03:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672455997; bh=VgJ9cEz09ZH1XITN9ukLcQCzI/N0489JadDqrOTCtTI=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=bZoIKkTc/4HLBcljxIEa2tKJmTjjB0+pcsE3KhnIbvC6kISqD7Rd3q+7Ly+OsbOe9 +R0dBcnsPxz80aD76y/uvVrMa1z5WnXvYK9Zytz7bv3d2Gu9UCxXnGfyglKC7Z25ek wnYlpnglfoQIl57n411zevgU5ZGVvNz7S2shcNKbn5nxmP0U4oLiJs2b4DEFMAOZO8 RIMOgLLBnxwx3aXIqOJD6RveCWxHmX24SoXlY69Sxsd/T0giKmW1PE6cOTkfr9ovyr brUEUcn/11a8XRBhNS6LjxDkGs6GmcWIi8/VzbGnPj23CZ7Eiw17mX/7XhKfzU0cW4 RQygw6DawPikw== Subject: [PATCH 2/9] 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, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:32 -0800 Message-ID: <167243883271.736753.35967461928530874.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 | 32 ++++++++++++++++++++++++++++++-- tests/xfs/007 | 16 +++++++++------- tests/xfs/1562 | 9 ++------- tests/xfs/1563 | 9 ++------- tests/xfs/1564 | 9 ++------- tests/xfs/1565 | 9 ++------- tests/xfs/1566 | 9 ++------- tests/xfs/1567 | 9 ++------- tests/xfs/1568 | 9 ++------- tests/xfs/1569 | 9 ++------- tests/xfs/529 | 5 ++--- tests/xfs/530 | 6 ++---- 12 files changed, 59 insertions(+), 72 deletions(-) diff --git a/common/xfs b/common/xfs index 8b365ad18b..dafbd1b874 100644 --- a/common/xfs +++ b/common/xfs @@ -1396,7 +1396,7 @@ _scratch_get_bmx_prefix() { _scratch_get_iext_count() { - local ino=$1 + local selector=$1 local whichfork=$2 local field="" @@ -1411,7 +1411,7 @@ _scratch_get_iext_count() return 1 esac - _scratch_xfs_get_metadata_field $field "inode $ino" + _scratch_xfs_get_metadata_field $field "$selector" } # @@ -1742,3 +1742,31 @@ _require_xfs_scratch_atomicswap() _notrun "atomicswap dependencies not supported by scratch filesystem type: $FSTYP" _scratch_unmount } + +# Find a metadata file within an xfs filesystem. The sole argument is the +# name of the field within the superblock. +_scratch_xfs_find_metafile() +{ + local metafile="$1" + local selector= + + if ! _check_scratch_xfs_features METADIR > /dev/null; then + sb_field="$(_scratch_xfs_get_sb_field "$metafile")" + if echo "$sb_field" | grep -q -w 'not found'; then + return 1 + fi + selector="inode $sb_field" + else + case "${metafile}" in + "rootino") selector="path /";; + "uquotino") selector="path -m /quota/user";; + "gquotino") selector="path -m /quota/group";; + "pquotino") selector="path -m /quota/project";; + "rbmino") selector="path -m /realtime/bitmap";; + "rsumino") selector="path -m /realtime/summary";; + esac + fi + + echo "${selector}" + return 0 +} diff --git a/tests/xfs/007 b/tests/xfs/007 index 4f864100fd..6d6d828b13 100755 --- a/tests/xfs/007 +++ b/tests/xfs/007 @@ -22,6 +22,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 @@ -31,12 +36,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" @@ -66,8 +68,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/1562 b/tests/xfs/1562 index 015209eeb2..1e5b6881ee 100755 --- a/tests/xfs/1562 +++ b/tests/xfs/1562 @@ -27,13 +27,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/1563 b/tests/xfs/1563 index 2be0870a3d..a9da78106d 100755 --- a/tests/xfs/1563 +++ b/tests/xfs/1563 @@ -27,13 +27,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/1564 b/tests/xfs/1564 index c0d10ff0e9..4482861d50 100755 --- a/tests/xfs/1564 +++ b/tests/xfs/1564 @@ -27,13 +27,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/1565 b/tests/xfs/1565 index 6b4186fb3c..c43ccd848e 100755 --- a/tests/xfs/1565 +++ b/tests/xfs/1565 @@ -27,13 +27,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/1566 b/tests/xfs/1566 index 8d0f61ae10..aad4fafb15 100755 --- a/tests/xfs/1566 +++ b/tests/xfs/1566 @@ -28,13 +28,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/1567 b/tests/xfs/1567 index 7dc2012b67..ff782fc239 100755 --- a/tests/xfs/1567 +++ b/tests/xfs/1567 @@ -28,13 +28,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/1568 b/tests/xfs/1568 index c80640ef97..e2a28df58a 100755 --- a/tests/xfs/1568 +++ b/tests/xfs/1568 @@ -27,13 +27,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/1569 b/tests/xfs/1569 index e303f08ff5..dcb07440e8 100755 --- a/tests/xfs/1569 +++ b/tests/xfs/1569 @@ -27,13 +27,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 diff --git a/tests/xfs/529 b/tests/xfs/529 index 83d24da0ac..e10af6753b 100755 --- a/tests/xfs/529 +++ b/tests/xfs/529 @@ -159,9 +159,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 56f5e7ebdb..cb8c2e3978 100755 --- a/tests/xfs/530 +++ b/tests/xfs/530 @@ -104,10 +104,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" From patchwork Fri Dec 30 22:20:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F362EC4167B for ; Sat, 31 Dec 2022 03:07:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236286AbiLaDHD (ORCPT ); Fri, 30 Dec 2022 22:07:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbiLaDGy (ORCPT ); Fri, 30 Dec 2022 22:06:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B029B1117D; Fri, 30 Dec 2022 19:06:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FB5A61D33; Sat, 31 Dec 2022 03:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9A7BC433D2; Sat, 31 Dec 2022 03:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456012; bh=u3Pwql2JKSIQphxgfnnWr1hwq2Yfhh1lv9cIDyF5ASA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=LNdBU7d1pgJRlnOTOz5MpSiHfaF3q2RJnKg1pMad5jQAfdZr1dWQys2ATn/3Qn7hf VECtJh0YWe4TKYOKnWWRQjUrwhugDS7X3Wfhxlw5FN/hXJNyRIFlbRPnWSIdjMY17o jBz0CEZZpxQ5POULTjddrHaxdxMwXtFJkLBcK7dALdtgAGYha5qWWPOhUv0EVnAGyr 5h6Di2Mu/NgGGQviYKJ/cCZH6/EZAizig0w6fVw2YwqS+uzkgqbVBSOOPsZfEEca6I QehZBwbLMf4crAdFkC2TN2+d00vkMUz8dcm7AGx0vR45tVhxvT4wO7z4n2uSBZudCc kmzTYHbrjx5qA== Subject: [PATCH 3/9] 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, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:32 -0800 Message-ID: <167243883283.736753.490441868180062329.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 dafbd1b874..0f69d3eb18 100644 --- a/common/xfs +++ b/common/xfs @@ -1770,3 +1770,16 @@ _scratch_xfs_find_metafile() echo "${selector}" 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=\([01]\)/metadir=0/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 201a901579..a62ea4fab3 100755 --- a/tests/xfs/030 +++ b/tests/xfs/030 @@ -50,6 +50,7 @@ _supported_fs xfs _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 ef5dc4fa36..e886c15082 100755 --- a/tests/xfs/033 +++ b/tests/xfs/033 @@ -53,6 +53,7 @@ _supported_fs xfs _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 a65197cde3..72b4d347fd 100755 --- a/tests/xfs/178 +++ b/tests/xfs/178 @@ -45,6 +45,7 @@ _supported_fs xfs # fix filesystem, new mkfs.xfs will be fine. _require_scratch +_scratch_xfs_force_no_metadir _scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs test "${PIPESTATUS[0]}" -eq 0 || _fail "mkfs failed!" From patchwork Fri Dec 30 22:20:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E065C46467 for ; Sat, 31 Dec 2022 03:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236303AbiLaDHe (ORCPT ); Fri, 30 Dec 2022 22:07:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236274AbiLaDHL (ORCPT ); Fri, 30 Dec 2022 22:07:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C191054D; Fri, 30 Dec 2022 19:07:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7BB6EB81EA2; Sat, 31 Dec 2022 03:07:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E3E0C433D2; Sat, 31 Dec 2022 03:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456028; bh=zWcZvK5otpvmqwZPIb6vjxtYz/oRQJU1IbLgCJ+PSUg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PkRbSTuu8dfslv/tXHwtSP47qzfhRzTusebmZfNRmfypemrhyGxwEVE3cItINsWZO lGv/9PZnTgf61AOKvryfj3XNECP6vyQXFKHSM/e0U/zq4gh99gxRKO855bhnkAuM9A 9IqJUt3VBeKfX9NrTyQklirYRLVcSYJFMj8QNLYB7jG7MAebcCko1ARdhpkdSHHe4E 239PLFSO3+VdxBR9y00QQApvk5sn6uBIMoGMSmb8vVsYOXGPzk2n3vVT7HwlKhGoK5 +cxZhygpka1ZvvU+yRbbhW6ECVR7TClLDVgGK+1fsetbFt5chWhBx9tGAvZMfKnY90 OVjyQxfu72EIQ== Subject: [PATCH 4/9] 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, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:32 -0800 Message-ID: <167243883294.736753.7002825243368357123.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 8945d0028c..c3afcfb3e6 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 Dec 30 22:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EBC9C4332F for ; Sat, 31 Dec 2022 03:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236274AbiLaDHf (ORCPT ); Fri, 30 Dec 2022 22:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236305AbiLaDHZ (ORCPT ); Fri, 30 Dec 2022 22:07:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA7D21054D; Fri, 30 Dec 2022 19:07:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 85D3361D33; Sat, 31 Dec 2022 03:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6AB4C433D2; Sat, 31 Dec 2022 03:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456044; bh=Yuh6pKSVZBj0Aj5aA2CmOLwOL+2xwUaEJywYeik6uLU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PRrkUWs1aEDumXYWxi0aZdptThHthpNEfUAixbt3uAGUX/42YOtHoH5oPC+UZOhjl KdM3fy/zeFWYhBl97rdWG/j+CjpDzRrzyglvSlc/6U1B59KeCvbaihgctcYaObnONH 4s+NfHEvDrg/hgO9xCT4DzksXuBde15jvViwMjo9tE8/IVO2feH5EgZr/QzLMgkziR iGEpK9LVEdsa7MeHVYfc60m1UUnmo2kRb5p/PVrj2tl8XM4dGE4hNBetC/bdrCTNMw zYdnkfNfcqThyhullk183ZUKXxHjBhUcawT6K+9Ax/X8N7fPdl3wgJvrKu1A1aEQXF 5boE5/80xfMEA== Subject: [PATCH 5/9] xfs/206: update for metadata directory support From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:33 -0800 Message-ID: <167243883306.736753.14765365095410052316.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/xfs/206 b/tests/xfs/206 index cb346b6dc9..c181d7dd3e 100755 --- a/tests/xfs/206 +++ b/tests/xfs/206 @@ -64,7 +64,8 @@ mkfs_filter() -e "s/\(sunit=\)\([0-9]* blks,\)/\10 blks,/" \ -e "s/, lazy-count=[0-9]//" \ -e "/.*crc=/d" \ - -e "/^Default configuration/d" + -e "/^Default configuration/d" \ + -e "/metadir=.*/d" } # mkfs slightly smaller than that, small log for speed. From patchwork Fri Dec 30 22:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC460C5479D for ; Sat, 31 Dec 2022 03:08:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236216AbiLaDIH (ORCPT ); Fri, 30 Dec 2022 22:08:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbiLaDHn (ORCPT ); Fri, 30 Dec 2022 22:07:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ADE71054D; Fri, 30 Dec 2022 19:07:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C9A27B81EAB; Sat, 31 Dec 2022 03:07:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79EA2C433D2; Sat, 31 Dec 2022 03:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456059; bh=Ja2rsjmpbCQZlvCHfjK9BjCD4ORiClJi7K/yA4HQy+s=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nqYHnsOv+dHq4rbBCPUWkcYHm3Qxg3KyE3f8zs0mZOtCr+dcWQ7ncGRdVgGXb6nIp uYtPjBVHm2VQRIAROLYts3xrNOXt4GbNw4LEkt6NbJUuvngjFkwzE8ClJOkqvp9XUD GNzYFV01TfOqPqkrbCqh04qjZtY3HUylyl8lzmDHpm8HJk4deAFNPWT60lrgITgqzk l8PINx1g6tKNxB53wEx1cTQArFkFdKQXn06qj82ji+kkFqPTuTJZ5KH5x/qRuSDXmB O1RcgkYvfMrQGvcMIbPC6v71Xokm40fKHNFEjmVWChBfKA700C3LBSRwJf4W/H+sQi 9bBQ4tCLiBnSQ== Subject: [PATCH 6/9] xfs/{050,144,153,299,330}: update quota reports to leave out metadir files From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:33 -0800 Message-ID: <167243883317.736753.15243001924230247968.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Remove the metadata directory tree directories from the quota reporting in these tests so that we don't regress the golden output. Signed-off-by: Darrick J. Wong --- common/filter | 7 +++++-- common/xfs | 23 +++++++++++++++++++++++ tests/xfs/050 | 1 + tests/xfs/153 | 1 + tests/xfs/299 | 1 + tests/xfs/330 | 6 +++++- 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/common/filter b/common/filter index 3e3fea7ea0..49c6859992 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 qhidden_rootfiles 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 "$qhidden_rootfiles" || qhidden_rootfiles=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 = '"$qhidden_rootfiles"'; if ($ENV{'LARGE_SCRATCH_DEV'}) { $val = $ENV{'NUM_SPACE_FILES'}; } diff --git a/common/xfs b/common/xfs index 0f69d3eb18..99e377631b 100644 --- a/common/xfs +++ b/common/xfs @@ -1783,3 +1783,26 @@ _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 in the metadata directory tree. +_xfs_calc_metadir_files() { + local mount="$1" + + if ! _xfs_mount_has_metadir "$mount"; then + echo 0 + return + fi + + local regfiles="$($XFS_IO_PROG -c 'bulkstat' "$mount" | grep '^bs_ino' | wc -l)" + local metafiles="$($XFS_IO_PROG -c 'bulkstat -m' "$mount" 2>&1 | grep '^bs_ino' | wc -l)" + echo $((metafiles - regfiles)) +} diff --git a/tests/xfs/050 b/tests/xfs/050 index 2220e47016..64fbaf687d 100755 --- a/tests/xfs/050 +++ b/tests/xfs/050 @@ -34,6 +34,7 @@ _require_xfs_quota _scratch_mkfs >/dev/null 2>&1 _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +qhidden_rootfiles=$(_xfs_calc_metadir_files $SCRATCH_MNT) _scratch_unmount bsoft=$(( 200 * $bsize )) diff --git a/tests/xfs/153 b/tests/xfs/153 index dbe26b6803..fc64bf734a 100755 --- a/tests/xfs/153 +++ b/tests/xfs/153 @@ -39,6 +39,7 @@ _require_test_program "vfs/mount-idmapped" _scratch_mkfs >/dev/null 2>&1 _scratch_mount bsize=$(_get_file_block_size $SCRATCH_MNT) +qhidden_rootfiles=$(_xfs_calc_metadir_files $SCRATCH_MNT) _scratch_unmount bsoft=$(( 200 * $bsize )) diff --git a/tests/xfs/299 b/tests/xfs/299 index 4b9df3c6aa..2167c492c4 100755 --- a/tests/xfs/299 +++ b/tests/xfs/299 @@ -159,6 +159,7 @@ _qmount_option "uquota,gquota,pquota" _qmount bsize=$(_get_file_block_size $SCRATCH_MNT) +qhidden_rootfiles=$(_xfs_calc_metadir_files $SCRATCH_MNT) bsoft=$(( 100 * $bsize )) bhard=$(( 500 * $bsize )) diff --git a/tests/xfs/330 b/tests/xfs/330 index c6e74e67e8..e919ccc1ca 100755 --- a/tests/xfs/330 +++ b/tests/xfs/330 @@ -26,7 +26,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 = '"$qhidden_rootfiles"'; + s/(^root\s+--\s+\S+\s+\S+\s+\S+\s+)(\S+)/$1@{[$2 - $val]}/g' } rm -f "$seqres.full" @@ -35,6 +38,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 +qhidden_rootfiles=$(_xfs_calc_metadir_files $SCRATCH_MNT) quotacheck -u -g $SCRATCH_MNT 2> /dev/null quotaon $SCRATCH_MNT 2> /dev/null From patchwork Fri Dec 30 22:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085838 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24666C54EBC for ; Sat, 31 Dec 2022 03:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236312AbiLaDII (ORCPT ); Fri, 30 Dec 2022 22:08:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236310AbiLaDH4 (ORCPT ); Fri, 30 Dec 2022 22:07:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0262210540; Fri, 30 Dec 2022 19:07:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9EDE361D33; Sat, 31 Dec 2022 03:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 094DFC433EF; Sat, 31 Dec 2022 03:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456075; bh=kE8TtzatSYZ+X71XfAWYa6GAAtZBAoO2+y6B92LdhXw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=SgB7a6DR69mvi5pKQjKX4kCyOHR8tGch6edERFj4Op0770h0nWzHTvE3WVEz2+jBB 268cEryD72ZmkTvMivNh1CWiQyxmsUWMHd2j2luX6htTMZu3DI0EH4HE+iWhp3AVi/ IWFJnFf2CEE/p2bWaiWL5UJcmbK6ibJwlYW9mk61mVA2Uhw4H1b8RcIFWIKr/hBiCD bndeCfOKqrEeOflN8ShEw94XJv3p5Nsx1a2f7Fb2dVkVYJXLqJ8LAdFMTarHNAXl27 KIOsJZf1QGLDMXhIYdtynBinjROMtKOtdloPJ77AMclW/OE/zSF0+c+RJkANyGTcR/ LTJpxhuZWMDZw== Subject: [PATCH 7/9] xfs/769: add metadir upgrade to test matrix From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:33 -0800 Message-ID: <167243883329.736753.2626034785600768252.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add metadata directory trees to the features that this test will try to upgrade. Signed-off-by: Darrick J. Wong --- tests/xfs/769 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/xfs/769 b/tests/xfs/769 index 7613048f52..624dd2a338 100755 --- a/tests/xfs/769 +++ b/tests/xfs/769 @@ -174,12 +174,14 @@ if rt_configured; then check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") + check_repair_upgrade metadir && FEATURES+=("metadir") else check_repair_upgrade finobt && FEATURES+=("finobt") check_repair_upgrade rmapbt && FEATURES+=("rmapbt") check_repair_upgrade reflink && FEATURES+=("reflink") check_repair_upgrade inobtcount && FEATURES+=("inobtcount") check_repair_upgrade bigtime && FEATURES+=("bigtime") + check_repair_upgrade metadir && FEATURES+=("metadir") fi test "${#FEATURES[@]}" -eq 0 && \ From patchwork Fri Dec 30 22:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0893FC4167B for ; Sat, 31 Dec 2022 03:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236320AbiLaDIS (ORCPT ); Fri, 30 Dec 2022 22:08:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236269AbiLaDIO (ORCPT ); Fri, 30 Dec 2022 22:08:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32D6515816; Fri, 30 Dec 2022 19:08:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6C53B81E6C; Sat, 31 Dec 2022 03:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 904C4C433EF; Sat, 31 Dec 2022 03:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456090; bh=+36B7195VR9jl2Gu3IH7SWLqhI39xRLJcR776BqQRbg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=br40B4dtO6PGOHx/5NQ5JMtMVtPPXZtuXjO2inqTKqNU35r5zNzvOSfSMsqeJmHEk DhvmcHIgVdD4qIAtF0VH3mBJ0Jz2UKq0VKYBZ5Tc/3OB3pB528c1IpTW0VtolQZ2fQ Q5qDI5wtsBj5b0MnXbJ7PRGwHlL3emDfvhNjCSsmHiJDGXdi9DrC5mm7PS7/Rr1r2E i689VzY9JNVj0QdB8hNljtOOkX52Ya7NFbR1/e/QT0Ltz5efpCsPK/YYyR3F2MrPyT lDb3IM+m3gmrXGhuuE0+B0FpI6uY3vOk93A6Mwt23IwdKZGSq3C+0Q1JmkbtlXjA5R miLVpTYwObCcg== Subject: [PATCH 8/9] 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, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:33 -0800 Message-ID: <167243883340.736753.11887860537534885651.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/xfs/509 b/tests/xfs/509 index d04dfbbfba..b87abef964 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 } @@ -143,9 +143,26 @@ _supported_fs xfs DIRCOUNT=8 INOCOUNT=$((2048 / DIRCOUNT)) +# Count everything in the metadata directory tree. +count_metadir_files() { + local metadirs=('/realtime' '/quota') + 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 Dec 30 22:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085840 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5AFCC4167B for ; Sat, 31 Dec 2022 03:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236269AbiLaDI3 (ORCPT ); Fri, 30 Dec 2022 22:08:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236316AbiLaDI2 (ORCPT ); Fri, 30 Dec 2022 22:08:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32CD81054D; Fri, 30 Dec 2022 19:08:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B20E461D33; Sat, 31 Dec 2022 03:08:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D024C433EF; Sat, 31 Dec 2022 03:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672456106; bh=IYhc+HmsqaNHoWwpZz/jZLTCQqHhZF3GWE+egNFNDns=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=RS4c/E18D6TyUT1OXaiAVWOy1Eb+2ZXidxG8YVnmN8RyoIICuzC59vgP0EAduDsIk lVPRxytU/wIMlSahwY3yWYP3vcTaHf6jng32LKsk77gA+X45yT2VZCPbTIQzWG5/DC 1zSmFVatX8GRxHPDrhNhZzH2ISP1OHs2vqJK/+xfarnpMRWuR/dHS3TpAe+dn/03rn cTjFvPv/zLNVAPzuCeHs90zRTZWdi6d3h3MioMn3ndl38IDSTWYVM8zycNDHVk2qxd CW4lC9X9wFSoLRmoXMPdAA0R5mUAq4gRXN3jgtzRJdW7WAbNpyeTUo9XLU9pC/cO2L uiwfope2tcziw== Subject: [PATCH 9/9] xfs: create fuzz tests for metadata directories From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Date: Fri, 30 Dec 2022 14:20:33 -0800 Message-ID: <167243883352.736753.14842800987314221725.stgit@magnolia> In-Reply-To: <167243883244.736753.17143383151073497149.stgit@magnolia> References: <167243883244.736753.17143383151073497149.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org 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 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1546.out | 4 ++++ tests/xfs/1547 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1547.out | 4 ++++ tests/xfs/1548 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1548.out | 4 ++++ tests/xfs/1549 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/1549.out | 4 ++++ tests/xfs/1550 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1550.out | 4 ++++ tests/xfs/1551 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1551.out | 4 ++++ tests/xfs/1552 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/1552.out | 4 ++++ tests/xfs/1553 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/1553.out | 4 ++++ 17 files changed, 352 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 99e377631b..77af8a6d60 100644 --- a/common/xfs +++ b/common/xfs @@ -1806,3 +1806,25 @@ _xfs_calc_metadir_files() { local metafiles="$($XFS_IO_PROG -c 'bulkstat -m' "$mount" 2>&1 | grep '^bs_ino' | wc -l)" echo $((metafiles - regfiles)) } + +_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 0000000000..5b48463abe --- /dev/null +++ b/tests/xfs/1546 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 0000000000..b72891a758 --- /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 0000000000..ff86bc657e --- /dev/null +++ b/tests/xfs/1547 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 0000000000..983cc01343 --- /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 0000000000..1f29dfda3b --- /dev/null +++ b/tests/xfs/1548 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 0000000000..9e395bb059 --- /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 0000000000..865023f218 --- /dev/null +++ b/tests/xfs/1549 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 0000000000..22b3d215e3 --- /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 0000000000..62219e65fc --- /dev/null +++ b/tests/xfs/1550 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 /realtime') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'online' 'path -m /realtime' >> $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 0000000000..7694cd670b --- /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 0000000000..f101529364 --- /dev/null +++ b/tests/xfs/1551 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 /realtime') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'offline' 'path -m /realtime' >> $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 0000000000..4c3360d08b --- /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 0000000000..ab3b89ec40 --- /dev/null +++ b/tests/xfs/1552 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 /realtime') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'none' 'path -m /realtime' >> $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 0000000000..6636b1b656 --- /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 0000000000..6acbacbe16 --- /dev/null +++ b/tests/xfs/1553 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 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 + +# Import common functions. +. ./common/filter +. ./common/populate +. ./common/fuzzy + +# real QA test starts here +_supported_fs xfs +_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 /realtime') + +echo "Fuzz metadir subdir" +_scratch_xfs_fuzz_metadata '' 'both' 'path -m /realtime' >> $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 0000000000..0298fcfddb --- /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