From patchwork Fri Dec 30 22:19:06 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: 13085188 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 B0B86C3DA7C for ; Sat, 31 Dec 2022 00:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235836AbiLaAjA (ORCPT ); Fri, 30 Dec 2022 19:39:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235750AbiLaAi6 (ORCPT ); Fri, 30 Dec 2022 19:38:58 -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 CBE701E3EE; Fri, 30 Dec 2022 16:38:57 -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 69CA761CF1; Sat, 31 Dec 2022 00:38:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8CB7C433D2; Sat, 31 Dec 2022 00:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447136; bh=8uUp+jz76PhiBHJsOCR1Uj3kMa5h+L0eJ60EOdh5F/4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Fw5RiQCXrh5bTx9XGlw2q9T1Lg/F1ea9pVZCD0Y+g/wncPGPAY3RPuf8ZxM0X8jkj 4rWoQdijtiE2+B58mHKuExKrH9MK6mwnlPIwHHPvezOJ6X3CyE5BdSJmLaRPOfr8d3 4Zn8bEwvhMaf7JseCB/YDWsEm+O7Mr4gUlm9W/3bG3dLp85MZ0YDLAyCBI6vztxsd+ dl/dVE0L3ZGD3pQ6Ar/l6cxHDcc+vULAnjXa0yUqAuZgX/DFyqKj75ErI9JPKDs0HB Yq57nQaK+ZxMIbuDUyauqymWNVzKLAV6+7SFqS/yZ24i5sveywblY5IQJsJkbs+ibr nL/bSJ/PSLH3g== Subject: [PATCH 1/5] xfs/357: switch fuzzing to agi 1 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:19:06 -0800 Message-ID: <167243874627.722028.4085306307237352574.stgit@magnolia> In-Reply-To: <167243874614.722028.11987534226186856347.stgit@magnolia> References: <167243874614.722028.11987534226186856347.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 Since we now require a working AGI 0 to mount the system, fuzz AGI 1 instead. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang --- tests/xfs/357 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xfs/357 b/tests/xfs/357 index 8a2c920ef4..25af8624db 100755 --- a/tests/xfs/357 +++ b/tests/xfs/357 @@ -25,7 +25,7 @@ echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 echo "Fuzz AGI" -_scratch_xfs_fuzz_metadata '' 'online' 'agi 0' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' 'agi 1' >> $seqres.full echo "Done fuzzing AGI" # success, all done From patchwork Fri Dec 30 22:19:06 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: 13085189 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 2267EC3DA7C for ; Sat, 31 Dec 2022 00:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235750AbiLaAjS (ORCPT ); Fri, 30 Dec 2022 19:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235484AbiLaAjR (ORCPT ); Fri, 30 Dec 2022 19:39:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F8A31E3EE; Fri, 30 Dec 2022 16:39:15 -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 A21C1B81E0F; Sat, 31 Dec 2022 00:39:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5786AC433D2; Sat, 31 Dec 2022 00:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447152; bh=a8f6Qy3Ev7YJaFgQslVhUfdPxh05pGDxp1ZYVUzNm1Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=u289d3AKOEs9F7xdp32LQXAEsXYh1H984A/l6Z/u03N2dhHsJmgzYAjhWkUtyTeuM KL372qZfV+1AQijdrrophaoYON43+RAtxP4fSzy1WccRXA6fNQL0eIVztuNFZJz0ww 1CXnOVjw8C7Fx1MWYgMnsFd1S3AoaKvCXlhzofaLaGUXShEl9ibp9GKibu9UWa0SAb N40iKNUIlHZktunM76Av6ltmk4itWsva1A/6A+qpanC/mOEkhDQY8QyQ6vheGYnrfC I0Z5/8uk2YGzXA+OyoD0DUsyvOxLQ0zCvXUHXZA6eNp7doODqFSoDgXHGmOdaLxRUJ HXv+hPVi0n0lg== Subject: [PATCH 2/5] xfs: race fsstress with online scrubbers for AG and fs metadata 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:19:06 -0800 Message-ID: <167243874639.722028.9759938995780056273.stgit@magnolia> In-Reply-To: <167243874614.722028.11987534226186856347.stgit@magnolia> References: <167243874614.722028.11987534226186856347.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 For each XFS_SCRUB_TYPE_* that looks at AG or filesystem metadata, create a test that runs that scrubber in the foreground and fsstress in the background. Signed-off-by: Darrick J. Wong --- common/quota | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/group-names.txt | 1 + tests/xfs/782 | 37 +++++++++++++++++++++++++++++ tests/xfs/782.out | 2 ++ tests/xfs/783 | 37 +++++++++++++++++++++++++++++ tests/xfs/783.out | 2 ++ tests/xfs/784 | 37 +++++++++++++++++++++++++++++ tests/xfs/784.out | 2 ++ tests/xfs/785 | 37 +++++++++++++++++++++++++++++ tests/xfs/785.out | 2 ++ tests/xfs/786 | 38 ++++++++++++++++++++++++++++++ tests/xfs/786.out | 2 ++ tests/xfs/787 | 38 ++++++++++++++++++++++++++++++ tests/xfs/787.out | 2 ++ tests/xfs/788 | 38 ++++++++++++++++++++++++++++++ tests/xfs/788.out | 2 ++ tests/xfs/789 | 39 +++++++++++++++++++++++++++++++ tests/xfs/789.out | 2 ++ tests/xfs/790 | 39 +++++++++++++++++++++++++++++++ tests/xfs/790.out | 2 ++ tests/xfs/791 | 40 ++++++++++++++++++++++++++++++++ tests/xfs/791.out | 2 ++ tests/xfs/798 | 44 +++++++++++++++++++++++++++++++++++ tests/xfs/798.out | 2 ++ tests/xfs/800 | 40 ++++++++++++++++++++++++++++++++ tests/xfs/800.out | 2 ++ tests/xfs/801 | 47 +++++++++++++++++++++++++++++++++++++ tests/xfs/801.out | 2 ++ tests/xfs/802 | 40 ++++++++++++++++++++++++++++++++ tests/xfs/802.out | 2 ++ tests/xfs/803 | 40 ++++++++++++++++++++++++++++++++ tests/xfs/803.out | 2 ++ tests/xfs/804 | 40 ++++++++++++++++++++++++++++++++ tests/xfs/804.out | 2 ++ tests/xfs/805 | 38 ++++++++++++++++++++++++++++++ tests/xfs/805.out | 2 ++ 36 files changed, 768 insertions(+) create mode 100755 tests/xfs/782 create mode 100644 tests/xfs/782.out create mode 100755 tests/xfs/783 create mode 100644 tests/xfs/783.out create mode 100755 tests/xfs/784 create mode 100644 tests/xfs/784.out create mode 100755 tests/xfs/785 create mode 100644 tests/xfs/785.out create mode 100755 tests/xfs/786 create mode 100644 tests/xfs/786.out create mode 100755 tests/xfs/787 create mode 100644 tests/xfs/787.out create mode 100755 tests/xfs/788 create mode 100644 tests/xfs/788.out create mode 100755 tests/xfs/789 create mode 100644 tests/xfs/789.out create mode 100755 tests/xfs/790 create mode 100644 tests/xfs/790.out create mode 100755 tests/xfs/791 create mode 100644 tests/xfs/791.out create mode 100755 tests/xfs/798 create mode 100644 tests/xfs/798.out create mode 100755 tests/xfs/800 create mode 100644 tests/xfs/800.out create mode 100755 tests/xfs/801 create mode 100644 tests/xfs/801.out create mode 100755 tests/xfs/802 create mode 100644 tests/xfs/802.out create mode 100755 tests/xfs/803 create mode 100644 tests/xfs/803.out create mode 100755 tests/xfs/804 create mode 100644 tests/xfs/804.out create mode 100755 tests/xfs/805 create mode 100644 tests/xfs/805.out diff --git a/common/quota b/common/quota index 24251d092a..96b8d04424 100644 --- a/common/quota +++ b/common/quota @@ -53,6 +53,70 @@ _require_xfs_quota() [ -n "$XFS_QUOTA_PROG" ] || _notrun "XFS quota user tools not installed" } +# Check that a mounted fs has a particular type of quota accounting turned on. +# +# The first argument must be the data device of a mounted fs. It must not be +# the actual mountpath. +# +# The second argument is the quota type ('usrquota', 'grpquota', 'prjquota', +# 'any', or 'all'). +_xfs_quota_acct_enabled() +{ + local dev="$1" + local qtype="$2" + local f_args=() + local any= + + case "$qtype" in + "usrquota"|"uquota") f_args=("-U");; + "grpquota"|"gquota") f_args=("-G");; + "prjquota"|"pquota") f_args=("-P");; + "all") f_args=("-U" "-G" "-P");; + "any") f_args=("-U" "-G" "-P"); any=1;; + *) echo "$qtype: Unknown quota type."; return 1;; + esac + + if [ "$any" = "1" ]; then + for arg in "$f_args"; do + $here/src/feature "$arg" "$dev" && return 0 + done + return 1 + fi + + $here/src/feature "${f_args[@]}" "$dev" +} + +# Require that a mounted fs has a particular type of quota turned on. This +# takes the same arguments as _xfs_quota_acct_enabled. If the third argument is +# '-u' (or is empty and dev is $SCRATCH_DEV) the fs will be unmounted on +# failure. +_require_xfs_quota_acct_enabled() +{ + local dev="$1" + local qtype="$2" + local umount="$3" + local fsname="$dev" + + _xfs_quota_acct_enabled "$dev" "$qtype" "$qmode" && return 0 + + if [ -z "$umount" ] && [ "$dev" = "$SCRATCH_DEV" ]; then + umount="-u" + fi + test "$umount" = "-u" && umount "$dev" &>/dev/null + + case "$dev" in + "$TEST_DEV") fsname="test";; + "$SCRATCH_DEV") fsname="scratch";; + esac + + case "$qtype" in + "any") qtype="any quotas";; + "all") qtype="all quotas";; + esac + + _notrun "$qtype: accounting not enabled on $fsname filesystem." +} + # # checks that xfs_quota can operate on foreign (non-xfs) filesystems # Skips check on xfs filesystems, old xfs_quota is fine there. diff --git a/doc/group-names.txt b/doc/group-names.txt index ac219e05b3..771ce937ae 100644 --- a/doc/group-names.txt +++ b/doc/group-names.txt @@ -35,6 +35,7 @@ dangerous_fuzzers fuzzers that can crash your computer dangerous_norepair fuzzers to evaluate kernel metadata verifiers dangerous_online_repair fuzzers to evaluate xfs_scrub online repair dangerous_fsstress_repair race fsstress and xfs_scrub online repair +dangerous_fsstress_scrub race fsstress and xfs_scrub checking dangerous_repair fuzzers to evaluate xfs_repair offline repair dangerous_scrub fuzzers to evaluate xfs_scrub checking data data loss checkers diff --git a/tests/xfs/782 b/tests/xfs/782 new file mode 100755 index 0000000000..4801eda4bd --- /dev/null +++ b/tests/xfs/782 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 782 +# +# Race fsstress and superblock scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub sb %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/782.out b/tests/xfs/782.out new file mode 100644 index 0000000000..6e378f0e53 --- /dev/null +++ b/tests/xfs/782.out @@ -0,0 +1,2 @@ +QA output created by 782 +Silence is golden diff --git a/tests/xfs/783 b/tests/xfs/783 new file mode 100755 index 0000000000..379a9369e5 --- /dev/null +++ b/tests/xfs/783 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 783 +# +# Race fsstress and AGF scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub agf %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/783.out b/tests/xfs/783.out new file mode 100644 index 0000000000..2522395956 --- /dev/null +++ b/tests/xfs/783.out @@ -0,0 +1,2 @@ +QA output created by 783 +Silence is golden diff --git a/tests/xfs/784 b/tests/xfs/784 new file mode 100755 index 0000000000..2b89361c36 --- /dev/null +++ b/tests/xfs/784 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 784 +# +# Race fsstress and AGFL scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub agfl %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/784.out b/tests/xfs/784.out new file mode 100644 index 0000000000..48d9b24dd0 --- /dev/null +++ b/tests/xfs/784.out @@ -0,0 +1,2 @@ +QA output created by 784 +Silence is golden diff --git a/tests/xfs/785 b/tests/xfs/785 new file mode 100755 index 0000000000..34a13b058d --- /dev/null +++ b/tests/xfs/785 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 785 +# +# Race fsstress and AGI scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub agi %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/785.out b/tests/xfs/785.out new file mode 100644 index 0000000000..6ecb0c61b3 --- /dev/null +++ b/tests/xfs/785.out @@ -0,0 +1,2 @@ +QA output created by 785 +Silence is golden diff --git a/tests/xfs/786 b/tests/xfs/786 new file mode 100755 index 0000000000..157200ea8c --- /dev/null +++ b/tests/xfs/786 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 786 +# +# Race fsstress and freespace by block btree scrub for a while to see if we +# crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub bnobt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/786.out b/tests/xfs/786.out new file mode 100644 index 0000000000..ccb9167df9 --- /dev/null +++ b/tests/xfs/786.out @@ -0,0 +1,2 @@ +QA output created by 786 +Silence is golden diff --git a/tests/xfs/787 b/tests/xfs/787 new file mode 100755 index 0000000000..91eaf5a7af --- /dev/null +++ b/tests/xfs/787 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 787 +# +# Race fsstress and free space by length btree scrub for a while to see if we +# crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub cntbt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/787.out b/tests/xfs/787.out new file mode 100644 index 0000000000..fa7f038120 --- /dev/null +++ b/tests/xfs/787.out @@ -0,0 +1,2 @@ +QA output created by 787 +Silence is golden diff --git a/tests/xfs/788 b/tests/xfs/788 new file mode 100755 index 0000000000..f1369e5309 --- /dev/null +++ b/tests/xfs/788 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 788 +# +# Race fsstress and inode btree scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -x 'dir' -s "scrub inobt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/788.out b/tests/xfs/788.out new file mode 100644 index 0000000000..5ddd661113 --- /dev/null +++ b/tests/xfs/788.out @@ -0,0 +1,2 @@ +QA output created by 788 +Silence is golden diff --git a/tests/xfs/789 b/tests/xfs/789 new file mode 100755 index 0000000000..550ff2c690 --- /dev/null +++ b/tests/xfs/789 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 789 +# +# Race fsstress and free inode btree scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" finobt +_scratch_xfs_stress_scrub -x 'dir' -s "scrub finobt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/789.out b/tests/xfs/789.out new file mode 100644 index 0000000000..da88fc99cb --- /dev/null +++ b/tests/xfs/789.out @@ -0,0 +1,2 @@ +QA output created by 789 +Silence is golden diff --git a/tests/xfs/790 b/tests/xfs/790 new file mode 100755 index 0000000000..c4e5779ef7 --- /dev/null +++ b/tests/xfs/790 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 790 +# +# Race fsstress and reverse mapping btree scrub for a while to see if we crash +# or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" rmapbt +_scratch_xfs_stress_scrub -s "scrub rmapbt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/790.out b/tests/xfs/790.out new file mode 100644 index 0000000000..7102c590f0 --- /dev/null +++ b/tests/xfs/790.out @@ -0,0 +1,2 @@ +QA output created by 790 +Silence is golden diff --git a/tests/xfs/791 b/tests/xfs/791 new file mode 100755 index 0000000000..6939d910c9 --- /dev/null +++ b/tests/xfs/791 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 791 +# +# Race fsstress and reference count btree scrub for a while to see if we crash +# or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/reflink + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" reflink +_scratch_xfs_stress_scrub -s "scrub refcountbt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/791.out b/tests/xfs/791.out new file mode 100644 index 0000000000..758905371d --- /dev/null +++ b/tests/xfs/791.out @@ -0,0 +1,2 @@ +QA output created by 791 +Silence is golden diff --git a/tests/xfs/798 b/tests/xfs/798 new file mode 100755 index 0000000000..c5bdfad50a --- /dev/null +++ b/tests/xfs/798 @@ -0,0 +1,44 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test No. 798 +# +# Race fsstress and fscounter scrub on the realtime device for a while to see +# if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime + +# Force all files to be allocated on the realtime device +_xfs_force_bdev realtime $SCRATCH_MNT + +_scratch_xfs_stress_scrub -s 'scrub fscounters' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/798.out b/tests/xfs/798.out new file mode 100644 index 0000000000..216d6e93f4 --- /dev/null +++ b/tests/xfs/798.out @@ -0,0 +1,2 @@ +QA output created by 798 +Silence is golden diff --git a/tests/xfs/800 b/tests/xfs/800 new file mode 100755 index 0000000000..cbcfb5f5a6 --- /dev/null +++ b/tests/xfs/800 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 800 +# +# Race fsstress and realtime bitmap scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime +_scratch_xfs_stress_scrub -s "scrub rtbitmap" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/800.out b/tests/xfs/800.out new file mode 100644 index 0000000000..bdfaa2cecd --- /dev/null +++ b/tests/xfs/800.out @@ -0,0 +1,2 @@ +QA output created by 800 +Silence is golden diff --git a/tests/xfs/801 b/tests/xfs/801 new file mode 100755 index 0000000000..a51fab523b --- /dev/null +++ b/tests/xfs/801 @@ -0,0 +1,47 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 801 +# +# Race fsstress and realtime summary scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_realtime +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" realtime + +# XXX the realtime summary scrubber isn't currently implemented upstream. +# Don't bother trying to test it on those kernels +$XFS_IO_PROG -c 'scrub rtsummary' -c 'scrub rtsummary' "$SCRATCH_MNT" 2>&1 | \ + grep -q 'Scan was not complete' && \ + _notrun "rtsummary scrub is incomplete" + +_scratch_xfs_stress_scrub -s "scrub rtsummary" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/801.out b/tests/xfs/801.out new file mode 100644 index 0000000000..39481b38e2 --- /dev/null +++ b/tests/xfs/801.out @@ -0,0 +1,2 @@ +QA output created by 801 +Silence is golden diff --git a/tests/xfs/802 b/tests/xfs/802 new file mode 100755 index 0000000000..1f3b83882e --- /dev/null +++ b/tests/xfs/802 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 802 +# +# Race fsstress and user quota scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" usrquota +_scratch_xfs_stress_scrub -s "scrub usrquota" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/802.out b/tests/xfs/802.out new file mode 100644 index 0000000000..a69c05391f --- /dev/null +++ b/tests/xfs/802.out @@ -0,0 +1,2 @@ +QA output created by 802 +Silence is golden diff --git a/tests/xfs/803 b/tests/xfs/803 new file mode 100755 index 0000000000..b2bb85672d --- /dev/null +++ b/tests/xfs/803 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 803 +# +# Race fsstress and group quota scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" grpquota +_scratch_xfs_stress_scrub -s "scrub grpquota" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/803.out b/tests/xfs/803.out new file mode 100644 index 0000000000..38ba741d0f --- /dev/null +++ b/tests/xfs/803.out @@ -0,0 +1,2 @@ +QA output created by 803 +Silence is golden diff --git a/tests/xfs/804 b/tests/xfs/804 new file mode 100755 index 0000000000..129724eb11 --- /dev/null +++ b/tests/xfs/804 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 804 +# +# Race fsstress and project quota scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" prjquota +_scratch_xfs_stress_scrub -s "scrub prjquota" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/804.out b/tests/xfs/804.out new file mode 100644 index 0000000000..5e0cb437e7 --- /dev/null +++ b/tests/xfs/804.out @@ -0,0 +1,2 @@ +QA output created by 804 +Silence is golden diff --git a/tests/xfs/805 b/tests/xfs/805 new file mode 100755 index 0000000000..aca9b9cdf4 --- /dev/null +++ b/tests/xfs/805 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 805 +# +# Race fsstress and summary counters scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub fscounters" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/805.out b/tests/xfs/805.out new file mode 100644 index 0000000000..ac324c5874 --- /dev/null +++ b/tests/xfs/805.out @@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden From patchwork Fri Dec 30 22:19:06 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: 13085190 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 E35C8C3DA7C for ; Sat, 31 Dec 2022 00:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235742AbiLaAjd (ORCPT ); Fri, 30 Dec 2022 19:39:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235484AbiLaAjc (ORCPT ); Fri, 30 Dec 2022 19:39:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A47321E3EE; Fri, 30 Dec 2022 16:39:30 -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 2D2D3B81E08; Sat, 31 Dec 2022 00:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2EDAC433EF; Sat, 31 Dec 2022 00:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447168; bh=qI1nM5AgkcQc6k9j4+Wk8hGuLtQyJr1zJmuSbs25oxw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=fcD5OSqUpgfUYc/YVKyMu84Z92t1Q5vppDg+nMIokZRp9XG01LwaLbokeQzOFyfz1 /4aT/T4MKXZN3JUImzeoi4Q6w+8pYH5sU6gsbnYZPSo2H53mGJYgxfE5AC/YeeOaLb 2D163B11O3zJQtRbnJSQON35vlZn5FuiSG/1WujwPohprNV0nCG+RqLJ7uzS23UMi9 6BtvWergaP5uCtv7UcrfJZ4OIjzEYcNCDMu6mqBsDjlCKF1iqe4l2FU0O3uE6tqcwL b/YfLnuCxU2AQrpyljUzfMR11ShuELTvvZViKO8CSasoo0QKgQsO0bU6J5ufjQlBx5 YIVi47KvH1n5g== Subject: [PATCH 3/5] fuzzy: add a custom xfs find utility for scrub stress tests 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:19:06 -0800 Message-ID: <167243874650.722028.10607547751700517177.stgit@magnolia> In-Reply-To: <167243874614.722028.11987534226186856347.stgit@magnolia> References: <167243874614.722028.11987534226186856347.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 a new find(1) like utility that doesn't crash on directory tree changes (like find does due to bugs in its loop detector) and actually implements the custom xfs attribute predicates that we need for scrub stress tests. This program will be needed for a future patch where we add stress tests for scrub and repair of file metadata. Signed-off-by: Darrick J. Wong --- configure.ac | 5 + include/builddefs.in | 4 + m4/package_libcdev.m4 | 47 ++++++++ m4/package_xfslibs.m4 | 16 +++ src/Makefile | 10 ++ src/xfsfind.c | 290 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 372 insertions(+) create mode 100644 src/xfsfind.c diff --git a/configure.ac b/configure.ac index cbf8377988..e92bd6b26d 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,11 @@ AC_PACKAGE_WANT_LINUX_FS_H AC_PACKAGE_WANT_LIBBTRFSUTIL AC_HAVE_COPY_FILE_RANGE +AC_HAVE_SEEK_DATA +AC_HAVE_BMV_OF_SHARED +AC_HAVE_NFTW +AC_HAVE_RLIMIT_NOFILE + AC_CHECK_FUNCS([renameat2]) AC_CHECK_FUNCS([reallocarray]) AC_CHECK_TYPES([struct mount_attr], [], [], [[#include ]]) diff --git a/include/builddefs.in b/include/builddefs.in index 6641209f81..dab10c968f 100644 --- a/include/builddefs.in +++ b/include/builddefs.in @@ -68,6 +68,10 @@ HAVE_FIEMAP = @have_fiemap@ HAVE_FALLOCATE = @have_fallocate@ HAVE_COPY_FILE_RANGE = @have_copy_file_range@ HAVE_LIBBTRFSUTIL = @have_libbtrfsutil@ +HAVE_SEEK_DATA = @have_seek_data@ +HAVE_NFTW = @have_nftw@ +HAVE_BMV_OF_SHARED = @have_bmv_of_shared@ +HAVE_RLIMIT_NOFILE = @have_rlimit_nofile@ GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 index 5c76c0f73e..e1b381c16f 100644 --- a/m4/package_libcdev.m4 +++ b/m4/package_libcdev.m4 @@ -110,3 +110,50 @@ AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], AC_SUBST(have_copy_file_range) ]) +# Check if we have SEEK_DATA +AC_DEFUN([AC_HAVE_SEEK_DATA], + [ AC_MSG_CHECKING([for SEEK_DATA]) + AC_TRY_LINK([ +#define _GNU_SOURCE +#include +#include + ], [ + lseek(-1, 0, SEEK_DATA); + ], have_seek_data=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_SUBST(have_seek_data) + ]) + +# Check if we have nftw +AC_DEFUN([AC_HAVE_NFTW], + [ AC_MSG_CHECKING([for nftw]) + AC_TRY_LINK([ +#define _GNU_SOURCE +#include +#include + ], [ + nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, 0); + ], have_nftw=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_SUBST(have_nftw) + ]) + +# Check if we have RLIMIT_NOFILE +AC_DEFUN([AC_HAVE_RLIMIT_NOFILE], + [ AC_MSG_CHECKING([for RLIMIT_NOFILE]) + AC_TRY_LINK([ +#define _GNU_SOURCE +#include +#include + ], [ + struct rlimit rlimit; + + rlimit.rlim_cur = 0; + getrlimit(RLIMIT_NOFILE, &rlimit); + ], have_rlimit_nofile=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_SUBST(have_rlimit_nofile) + ]) diff --git a/m4/package_xfslibs.m4 b/m4/package_xfslibs.m4 index 0746cd1dc5..479f30a29b 100644 --- a/m4/package_xfslibs.m4 +++ b/m4/package_xfslibs.m4 @@ -104,3 +104,19 @@ AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO], exit 1 ]) ]) + +# Check if we have BMV_OF_SHARED from the GETBMAPX ioctl +AC_DEFUN([AC_HAVE_BMV_OF_SHARED], + [ AC_MSG_CHECKING([for BMV_OF_SHARED]) + AC_TRY_LINK([ +#define _GNU_SOURCE +#include + ], [ + struct getbmapx obj; + ioctl(-1, XFS_IOC_GETBMAPX, &obj); + obj.bmv_oflags |= BMV_OF_SHARED; + ], have_bmv_of_shared=yes + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) + AC_SUBST(have_bmv_of_shared) + ]) diff --git a/src/Makefile b/src/Makefile index afdf6b30c5..7807ca89a5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,6 +83,16 @@ ifeq ($(HAVE_LIBCAP), true) LLDLIBS += -lcap endif +ifeq ($(HAVE_SEEK_DATA), yes) + ifeq ($(HAVE_NFTW), yes) + ifeq ($(HAVE_BMV_OF_SHARED), yes) + ifeq ($(HAVE_RLIMIT_NOFILE), yes) + TARGETS += xfsfind + endif + endif + endif +endif + CFILES = $(TARGETS:=.c) LDIRT = $(TARGETS) fssum diff --git a/src/xfsfind.c b/src/xfsfind.c new file mode 100644 index 0000000000..6b0a93e793 --- /dev/null +++ b/src/xfsfind.c @@ -0,0 +1,290 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * find(1) but with special predicates for finding XFS attributes. + * Copyright (C) 2022 Oracle. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "global.h" + +static int want_anyfile; +static int want_datafile; +static int want_attrfile; +static int want_dir; +static int want_regfile; +static int want_sharedfile; +static int report_errors = 1; + +static int +check_datafile( + const char *path, + int fd) +{ + off_t off; + + off = lseek(fd, 0, SEEK_DATA); + if (off >= 0) + return 1; + + if (errno == ENXIO) + return 0; + + if (report_errors) + perror(path); + + return -1; +} + +static int +check_attrfile( + const char *path, + int fd) +{ + struct fsxattr fsx; + int ret; + + ret = ioctl(fd, XFS_IOC_FSGETXATTR, &fsx); + if (ret) { + if (report_errors) + perror(path); + return -1; + } + + if (want_attrfile && (fsx.fsx_xflags & XFS_XFLAG_HASATTR)) + return 1; + return 0; +} + +#define BMAP_NR 33 +static struct getbmapx bmaps[BMAP_NR]; + +static int +check_sharedfile( + const char *path, + int fd) +{ + struct getbmapx *key = &bmaps[0]; + unsigned int i; + int ret; + + memset(key, 0, sizeof(struct getbmapx)); + key->bmv_length = ULLONG_MAX; + /* no holes and don't flush dirty pages */ + key->bmv_iflags = BMV_IF_DELALLOC | BMV_IF_NO_HOLES; + key->bmv_count = BMAP_NR; + + while ((ret = ioctl(fd, XFS_IOC_GETBMAPX, bmaps)) == 0) { + struct getbmapx *p = &bmaps[1]; + xfs_off_t new_off; + + for (i = 0; i < key->bmv_entries; i++, p++) { + if (p->bmv_oflags & BMV_OF_SHARED) + return 1; + } + + if (key->bmv_entries == 0) + break; + p = key + key->bmv_entries; + if (p->bmv_oflags & BMV_OF_LAST) + return 0; + + new_off = p->bmv_offset + p->bmv_length; + key->bmv_length -= new_off - key->bmv_offset; + key->bmv_offset = new_off; + } + if (ret < 0) { + if (report_errors) + perror(path); + return -1; + } + + return 0; +} + +static void +print_help( + const char *name) +{ + printf("Usage: %s [OPTIONS] path\n", name); + printf("\n"); + printf("Print all file paths matching any of the given predicates.\n"); + printf("\n"); + printf("-a Match files with xattrs.\n"); + printf("-b Match files with data blocks.\n"); + printf("-d Match directories.\n"); + printf("-q Ignore errors while walking directory tree.\n"); + printf("-r Match regular files.\n"); + printf("-s Match files with shared blocks.\n"); + printf("\n"); + printf("If no matching options are given, match all files found.\n"); +} + +static int +visit( + const char *path, + const struct stat *sb, + int typeflag, + struct FTW *ftwbuf) +{ + int printme = 1; + int fd = -1; + int retval = FTW_CONTINUE; + + if (want_anyfile) + goto out; + if (want_regfile && typeflag == FTW_F) + goto out; + if (want_dir && typeflag == FTW_D) + goto out; + + /* + * We can only open directories and files; screen out everything else. + * Note that nftw lies and reports FTW_F for device files, so check the + * statbuf mode too. + */ + if (typeflag != FTW_F && typeflag != FTW_D) { + printme = 0; + goto out; + } + + if (!S_ISREG(sb->st_mode) && !S_ISDIR(sb->st_mode)) { + printme = 0; + goto out; + } + + fd = open(path, O_RDONLY); + if (fd < 0) { + if (report_errors) { + perror(path); + return FTW_STOP; + } + + return FTW_CONTINUE; + } + + if (want_datafile && typeflag == FTW_F) { + int ret = check_datafile(path, fd); + if (ret < 0 && report_errors) { + printme = 0; + retval = FTW_STOP; + goto out_fd; + } + + if (ret == 1) + goto out_fd; + } + + if (want_attrfile) { + int ret = check_attrfile(path, fd); + if (ret < 0 && report_errors) { + printme = 0; + retval = FTW_STOP; + goto out_fd; + } + + if (ret == 1) + goto out_fd; + } + + if (want_sharedfile) { + int ret = check_sharedfile(path, fd); + if (ret < 0 && report_errors) { + printme = 0; + retval = FTW_STOP; + goto out_fd; + } + + if (ret == 1) + goto out_fd; + } + + printme = 0; +out_fd: + close(fd); +out: + if (printme) + printf("%s\n", path); + return retval; +} + +static void +handle_sigabrt( + int signal, + siginfo_t *info, + void *ucontext) +{ + fprintf(stderr, "Signal %u, exiting.\n", signal); + exit(2); +} + +int +main( + int argc, + char *argv[]) +{ + struct rlimit rlimit; + struct sigaction abrt = { + .sa_sigaction = handle_sigabrt, + .sa_flags = SA_SIGINFO, + }; + int c; + int ret; + + while ((c = getopt(argc, argv, "abdqrs")) >= 0) { + switch (c) { + case 'a': want_attrfile = 1; break; + case 'b': want_datafile = 1; break; + case 'd': want_dir = 1; break; + case 'q': report_errors = 0; break; + case 'r': want_regfile = 1; break; + case 's': want_sharedfile = 1; break; + default: + print_help(argv[0]); + return 1; + } + } + + ret = getrlimit(RLIMIT_NOFILE, &rlimit); + if (ret) { + perror("RLIMIT_NOFILE"); + return 1; + } + + if (!want_attrfile && !want_datafile && !want_dir && !want_regfile && + !want_sharedfile) + want_anyfile = 1; + + /* + * nftw is known to abort() if a directory it is walking disappears out + * from under it. Handle this with grace if the caller wants us to run + * quietly. + */ + if (!report_errors) { + ret = sigaction(SIGABRT, &abrt, NULL); + if (ret) { + perror("SIGABRT handler"); + return 1; + } + } + + for (c = optind; c < argc; c++) { + ret = nftw(argv[c], visit, rlimit.rlim_cur - 5, + FTW_ACTIONRETVAL | FTW_CHDIR | FTW_MOUNT | + FTW_PHYS); + if (ret && report_errors) { + perror(argv[c]); + break; + } + } + + if (ret) + return 1; + return 0; +} From patchwork Fri Dec 30 22:19:06 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: 13085191 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 038B3C3DA7C for ; Sat, 31 Dec 2022 00:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235784AbiLaAjs (ORCPT ); Fri, 30 Dec 2022 19:39:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235671AbiLaAjr (ORCPT ); Fri, 30 Dec 2022 19:39:47 -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 302421E3FE; Fri, 30 Dec 2022 16:39:46 -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 DD91FB81E49; Sat, 31 Dec 2022 00:39:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EE41C433EF; Sat, 31 Dec 2022 00:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447183; bh=pQq4B40v4RhHW7cz7BJ0dBjlQZsjXNE87BVyendgV24=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ADHXVMBq+odZH7IhRl2pBlYNt25PAfU8854sb4YVqmp5rO2MXCpeqjSlWHmj144Qc m5tRPOp5HFPNKdWT1jw3dx4elvb0/Uk4fuw9n3qr4C+Z4LYFbpa/C3++XoShJBOewj /lGJBgcHEIe1J1FgxwT3BcbbR5LTZHs8IY9C2ALnhbsgSWAgEOoWLOxFzAGkq8JWkv YXOCQ02aQC9NIvNKdPpB+qrleu0TvuXghWTJb2sNhysdWLWubFvXFCfO400X5EgOtc MFzZpm8HZgdYP8KU47w6NKqKea3fMGxqVMdvdrszYGjeD3EXhIWDDWrwbw1ruk451Q a+HgkR2Irzmsw== Subject: [PATCH 4/5] fuzzy: allow xfs scrub stress tests to pick preconfigured fsstress configs 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:19:06 -0800 Message-ID: <167243874662.722028.15090629914232187990.stgit@magnolia> In-Reply-To: <167243874614.722028.11987534226186856347.stgit@magnolia> References: <167243874614.722028.11987534226186856347.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 Make it so that xfs_scrub stress tests can select what kind of fsstress operations they want to run. This will make it easier for, say, directory scrubbers to configure fsstress to exercise directory tree changes while skipping file data updates, because those are irrelevant. Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang --- common/fuzzy | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/common/fuzzy b/common/fuzzy index e39f787e78..c4a5bc9261 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -466,6 +466,7 @@ __stress_scrub_fsx_loop() { local end="$1" local runningfile="$2" local remount_period="$3" + local stress_tgt="$4" # ignored local focus=(-q -X) # quiet, validate file contents # As of November 2022, 2 million fsx ops should be enough to keep @@ -528,10 +529,70 @@ __stress_scrub_fsstress_loop() { local end="$1" local runningfile="$2" local remount_period="$3" + local stress_tgt="$4" + local focus=() + + case "$stress_tgt" in + "dir") + focus+=('-z') + + # Create a directory tree rapidly + for op in creat link mkdir mknod symlink; do + focus+=('-f' "${op}=8") + done + focus+=('-f' 'rmdir=2' '-f' 'unlink=8') + + # Rename half as often + for op in rename rnoreplace rexchange; do + focus+=('-f' "${op}=4") + done + + # Read and sync occasionally + for op in getdents stat fsync; do + focus+=('-f' "${op}=1") + done + ;; + "xattr") + focus+=('-z') + + # Create a directory tree slowly + for op in creat ; do + focus+=('-f' "${op}=2") + done + for op in unlink rmdir; do + focus+=('-f' "${op}=1") + done + + # Create xattrs rapidly + for op in attr_set setfattr; do + focus+=('-f' "${op}=80") + done + + # Remove xattrs 1/4 as quickly + for op in attr_remove removefattr; do + focus+=('-f' "${op}=20") + done + + # Read and sync occasionally + for op in listfattr getfattr fsync; do + focus+=('-f' "${op}=10") + done + ;; + "writeonly") + # Only do things that cause filesystem writes + focus+=('-w') + ;; + "default") + # No new arguments + ;; + *) + echo "$stress_tgt: Unrecognized stress target, using defaults." + ;; + esac # As of March 2022, 2 million fsstress ops should be enough to keep # any filesystem busy for a couple of hours. - local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 $FSSTRESS_AVOID) + local args=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000000 "${focus[@]}" $FSSTRESS_AVOID) echo "Running $FSSTRESS_PROG $args" >> $seqres.full if [ -n "$remount_period" ]; then @@ -691,6 +752,14 @@ __stress_scrub_check_commands() { # -w Delay the start of the scrub/repair loop by this number of seconds. # Defaults to no delay unless XFS_SCRUB_STRESS_DELAY is set. This value # will be clamped to ten seconds before the end time. +# -x Focus on this type of fsstress operation. Possible values: +# +# 'dir': Grow the directory trees as much as possible. +# 'xattr': Grow extended attributes in a small tree. +# 'default': Run fsstress with default arguments. +# 'writeonly': Only perform fs updates, no reads. +# +# The default is 'default' unless XFS_SCRUB_STRESS_TARGET is set. # -X Run this program to exercise the filesystem. Currently supported # options are 'fsx' and 'fsstress'. The default is 'fsstress'. _scratch_xfs_stress_scrub() { @@ -703,6 +772,7 @@ _scratch_xfs_stress_scrub() { local exerciser="fsstress" local io_args=() local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}" + local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}" __SCRUB_STRESS_FREEZE_PID="" __SCRUB_STRESS_REMOUNT_LOOP="" @@ -710,7 +780,7 @@ _scratch_xfs_stress_scrub() { touch "$runningfile" OPTIND=1 - while getopts "fi:r:s:S:t:w:X:" c; do + while getopts "fi:r:s:S:t:w:x:X:" c; do case "$c" in f) freeze=yes;; i) io_args+=("$OPTARG");; @@ -719,6 +789,7 @@ _scratch_xfs_stress_scrub() { S) xfs_scrub_args+=("$OPTARG");; t) scrub_tgt="$OPTARG";; w) scrub_delay="$OPTARG";; + x) stress_tgt="$OPTARG";; X) exerciser="$OPTARG";; *) return 1; ;; esac @@ -757,7 +828,7 @@ _scratch_xfs_stress_scrub() { fi "__stress_scrub_${exerciser}_loop" "$end" "$runningfile" \ - "$remount_period" & + "$remount_period" "$stress_tgt" & if [ -n "$freeze" ]; then __stress_scrub_freeze_loop "$end" "$runningfile" & From patchwork Fri Dec 30 22:19:06 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: 13085192 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 4408FC3DA7C for ; Sat, 31 Dec 2022 00:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235711AbiLaAkC (ORCPT ); Fri, 30 Dec 2022 19:40:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235671AbiLaAkB (ORCPT ); Fri, 30 Dec 2022 19:40:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383141E3FE; Fri, 30 Dec 2022 16:40:00 -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 BAA1D61D18; Sat, 31 Dec 2022 00:39:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B57DC433EF; Sat, 31 Dec 2022 00:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672447199; bh=x0mlas2Jn1y5z4fXt1IrR39/BN9IQ7pKbZJ4w3zYLDk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=MAhLukp820jl89E6FTAv8yXQA7BbSz9taYCJZgq0sNUnTBF5v6IKBLZltNHv4x37B eEnbye8rSYpmmJWVwLAfhSylUPuoYdjX7F9qTnUxZpcU8AviCVGLEaRUvI7fpBhW9K 1+Y3U8iw48/QqVDL2S5PWhMwd/qq9K1dWjUCQjnGWLqFyxVbnxKGt94JqxKLXWYoia 0vdlLVAhAn/8xnnMB5kqhNwDtZcnCw6bA78lh33buz/1xnXOdLdl+eJzIFOXf1KjhB jA7d+xlRggYOyMBuqgU7plOfqEb5N8B3WrXKLDB/4cUhq/G7/+zVuSUvkLgU3vgEN9 JtqkNrmQxiFvw== Subject: [PATCH 5/5] xfs: race fsstress with online scrubbers for file metadata 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:19:06 -0800 Message-ID: <167243874673.722028.7027496052735734173.stgit@magnolia> In-Reply-To: <167243874614.722028.11987534226186856347.stgit@magnolia> References: <167243874614.722028.11987534226186856347.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 For each XFS_SCRUB_TYPE_* that looks at file metadata, create a test that runs that scrubber in the foreground and fsstress in the background. Signed-off-by: Darrick J. Wong --- common/fuzzy | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++--- tests/xfs/792 | 38 +++++++++++++++++++++++ tests/xfs/792.out | 2 + tests/xfs/793 | 37 ++++++++++++++++++++++ tests/xfs/793.out | 2 + tests/xfs/794 | 39 +++++++++++++++++++++++ tests/xfs/794.out | 2 + tests/xfs/795 | 39 +++++++++++++++++++++++ tests/xfs/795.out | 2 + tests/xfs/796 | 37 ++++++++++++++++++++++ tests/xfs/796.out | 2 + tests/xfs/797 | 40 ++++++++++++++++++++++++ tests/xfs/797.out | 2 + tests/xfs/799 | 38 +++++++++++++++++++++++ tests/xfs/799.out | 2 + tests/xfs/826 | 38 +++++++++++++++++++++++ tests/xfs/826.out | 2 + tests/xfs/827 | 39 +++++++++++++++++++++++ tests/xfs/827.out | 2 + 19 files changed, 447 insertions(+), 5 deletions(-) create mode 100755 tests/xfs/792 create mode 100644 tests/xfs/792.out create mode 100755 tests/xfs/793 create mode 100644 tests/xfs/793.out create mode 100755 tests/xfs/794 create mode 100644 tests/xfs/794.out create mode 100755 tests/xfs/795 create mode 100644 tests/xfs/795.out create mode 100755 tests/xfs/796 create mode 100644 tests/xfs/796.out create mode 100755 tests/xfs/797 create mode 100644 tests/xfs/797.out create mode 100755 tests/xfs/799 create mode 100644 tests/xfs/799.out create mode 100755 tests/xfs/826 create mode 100644 tests/xfs/826.out create mode 100755 tests/xfs/827 create mode 100644 tests/xfs/827.out diff --git a/common/fuzzy b/common/fuzzy index c4a5bc9261..f7f660bc31 100644 --- a/common/fuzzy +++ b/common/fuzzy @@ -330,12 +330,20 @@ __stress_freeze_filter_output() { # Filter scrub output so that we don't tarnish the golden output if the fs is # too busy to scrub. Note: Tests should _notrun if the scrub type is not -# supported. +# supported. Callers can provide extra strings to filter out as function +# arguments. __stress_scrub_filter_output() { + local extra_args=() + + for arg in "$@"; do + extra_args+=(-e "/${arg}/d") + done + _filter_scratch | \ sed -e '/Device or resource busy/d' \ -e '/Optimization possible/d' \ - -e '/No space left on device/d' + -e '/No space left on device/d' \ + "${extra_args[@]}" } # Decide if the scratch filesystem is still alive. @@ -401,13 +409,34 @@ __stress_one_scrub_loop() { fi done + local extra_filters=() + local target_cmd=(echo "$scrub_tgt") + case "$scrub_tgt" in + "%file%"|"%datafile%"|"%attrfile%") + extra_filters+=('No such file or directory' 'No such device or address') + target_cmd=(find "$SCRATCH_MNT" -print) + ;; + "%dir%") + extra_filters+=('No such file or directory' 'Not a directory') + target_cmd=(find "$SCRATCH_MNT" -type d -print) + ;; + "%regfile%"|"%cowfile%") + extra_filters+=('No such file or directory') + target_cmd=(find "$SCRATCH_MNT" -type f -print) + ;; + esac + while __stress_scrub_running "$scrub_startat" "$runningfile"; do sleep 1 done while __stress_scrub_running "$end" "$runningfile"; do - $XFS_IO_PROG -x "${xfs_io_args[@]}" "$scrub_tgt" 2>&1 | \ - __stress_scrub_filter_output + readarray -t fnames < <("${target_cmd[@]}" 2>/dev/null) + for fname in "${fnames[@]}"; do + $XFS_IO_PROG -x "${xfs_io_args[@]}" "$fname" 2>&1 | \ + __stress_scrub_filter_output "${extra_filters[@]}" + __stress_scrub_running "$end" "$runningfile" || break + done done } @@ -585,6 +614,22 @@ __stress_scrub_fsstress_loop() { "default") # No new arguments ;; + "symlink") + focus+=('-z') + + # Only create, read, and delete symbolic links + focus+=('-f' 'symlink=4') + focus+=('-f' 'readlink=10') + focus+=('-f' 'unlink=1') + ;; + "mknod") + focus+=('-z') + + # Only create and delete special files + focus+=('-f' 'mknod=4') + focus+=('-f' 'getdents=100') + focus+=('-f' 'unlink=1') + ;; *) echo "$stress_tgt: Unrecognized stress target, using defaults." ;; @@ -715,9 +760,31 @@ __stress_scrub_check_commands() { local scrub_tgt="$1" shift + local cooked_tgt="$scrub_tgt" + case "$scrub_tgt" in + "%file%"|"%dir%") + cooked_tgt="$SCRATCH_MNT" + ;; + "%regfile%"|"%datafile%") + cooked_tgt="$SCRATCH_MNT/testfile" + echo test > "$cooked_tgt" + ;; + "%attrfile%") + cooked_tgt="$SCRATCH_MNT/testfile" + $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 64k' "$cooked_tgt" &>/dev/null + attr -s attrname "$cooked_tgt" < "$cooked_tgt" &>/dev/null + ;; + "%cowfile%") + cooked_tgt="$SCRATCH_MNT/testfile" + $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 128k' "$cooked_tgt" &>/dev/null + _cp_reflink "$cooked_tgt" "$cooked_tgt.1" + $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1' "$cooked_tgt.1" &>/dev/null + ;; + esac + for arg in "$@"; do local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")" - testio=`$XFS_IO_PROG -x -c "$cooked_arg" $scrub_tgt 2>&1` + testio=`$XFS_IO_PROG -x -c "$cooked_arg" "$cooked_tgt" 2>&1` echo $testio | grep -q "Unknown type" && \ _notrun "xfs_io scrub subcommand support is missing" echo $testio | grep -q "Inappropriate ioctl" && \ @@ -749,6 +816,16 @@ __stress_scrub_check_commands() { # -S Pass this option to xfs_scrub. If zero -S options are specified, # xfs_scrub will not be run. To select repair mode, pass '-k' or '-v'. # -t Run online scrub against this file; $SCRATCH_MNT is the default. +# Special values are as follows: +# +# %file% all files +# %regfile% regular files +# %dir% direct +# %datafile% regular files with data blocks +# %attrfile% regular files with xattr blocks +# %cowfile% regular files with shared blocks +# +# File selection races with fsstress, so the selection is best-effort. # -w Delay the start of the scrub/repair loop by this number of seconds. # Defaults to no delay unless XFS_SCRUB_STRESS_DELAY is set. This value # will be clamped to ten seconds before the end time. @@ -758,6 +835,8 @@ __stress_scrub_check_commands() { # 'xattr': Grow extended attributes in a small tree. # 'default': Run fsstress with default arguments. # 'writeonly': Only perform fs updates, no reads. +# 'symlink': Only create symbolic links. +# 'mknod': Only create special files. # # The default is 'default' unless XFS_SCRUB_STRESS_TARGET is set. # -X Run this program to exercise the filesystem. Currently supported diff --git a/tests/xfs/792 b/tests/xfs/792 new file mode 100755 index 0000000000..0806e87909 --- /dev/null +++ b/tests/xfs/792 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 792 +# +# Race fsstress and inode record scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub inode" -t "%file%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/792.out b/tests/xfs/792.out new file mode 100644 index 0000000000..c9b5ef3a7c --- /dev/null +++ b/tests/xfs/792.out @@ -0,0 +1,2 @@ +QA output created by 792 +Silence is golden diff --git a/tests/xfs/793 b/tests/xfs/793 new file mode 100755 index 0000000000..41be82d621 --- /dev/null +++ b/tests/xfs/793 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 793 +# +# Race fsstress and data fork scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub bmapbtd" -t "%datafile%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/793.out b/tests/xfs/793.out new file mode 100644 index 0000000000..e8a17d4ecb --- /dev/null +++ b/tests/xfs/793.out @@ -0,0 +1,2 @@ +QA output created by 793 +Silence is golden diff --git a/tests/xfs/794 b/tests/xfs/794 new file mode 100755 index 0000000000..8f4835dbc9 --- /dev/null +++ b/tests/xfs/794 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 794 +# +# Race fsstress and attr fork scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/attr + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_attrs +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -x 'xattr' -s "scrub bmapbta" -t "%attrfile%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/794.out b/tests/xfs/794.out new file mode 100644 index 0000000000..bc999c055c --- /dev/null +++ b/tests/xfs/794.out @@ -0,0 +1,2 @@ +QA output created by 794 +Silence is golden diff --git a/tests/xfs/795 b/tests/xfs/795 new file mode 100755 index 0000000000..ec065bafdd --- /dev/null +++ b/tests/xfs/795 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 795 +# +# Race fsstress and cow fork scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/reflink + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" reflink +_scratch_xfs_stress_scrub -s "scrub bmapbtc" -t "%cowfile%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/795.out b/tests/xfs/795.out new file mode 100644 index 0000000000..cb357003dd --- /dev/null +++ b/tests/xfs/795.out @@ -0,0 +1,2 @@ +QA output created by 795 +Silence is golden diff --git a/tests/xfs/796 b/tests/xfs/796 new file mode 100755 index 0000000000..d337701264 --- /dev/null +++ b/tests/xfs/796 @@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 796 +# +# Race fsstress and directory scrub for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -x 'dir' -s "scrub directory" -t "%dir%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/796.out b/tests/xfs/796.out new file mode 100644 index 0000000000..374e3774a2 --- /dev/null +++ b/tests/xfs/796.out @@ -0,0 +1,2 @@ +QA output created by 796 +Silence is golden diff --git a/tests/xfs/797 b/tests/xfs/797 new file mode 100755 index 0000000000..c68b43be7a --- /dev/null +++ b/tests/xfs/797 @@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 797 +# +# Race fsstress and extended attributes scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/attr + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_attrs +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -x 'xattr' -s "scrub xattr" -t "%attrfile%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/797.out b/tests/xfs/797.out new file mode 100644 index 0000000000..6b64f4bf21 --- /dev/null +++ b/tests/xfs/797.out @@ -0,0 +1,2 @@ +QA output created by 797 +Silence is golden diff --git a/tests/xfs/799 b/tests/xfs/799 new file mode 100755 index 0000000000..84007ea9c0 --- /dev/null +++ b/tests/xfs/799 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 799 +# +# Race fsstress and parent pointers scrub for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_scrub -s "scrub parent" -t "%dir%" + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/799.out b/tests/xfs/799.out new file mode 100644 index 0000000000..f3fd9fa2a0 --- /dev/null +++ b/tests/xfs/799.out @@ -0,0 +1,2 @@ +QA output created by 799 +Silence is golden diff --git a/tests/xfs/826 b/tests/xfs/826 new file mode 100755 index 0000000000..7660270571 --- /dev/null +++ b/tests/xfs/826 @@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 826 +# +# Race fsstress and symlink scrub for a while to see if we crash or livelock. +# We can't open symlink files directly for scrubbing, so we use xfs_scrub(8). +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +XFS_SCRUB_PHASE=3 _scratch_xfs_stress_scrub -x 'symlink' -S '-n' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/826.out b/tests/xfs/826.out new file mode 100644 index 0000000000..93fae86b82 --- /dev/null +++ b/tests/xfs/826.out @@ -0,0 +1,2 @@ +QA output created by 826 +Silence is golden diff --git a/tests/xfs/827 b/tests/xfs/827 new file mode 100755 index 0000000000..55ec01d1e6 --- /dev/null +++ b/tests/xfs/827 @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 827 +# +# Race fsstress and special file scrub for a while to see if we crash or +# livelock. We can't open special files directly for scrubbing, so we use +# xfs_scrub(8). +# +. ./common/preamble +_begin_fstest scrub dangerous_fsstress_scrub + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_scrub + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +XFS_SCRUB_PHASE=3 _scratch_xfs_stress_scrub -x 'mknod' -S '-n' + +# success, all done +echo Silence is golden +status=0 +exit diff --git a/tests/xfs/827.out b/tests/xfs/827.out new file mode 100644 index 0000000000..65f29d949d --- /dev/null +++ b/tests/xfs/827.out @@ -0,0 +1,2 @@ +QA output created by 827 +Silence is golden