xfs: online repair in its entirety
Subsystems (6)
PATCH 2/5 xfs: race fsstress with online scrubbers for AG and fs metadata
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
--- 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
common/quota +64 -0
@@ -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.
doc/group-names.txt +1 -0
@@ -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
tests/xfs/782 new file +37 -0
@@ -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
tests/xfs/782.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 782 +Silence is golden
tests/xfs/783 new file +37 -0
@@ -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
tests/xfs/783.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 783 +Silence is golden
tests/xfs/784 new file +37 -0
@@ -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
tests/xfs/784.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 784 +Silence is golden
tests/xfs/785 new file +37 -0
@@ -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
tests/xfs/785.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 785 +Silence is golden
tests/xfs/786 new file +38 -0
@@ -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
tests/xfs/786.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 786 +Silence is golden
tests/xfs/787 new file +38 -0
@@ -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
tests/xfs/787.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 787 +Silence is golden
tests/xfs/788 new file +38 -0
@@ -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
tests/xfs/788.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 788 +Silence is golden
tests/xfs/789 new file +39 -0
@@ -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
tests/xfs/789.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 789 +Silence is golden
tests/xfs/790 new file +39 -0
@@ -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
tests/xfs/790.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 790 +Silence is golden
tests/xfs/791 new file +40 -0
@@ -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
tests/xfs/791.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 791 +Silence is golden
tests/xfs/798 new file +44 -0
44 lines not on this page · raw message
tests/xfs/798.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 798 +Silence is golden
tests/xfs/800 new file +40 -0
@@ -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
tests/xfs/800.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is golden
tests/xfs/801 new file +47 -0
47 lines not on this page · raw message
tests/xfs/801.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 801 +Silence is golden
tests/xfs/802 new file +40 -0
@@ -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
tests/xfs/802.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 802 +Silence is golden
tests/xfs/803 new file +40 -0
@@ -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
tests/xfs/803.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 803 +Silence is golden
tests/xfs/804 new file +40 -0
@@ -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
tests/xfs/804.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 804 +Silence is golden
tests/xfs/805 new file +38 -0
@@ -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
tests/xfs/805.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden
Re: [PATCH 2/5] xfs: race fsstress with online scrubbers for AG and fs metadata
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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 <[email protected]>--- common/quota | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/group-names.txt | 1 +
[snip]
doc/group-names.txt dangerous_fuzzers fuzzers that can crash your computer · line 38
Quoted 9 lines
doc/group-names.txt +1
-0@@ -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
We've added this group name, so this patch will hit conflict. But I think I can use git am --3way ... to apply this patch forcibly :)
Thanks,
Zorro
Quoted 911 lines
doc/group-names.txt +0
-0dangerous_repair fuzzers to evaluate xfs_repair offline repair dangerous_scrub fuzzers to evaluate xfs_scrub checking data data loss checkerstests/xfs/782 new file +37
-0@@ -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 +exittests/xfs/782.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 782 +Silence is goldentests/xfs/783 new file +37
-0@@ -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 +exittests/xfs/783.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 783 +Silence is goldentests/xfs/784 new file +37
-0@@ -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 +exittests/xfs/784.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 784 +Silence is goldentests/xfs/785 new file +37
-0@@ -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 +exittests/xfs/785.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 785 +Silence is goldentests/xfs/786 new file +38
-0@@ -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 +exittests/xfs/786.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 786 +Silence is goldentests/xfs/787 new file +38
-0@@ -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 +exittests/xfs/787.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 787 +Silence is goldentests/xfs/788 new file +38
-0@@ -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 +exittests/xfs/788.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 788 +Silence is goldentests/xfs/789 new file +39
-0@@ -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 +exittests/xfs/789.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 789 +Silence is goldentests/xfs/790 new file +39
-0@@ -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 +exittests/xfs/790.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 790 +Silence is goldentests/xfs/791 new file +40
-0@@ -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 +exittests/xfs/791.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 791 +Silence is goldentests/xfs/798 new file +44
-0@@ -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 +exittests/xfs/798.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 798 +Silence is goldentests/xfs/800 new file +40
-0@@ -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 +exittests/xfs/800.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is goldentests/xfs/801 new file +47
-0@@ -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 +exittests/xfs/801.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 801 +Silence is goldentests/xfs/802 new file +40
-0@@ -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 +exittests/xfs/802.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 802 +Silence is goldentests/xfs/803 new file +40
-0@@ -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 +exittests/xfs/803.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 803 +Silence is goldentests/xfs/804 new file +40
-0@@ -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 +exittests/xfs/804.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 804 +Silence is goldentests/xfs/805 new file +38
-0@@ -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 +exittests/xfs/805.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden
Re: [PATCH 2/5] xfs: race fsstress with online scrubbers for AG and fs metadata
Quoted 14 lines · Zorro Lang
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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 <[email protected]>--- common/quota | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/group-names.txt | 1 +[snip]
Quoted 12 lines
doc/group-names.txt dangerous_fuzzers fuzzers that can crash your computer · line 38
Quoted 9 lines
doc/group-names.txt +1
-0@@ -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 checkingWe've added this group name, so this patch will hit conflict. But I think I can use
git am --3way ...to apply this patch forcibly :)
Or I'll just repost this patch, since I already/always rebase everything.
--D
Quoted 915 lines
Thanks,
ZorroQuoted 911 lines
doc/group-names.txt +0
-0dangerous_repair fuzzers to evaluate xfs_repair offline repair dangerous_scrub fuzzers to evaluate xfs_scrub checking data data loss checkerstests/xfs/782 new file +37
-0@@ -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 +exittests/xfs/782.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 782 +Silence is goldentests/xfs/783 new file +37
-0@@ -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 +exittests/xfs/783.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 783 +Silence is goldentests/xfs/784 new file +37
-0@@ -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 +exittests/xfs/784.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 784 +Silence is goldentests/xfs/785 new file +37
-0@@ -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 +exittests/xfs/785.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 785 +Silence is goldentests/xfs/786 new file +38
-0@@ -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 +exittests/xfs/786.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 786 +Silence is goldentests/xfs/787 new file +38
-0@@ -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 +exittests/xfs/787.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 787 +Silence is goldentests/xfs/788 new file +38
-0@@ -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 +exittests/xfs/788.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 788 +Silence is goldentests/xfs/789 new file +39
-0@@ -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 +exittests/xfs/789.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 789 +Silence is goldentests/xfs/790 new file +39
-0@@ -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 +exittests/xfs/790.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 790 +Silence is goldentests/xfs/791 new file +40
-0@@ -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 +exittests/xfs/791.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 791 +Silence is goldentests/xfs/798 new file +44
-0@@ -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 +exittests/xfs/798.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 798 +Silence is goldentests/xfs/800 new file +40
-0@@ -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 +exittests/xfs/800.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is goldentests/xfs/801 new file +47
-0@@ -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 +exittests/xfs/801.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 801 +Silence is goldentests/xfs/802 new file +40
-0@@ -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 +exittests/xfs/802.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 802 +Silence is goldentests/xfs/803 new file +40
-0@@ -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 +exittests/xfs/803.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 803 +Silence is goldentests/xfs/804 new file +40
-0@@ -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 +exittests/xfs/804.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 804 +Silence is goldentests/xfs/805 new file +38
-0@@ -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 +exittests/xfs/805.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden
PATCH 2/5 xfs: race fsstress with online scrubbers for AG and fs metadata
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
---
v24.1: rebase against newer upstream to get rid of merge conflicts
--- common/quota | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 ++ 35 files changed, 767 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
common/quota +64 -0
@@ -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.
tests/xfs/782 new file +37 -0
@@ -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
tests/xfs/782.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 782 +Silence is golden
tests/xfs/783 new file +37 -0
@@ -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
tests/xfs/783.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 783 +Silence is golden
tests/xfs/784 new file +37 -0
@@ -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
tests/xfs/784.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 784 +Silence is golden
tests/xfs/785 new file +37 -0
@@ -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
tests/xfs/785.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 785 +Silence is golden
tests/xfs/786 new file +38 -0
@@ -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
tests/xfs/786.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 786 +Silence is golden
tests/xfs/787 new file +38 -0
@@ -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
tests/xfs/787.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 787 +Silence is golden
tests/xfs/788 new file +38 -0
@@ -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
tests/xfs/788.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 788 +Silence is golden
tests/xfs/789 new file +39 -0
@@ -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
tests/xfs/789.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 789 +Silence is golden
tests/xfs/790 new file +39 -0
@@ -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
tests/xfs/790.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 790 +Silence is golden
tests/xfs/791 new file +40 -0
@@ -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
tests/xfs/791.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 791 +Silence is golden
tests/xfs/798 new file +44 -0
44 lines not on this page · raw message
tests/xfs/798.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 798 +Silence is golden
tests/xfs/800 new file +40 -0
@@ -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
tests/xfs/800.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is golden
tests/xfs/801 new file +47 -0
47 lines not on this page · raw message
tests/xfs/801.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 801 +Silence is golden
tests/xfs/802 new file +40 -0
@@ -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
tests/xfs/802.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 802 +Silence is golden
tests/xfs/803 new file +40 -0
@@ -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
tests/xfs/803.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 803 +Silence is golden
tests/xfs/804 new file +40 -0
@@ -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
tests/xfs/804.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 804 +Silence is golden
tests/xfs/805 new file +38 -0
@@ -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
tests/xfs/805.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden
Re: [PATCH v24.1 2/5] xfs: race fsstress with online scrubbers for AG and fs metadata
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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 <[email protected]>---
v24.1: rebase against newer upstream to get rid of merge conflicts
---
This version is good to me.
Quoted 1,054 lines
common/quota | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 ++ 35 files changed, 767 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.outcommon/quota +64
-0@@ -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.tests/xfs/782 new file +37
-0@@ -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 +exittests/xfs/782.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 782 +Silence is goldentests/xfs/783 new file +37
-0@@ -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 +exittests/xfs/783.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 783 +Silence is goldentests/xfs/784 new file +37
-0@@ -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 +exittests/xfs/784.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 784 +Silence is goldentests/xfs/785 new file +37
-0@@ -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 +exittests/xfs/785.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 785 +Silence is goldentests/xfs/786 new file +38
-0@@ -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 +exittests/xfs/786.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 786 +Silence is goldentests/xfs/787 new file +38
-0@@ -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 +exittests/xfs/787.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 787 +Silence is goldentests/xfs/788 new file +38
-0@@ -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 +exittests/xfs/788.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 788 +Silence is goldentests/xfs/789 new file +39
-0@@ -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 +exittests/xfs/789.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 789 +Silence is goldentests/xfs/790 new file +39
-0@@ -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 +exittests/xfs/790.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 790 +Silence is goldentests/xfs/791 new file +40
-0@@ -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 +exittests/xfs/791.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 791 +Silence is goldentests/xfs/798 new file +44
-0@@ -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 +exittests/xfs/798.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 798 +Silence is goldentests/xfs/800 new file +40
-0@@ -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 +exittests/xfs/800.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 800 +Silence is goldentests/xfs/801 new file +47
-0@@ -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 +exittests/xfs/801.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 801 +Silence is goldentests/xfs/802 new file +40
-0@@ -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 +exittests/xfs/802.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 802 +Silence is goldentests/xfs/803 new file +40
-0@@ -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 +exittests/xfs/803.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 803 +Silence is goldentests/xfs/804 new file +40
-0@@ -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 +exittests/xfs/804.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 804 +Silence is goldentests/xfs/805 new file +38
-0@@ -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 +exittests/xfs/805.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 805 +Silence is golden
PATCH 3/5 fuzzy: add a custom xfs find utility for scrub stress tests
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
--- 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
configure.ac +5 -0
@@ -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 <linux/mount.h>]])
include/builddefs.in +4 -0
@@ -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
m4/package_libcdev.m4 +47 -0
50 lines not on this page · raw message
m4/package_xfslibs.m4 +16 -0
@@ -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 <xfs/xfs.h> + ], [ + 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) + ])
src/Makefile +10 -0
@@ -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
src/xfsfind.c new file +290 -0
290 lines not on this page · raw message
Re: [PATCH 3/5] fuzzy: add a custom xfs find utility for scrub stress tests
Quoted 56 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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 <[email protected]>--- 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.cconfigure.ac +5
-0@@ -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 <linux/mount.h>]])include/builddefs.in +4
-0@@ -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 -Wallm4/package_libcdev.m4 +0
-0
m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 116
Quoted 7 lines
m4/package_libcdev.m4 +4
-0@@ -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([
The AC_TRY_LINK is obsolete by autoconf, refer to:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
So as the suggestion of above link, we'd better to replace:
Macro: AC_TRY_LINK (includes, function-body, [action-if-true], [action-if-false])
with:
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[includes]],
[[function-body]])],
[action-if-true],
[action-if-false])For example (hope it's right:)
m4/package_libcdev.m4 +3 -3
@@ -113,13 +113,13 @@ AC_DEFUN([AC_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([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #define _GNU_SOURCE #include <sys/types.h> #include <unistd.h> - ], [ + ]], [[ lseek(-1, 0, SEEK_DATA); - ], have_seek_data=yes + ]])], have_seek_data=yes AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_SUBST(have_seek_data)
Quoted 5 lines
m4/package_libcdev.m4 +5
-0+#define _GNU_SOURCE +#include <sys/types.h> +#include <unistd.h> + ], [ + lseek(-1, 0, SEEK_DATA);
m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 131
Quoted 10 lines
m4/package_libcdev.m4 +10
-0+ ], 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([
Same as above
Quoted 5 lines
m4/package_libcdev.m4 +5
-0+#define _GNU_SOURCE +#include <stddef.h> +#include <ftw.h> + ], [ + nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, 0);
m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 146
Quoted 10 lines
m4/package_libcdev.m4 +10
-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([
Same as above
Quoted 18 lines
m4/package_libcdev.m4 +13
-0+#define _GNU_SOURCE +#include <sys/time.h> +#include <sys/resource.h> + ], [ + 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) + ])m4/package_xfslibs.m4 +0
-0
m4/package_xfslibs.m4 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO], · line 111
Quoted 8 lines
m4/package_xfslibs.m4 +5
-0@@ -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([
Same as above
Thanks,
Zorro
Quoted 329 lines
m4/package_xfslibs.m4 +11
-0+#define _GNU_SOURCE +#include <xfs/xfs.h> + ], [ + 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) + ])src/Makefile +10
-0@@ -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) fssumsrc/xfsfind.c new file +290
-0@@ -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 <sys/time.h> +#include <sys/resource.h> +#include <sys/types.h> +#include <stdio.h> +#include <unistd.h> +#include <ftw.h> +#include <linux/fs.h> +#include <xfs/xfs.h> + +#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 ; +}
Re: [PATCH 3/5] fuzzy: add a custom xfs find utility for scrub stress tests
Quoted 71 lines · Zorro Lang
Quoted 56 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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 <[email protected]>--- 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.cconfigure.ac +5
-0@@ -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 <linux/mount.h>]])include/builddefs.in +4
-0@@ -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 -Wallm4/package_libcdev.m4 +0
-0m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 116
Quoted 7 lines
m4/package_libcdev.m4 +4
-0@@ -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([The
AC_TRY_LINKis obsolete by autoconf, refer to:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.htmlSo as the suggestion of above link, we'd better to replace:
Macro:AC_TRY_LINK(includes, function-body, [action-if-true], [action-if-false])
with:
Quoted 7 lines
AC_LINK_IFELSE( [AC_LANG_PROGRAM([[includes]], [[function-body]])], [action-if-true], [action-if-false])For example (hope it's right:)
Yeah... this patch was written so long ago I wasn't even aware of the deprecations. I've run autoupdate to fix the problems and will repost.
--D
Quoted 420 lines
m4/package_libcdev.m4 +3
-3@@ -113,13 +113,13 @@ AC_DEFUN([AC_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([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #define _GNU_SOURCE #include <sys/types.h> #include <unistd.h> - ], [ + ]], [[ lseek(-1, 0, SEEK_DATA); - ], have_seek_data=yes + ]])], have_seek_data=yes AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_SUBST(have_seek_data)Quoted 6 lines
m4/package_libcdev.m4 +5
-0+#define _GNU_SOURCE +#include <sys/types.h> +#include <unistd.h> + ], [ + lseek(-1, 0, SEEK_DATA);m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 131
Quoted 10 lines
m4/package_libcdev.m4 +10
-0+ ], 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([Same as above
Quoted 5 lines
m4/package_libcdev.m4 +5
-0+#define _GNU_SOURCE +#include <stddef.h> +#include <ftw.h> + ], [ + nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, 0);m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_COPY_FILE_RANGE], · line 146
Quoted 10 lines
m4/package_libcdev.m4 +10
-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([Same as above
Quoted 18 lines
m4/package_libcdev.m4 +13
-0+#define _GNU_SOURCE +#include <sys/time.h> +#include <sys/resource.h> + ], [ + 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) + ])m4/package_xfslibs.m4 +0
-0m4/package_xfslibs.m4 AC_DEFUN([AC_PACKAGE_NEED_XFSCTL_MACRO], · line 111
Quoted 8 lines
m4/package_xfslibs.m4 +5
-0@@ -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([Same as above
Thanks,
ZorroQuoted 329 lines
m4/package_xfslibs.m4 +11
-0+#define _GNU_SOURCE +#include <xfs/xfs.h> + ], [ + 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) + ])src/Makefile +10
-0@@ -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) fssumsrc/xfsfind.c new file +290
-0@@ -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 <sys/time.h> +#include <sys/resource.h> +#include <sys/types.h> +#include <stdio.h> +#include <unistd.h> +#include <ftw.h> +#include <linux/fs.h> +#include <xfs/xfs.h> + +#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 ; +}
PATCH 3/5 fuzzy: add a custom xfs find utility for scrub stress tests
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
---
v24.1: apply some autoupdate love to the m4 macros
--- configure.ac | 5 + include/builddefs.in | 4 + m4/package_libcdev.m4 | 44 +++++++ m4/package_xfslibs.m4 | 15 +++ src/Makefile | 10 ++ src/xfsfind.c | 290 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 368 insertions(+) create mode 100644 src/xfsfind.c
configure.ac +5 -0
@@ -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 <linux/mount.h>]])
include/builddefs.in +4 -0
@@ -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
m4/package_libcdev.m4 +44 -0
47 lines not on this page · raw message
m4/package_xfslibs.m4 +15 -0
@@ -104,3 +104,18 @@ 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_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE +#include <xfs/xfs.h> + ]], [[ + 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) + ])
src/Makefile +10 -0
@@ -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
src/xfsfind.c new file +290 -0
290 lines not on this page · raw message
Re: [PATCH v24.1 3/5] fuzzy: add a custom xfs find utility for scrub stress tests
Quoted 8 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
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.
Quoted 4 lines
Signed-off-by Darrick J. Wong <[email protected]>---
v24.1: apply some autoupdate love to the m4 macros
---
This version looks better to me, I'll merge it with a little change on .gitignore file to filter src/xfsfind.
Quoted 433 lines
configure.ac | 5 + include/builddefs.in | 4 + m4/package_libcdev.m4 | 44 +++++++ m4/package_xfslibs.m4 | 15 +++ src/Makefile | 10 ++ src/xfsfind.c | 290 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 368 insertions(+) create mode 100644 src/xfsfind.cconfigure.ac +5
-0@@ -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 <linux/mount.h>]])include/builddefs.in +4
-0@@ -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 -Wallm4/package_libcdev.m4 +44
-0@@ -110,3 +110,47 @@ 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_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE +#include <sys/types.h> +#include <unistd.h> + ]], [[ + 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_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE +#include <stddef.h> +#include <ftw.h> + ]], [[ + 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_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE +#include <sys/time.h> +#include <sys/resource.h> + ]], [[ + 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) + ])m4/package_xfslibs.m4 +15
-0@@ -104,3 +104,18 @@ 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_LINK_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE +#include <xfs/xfs.h> + ]], [[ + 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) + ])src/Makefile +10
-0@@ -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) fssumsrc/xfsfind.c new file +290
-0@@ -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 <sys/time.h> +#include <sys/resource.h> +#include <sys/types.h> +#include <stdio.h> +#include <unistd.h> +#include <ftw.h> +#include <linux/fs.h> +#include <xfs/xfs.h> + +#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 ; +}
PATCH 4/5 fuzzy: allow xfs scrub stress tests to pick preconfigured fsstress configs
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
--- common/fuzzy | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-)
common/fuzzy +74 -3
@@ -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" &
Re: [PATCH 4/5] fuzzy: allow xfs scrub stress tests to pick preconfigured fsstress configs
Quoted 9 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Make it so that
xfs_scrubstress 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 <[email protected]>---
Quoted 138 lines
common/fuzzy | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-)common/fuzzy +74
-3@@ -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" &
PATCH 5/5 xfs: race fsstress with online scrubbers for file metadata
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
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.
--- 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
common/fuzzy +84 -5
@@ -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
tests/xfs/792 new file +38 -0
@@ -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
tests/xfs/792.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 792 +Silence is golden
tests/xfs/793 new file +37 -0
@@ -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
tests/xfs/793.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 793 +Silence is golden
tests/xfs/794 new file +39 -0
@@ -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
tests/xfs/794.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 794 +Silence is golden
tests/xfs/795 new file +39 -0
@@ -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
tests/xfs/795.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 795 +Silence is golden
tests/xfs/796 new file +37 -0
@@ -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
tests/xfs/796.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 796 +Silence is golden
tests/xfs/797 new file +40 -0
@@ -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
tests/xfs/797.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 797 +Silence is golden
tests/xfs/799 new file +38 -0
@@ -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
tests/xfs/799.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 799 +Silence is golden
tests/xfs/826 new file +38 -0
@@ -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
tests/xfs/826.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 826 +Silence is golden
tests/xfs/827 new file +39 -0
@@ -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
tests/xfs/827.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 827 +Silence is golden
cover xfs: force rebuilding of metadata
In reply to Darrick J. WongHi all,
This patchset adds a new IFLAG to the scrub ioctl so that userspace can force a rebuild of an otherwise consistent piece of metadata. This will eventually enable the use of online repair to relocate metadata during a filesystem reorganization (e.g. shrink). For now, it facilitates stress testing of online repair without needing the debugging knobs to be enabled.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-force-rebuild
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-force-rebuild
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-force-rebuild
--- common/fuzzy | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)
PATCH 1/1 fuzzy: use FORCE_REBUILD over injecting force_repair
From: Darrick J. Wong <[email protected]>
For stress testing online repair, try to use the FORCE_REBUILD ioctl flag over the error injection knobs whenever possible because the knobs are very noisy and are not always available.
--- common/fuzzy | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)
common/fuzzy +31 -3
@@ -398,6 +398,9 @@ __stress_one_scrub_loop() { local xfs_io_args=() for arg in "$@"; do + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + arg="$(echo "$arg" | sed -e 's/^repair/repair -R/g')" + fi if echo "$arg" | grep -q -w '%agno%'; then # Substitute the AG number for ((agno = 0; agno < agcount; agno++)); do
@@ -695,13 +698,21 @@ _require_xfs_stress_scrub() { _notrun 'xfs scrub stress test requires common/filter' } +# Make sure that we can force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__require_xfs_stress_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + test -z "$output" && return + _require_xfs_io_error_injection "force_repair" +} + # Make sure we have everything we need to run stress and online repair _require_xfs_stress_online_repair() { _require_xfs_stress_scrub _require_xfs_io_command "repair" command -v _require_xfs_io_error_injection &>/dev/null || \ _notrun 'xfs repair stress test requires common/inject' - _require_xfs_io_error_injection "force_repair" + __require_xfs_stress_force_rebuild _require_freeze }
@@ -783,7 +794,11 @@ __stress_scrub_check_commands() { esac for arg in "$@"; do - local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")" + local cooked_arg="$arg" + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" + fi + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")" 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"
@@ -943,10 +958,23 @@ _scratch_xfs_stress_scrub() { echo "Loop finished at $(date)" >> $seqres.full } +# Decide if we're going to force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__scratch_xfs_stress_setup_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + + if [ -z "$output" ]; then + export SCRUBSTRESS_USE_FORCE_REBUILD=1 + return + fi + + $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT +} + # Start online repair, freeze, and fsstress in background looping processes, # and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down. # Same requirements and arguments as _scratch_xfs_stress_scrub. _scratch_xfs_stress_online_repair() { - $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT + __scratch_xfs_stress_setup_force_rebuild XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@" }
Re: [PATCH 1/1] fuzzy: use FORCE_REBUILD over injecting force_repair
Quoted 63 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
For stress testing online repair, try to use the
FORCE_REBUILDioctl flag over the error injection knobs whenever possible because the knobs are very noisy and are not always available.Signed-off-by Darrick J. Wong <[email protected]>--- common/fuzzy | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)common/fuzzy +17
-2@@ -398,6 +398,9 @@ __stress_one_scrub_loop() { local xfs_io_args=() for arg in "$@"; do + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + arg="$(echo "$arg" | sed -e 's/^repair/repair -R/g')" + fi if echo "$arg" | grep -q -w '%agno%'; then # Substitute the AG number for ((agno = 0; agno < agcount; agno++)); do@@ -695,13 +698,21 @@ _require_xfs_stress_scrub() { _notrun 'xfs scrub stress test requires common/filter' } +# Make sure that we can force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__require_xfs_stress_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + test -z "$output" && return + _require_xfs_io_error_injection "force_repair" +} + # Make sure we have everything we need to run stress and online repair _require_xfs_stress_online_repair() { _require_xfs_stress_scrub _require_xfs_io_command "repair" command -v _require_xfs_io_error_injection &>/dev/null || \ _notrun 'xfs repair stress test requires common/inject' - _require_xfs_io_error_injection "force_repair" + __require_xfs_stress_force_rebuild _require_freeze }@@ -783,7 +794,11 @@ __stress_scrub_check_commands() { esac for arg in "$@"; do - local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")" + local cooked_arg="$arg" + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" + fi + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")" 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"
common/fuzzy _scratch_xfs_stress_scrub() { · line 967
Quoted 10 lines
common/fuzzy +7
-0@@ -943,10 +958,23 @@ _scratch_xfs_stress_scrub() { echo "Loop finished at $(date)" >> $seqres.full } +# Decide if we're going to force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__scratch_xfs_stress_setup_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + + if [ -z "$output" ]; then + export SCRUBSTRESS_USE_FORCE_REBUILD=1
Do you need to use this parameter ^^ in another child process? Is the "export" necessary?
Thanks,
Zorro
Quoted 15 lines
common/fuzzy +7
-1+ return + fi + + $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT +} + # Start online repair, freeze, and fsstress in background looping processes, # and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down. # Same requirements and arguments as _scratch_xfs_stress_scrub. _scratch_xfs_stress_online_repair() { - $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT + __scratch_xfs_stress_setup_force_rebuild XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@" }
Re: [PATCH 1/1] fuzzy: use FORCE_REBUILD over injecting force_repair
Quoted 67 lines · Zorro Lang
Quoted 66 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
For stress testing online repair, try to use the
FORCE_REBUILDioctl flag over the error injection knobs whenever possible because the knobs are very noisy and are not always available.Signed-off-by Darrick J. Wong <[email protected]>--- common/fuzzy | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)common/fuzzy +17
-2@@ -398,6 +398,9 @@ __stress_one_scrub_loop() { local xfs_io_args=() for arg in "$@"; do + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + arg="$(echo "$arg" | sed -e 's/^repair/repair -R/g')" + fi if echo "$arg" | grep -q -w '%agno%'; then # Substitute the AG number for ((agno = 0; agno < agcount; agno++)); do@@ -695,13 +698,21 @@ _require_xfs_stress_scrub() { _notrun 'xfs scrub stress test requires common/filter' } +# Make sure that we can force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__require_xfs_stress_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + test -z "$output" && return + _require_xfs_io_error_injection "force_repair" +} + # Make sure we have everything we need to run stress and online repair _require_xfs_stress_online_repair() { _require_xfs_stress_scrub _require_xfs_io_command "repair" command -v _require_xfs_io_error_injection &>/dev/null || \ _notrun 'xfs repair stress test requires common/inject' - _require_xfs_io_error_injection "force_repair" + __require_xfs_stress_force_rebuild _require_freeze }@@ -783,7 +794,11 @@ __stress_scrub_check_commands() { esac for arg in "$@"; do - local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")" + local cooked_arg="$arg" + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" + fi + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")" 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"@@ -943,10 +958,23 @@ _scratch_xfs_stress_scrub() { echo "Loop finished at $(date)" >> $seqres.full }
Quoted 10 lines
common/fuzzy _scratch_xfs_stress_scrub() { · line 967
Quoted 7 lines
common/fuzzy +7
-0+# Decide if we're going to force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__scratch_xfs_stress_setup_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + + if [ -z "$output" ]; then + export SCRUBSTRESS_USE_FORCE_REBUILD=1Do you need to use this parameter ^^ in another child process? Is the "export" necessary?
Nope, it's not required.
--D
Quoted 19 lines
Thanks,
ZorroQuoted 15 lines
common/fuzzy +7
-1+ return + fi + + $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT +} + # Start online repair, freeze, and fsstress in background looping processes, # and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down. # Same requirements and arguments as _scratch_xfs_stress_scrub. _scratch_xfs_stress_online_repair() { - $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT + __scratch_xfs_stress_setup_force_rebuild XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@" }
Zorro Lang
Reviewed-byRe: [PATCH 1/1] fuzzy: use FORCE_REBUILD over injecting force_repair
Quoted 79 lines · Darrick J. Wong
Quoted 67 lines · Zorro Lang
Quoted 66 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
For stress testing online repair, try to use the
FORCE_REBUILDioctl flag over the error injection knobs whenever possible because the knobs are very noisy and are not always available.Signed-off-by Darrick J. Wong <[email protected]>--- common/fuzzy | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-)common/fuzzy +17
-2@@ -398,6 +398,9 @@ __stress_one_scrub_loop() { local xfs_io_args=() for arg in "$@"; do + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + arg="$(echo "$arg" | sed -e 's/^repair/repair -R/g')" + fi if echo "$arg" | grep -q -w '%agno%'; then # Substitute the AG number for ((agno = 0; agno < agcount; agno++)); do@@ -695,13 +698,21 @@ _require_xfs_stress_scrub() { _notrun 'xfs scrub stress test requires common/filter' } +# Make sure that we can force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__require_xfs_stress_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + test -z "$output" && return + _require_xfs_io_error_injection "force_repair" +} + # Make sure we have everything we need to run stress and online repair _require_xfs_stress_online_repair() { _require_xfs_stress_scrub _require_xfs_io_command "repair" command -v _require_xfs_io_error_injection &>/dev/null || \ _notrun 'xfs repair stress test requires common/inject' - _require_xfs_io_error_injection "force_repair" + __require_xfs_stress_force_rebuild _require_freeze }@@ -783,7 +794,11 @@ __stress_scrub_check_commands() { esac for arg in "$@"; do - local cooked_arg="$(echo "$arg" | sed -e "s/%agno%/0/g")" + local cooked_arg="$arg" + if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then + cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" + fi + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")" 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"@@ -943,10 +958,23 @@ _scratch_xfs_stress_scrub() { echo "Loop finished at $(date)" >> $seqres.full }Quoted 10 lines
common/fuzzy _scratch_xfs_stress_scrub() { · line 967
Quoted 7 lines
common/fuzzy +7
-0+# Decide if we're going to force repairs either by error injection or passing +# FORCE_REBUILD via ioctl. +__scratch_xfs_stress_setup_force_rebuild() { + local output="$($XFS_IO_PROG -x -c 'repair -R probe' $SCRATCH_MNT 2>&1)" + + if [ -z "$output" ]; then + export SCRUBSTRESS_USE_FORCE_REBUILD=1Do you need to use this parameter ^^ in another child process? Is the "export" necessary?
Quoted 1 line
Nope, it's not required.
OK, others looks good to me, will merge this patch without that "export".
Quoted 23 lines
--D
Quoted 19 lines
Thanks,
ZorroQuoted 15 lines
common/fuzzy +7
-1+ return + fi + + $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT +} + # Start online repair, freeze, and fsstress in background looping processes, # and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down. # Same requirements and arguments as _scratch_xfs_stress_scrub. _scratch_xfs_stress_online_repair() { - $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT + __scratch_xfs_stress_setup_force_rebuild XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@" }
cover fstests: online repair of AG btrees
In reply to Darrick J. WongHi all,
Now that we've spent a lot of time reworking common code in online fsck, we're ready to start rebuilding the AG space btrees. This series implements repair functions for the free space, inode, and refcount btrees. Rebuilding the reverse mapping btree is much more intense and is left for a subsequent patchset. The fstests counterpart of this patchset implements stress testing of repair.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-ag-btrees
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-ag-btrees
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-ag-btrees
--- README | 3 ++ common/fuzzy | 39 +++++++++++++++++++-------- common/rc | 2 + common/xfs | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/725 | 37 +++++++++++++++++++++++++ tests/xfs/725.out | 2 + tests/xfs/726 | 37 +++++++++++++++++++++++++ tests/xfs/726.out | 2 + tests/xfs/727 | 38 ++++++++++++++++++++++++++ tests/xfs/727.out | 2 + tests/xfs/728 | 37 +++++++++++++++++++++++++ tests/xfs/728.out | 2 + tests/xfs/729 | 37 +++++++++++++++++++++++++ tests/xfs/729.out | 2 + tests/xfs/730 | 37 +++++++++++++++++++++++++ tests/xfs/730.out | 2 + tests/xfs/731 | 37 +++++++++++++++++++++++++ tests/xfs/731.out | 2 + 18 files changed, 382 insertions(+), 13 deletions(-) create mode 100755 tests/xfs/725 create mode 100644 tests/xfs/725.out create mode 100755 tests/xfs/726 create mode 100644 tests/xfs/726.out create mode 100755 tests/xfs/727 create mode 100644 tests/xfs/727.out create mode 100755 tests/xfs/728 create mode 100644 tests/xfs/728.out create mode 100755 tests/xfs/729 create mode 100644 tests/xfs/729.out create mode 100755 tests/xfs/730 create mode 100644 tests/xfs/730.out create mode 100755 tests/xfs/731 create mode 100644 tests/xfs/731.out
PATCH 1/2 xfs: test rebuilding the entire filesystem with online fsck
From: Darrick J. Wong <[email protected]>
Add a new knob, TEST_XFS_SCRUB_REBUILD, that makes it so that we use xfs_scrub to rebuild the ondisk metadata after every test.
--- README | 3 ++ common/fuzzy | 1 + common/rc | 2 +- common/xfs | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-)
README +3 -0
@@ -191,6 +191,9 @@ Extra XFS specification: to check the filesystem. As of August 2021, xfs_repair finds all filesystem corruptions found by xfs_check, and more, which means that xfs_check is no longer run by default. + - Set TEST_XFS_SCRUB_REBUILD=1 to have _check_xfs_filesystem run xfs_scrub in + "force_repair" mode to rebuild the filesystem; and xfs_repair -n to check + the results of the rebuilding. - xfs_scrub, if present, will always check the test and scratch filesystems if they are still online at the end of the test. It is no longer necessary to set TEST_XFS_SCRUB.
common/fuzzy +1 -0
@@ -975,6 +975,7 @@ __scratch_xfs_stress_setup_force_rebuild() { # and wait for 30*TIME_FACTOR seconds to see if the filesystem goes down. # Same requirements and arguments as _scratch_xfs_stress_scrub. _scratch_xfs_stress_online_repair() { + touch "$RESULT_DIR/.skip_orebuild" # no need to test online rebuild __scratch_xfs_stress_setup_force_rebuild XFS_SCRUB_FORCE_REPAIR=1 _scratch_xfs_stress_scrub "$@" }
common/rc +1 -1
@@ -1685,7 +1685,7 @@ _require_scratch_nocheck() exit 1 fi fi - rm -f ${RESULT_DIR}/require_scratch + rm -f ${RESULT_DIR}/require_scratch "$RESULT_DIR/.skip_orebuild" } # we need the scratch device and it needs to not be an lvm device
common/xfs +77 -0
95 lines not on this page · raw message
PATCH 2/2 xfs: stress test ag repair functions
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Race fsstress and various AG repair functions.
--- common/fuzzy | 38 ++++++++++++++++++++++++++------------ tests/xfs/725 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/725.out | 2 ++ tests/xfs/726 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/726.out | 2 ++ tests/xfs/727 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/727.out | 2 ++ tests/xfs/728 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/728.out | 2 ++ tests/xfs/729 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/729.out | 2 ++ tests/xfs/730 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/730.out | 2 ++ tests/xfs/731 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/731.out | 2 ++ 15 files changed, 300 insertions(+), 12 deletions(-) create mode 100755 tests/xfs/725 create mode 100644 tests/xfs/725.out create mode 100755 tests/xfs/726 create mode 100644 tests/xfs/726.out create mode 100755 tests/xfs/727 create mode 100644 tests/xfs/727.out create mode 100755 tests/xfs/728 create mode 100644 tests/xfs/728.out create mode 100755 tests/xfs/729 create mode 100644 tests/xfs/729.out create mode 100755 tests/xfs/730 create mode 100644 tests/xfs/730.out create mode 100755 tests/xfs/731 create mode 100644 tests/xfs/731.out
common/fuzzy +26 -12
@@ -393,7 +393,8 @@ __stress_one_scrub_loop() { local runningfile="$2" local scrub_tgt="$3" local scrub_startat="$4" - shift; shift; shift; shift + local start_agno="$5" + shift; shift; shift; shift; shift local agcount="$(_xfs_mount_agcount $SCRATCH_MNT)" local xfs_io_args=()
@@ -403,7 +404,7 @@ __stress_one_scrub_loop() { fi if echo "$arg" | grep -q -w '%agno%'; then # Substitute the AG number - for ((agno = 0; agno < agcount; agno++)); do + for ((agno = start_agno; agno < agcount; agno++)); do local ag_arg="$(echo "$arg" | sed -e "s|%agno%|$agno|g")" xfs_io_args+=('-c' "$ag_arg") done
@@ -413,28 +414,34 @@ __stress_one_scrub_loop() { 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 + local target_cmd=(echo "$scrub_tgt") + case "$scrub_tgt" in + "%file%") target_cmd=($here/src/xfsfind -q "$SCRATCH_MNT");; + "%attrfile%") target_cmd=($here/src/xfsfind -qa "$SCRATCH_MNT");; + "%datafile%") target_cmd=($here/src/xfsfind -qb "$SCRATCH_MNT");; + "%dir%") target_cmd=($here/src/xfsfind -qd "$SCRATCH_MNT");; + "%regfile%") target_cmd=($here/src/xfsfind -qr "$SCRATCH_MNT");; + "%cowfile%") target_cmd=($here/src/xfsfind -qs "$SCRATCH_MNT");; + esac + while __stress_scrub_running "$scrub_startat" "$runningfile"; do sleep 1 done while __stress_scrub_running "$end" "$runningfile"; do - readarray -t fnames < <("${target_cmd[@]}" 2>/dev/null) + readarray -t fnames < <("${target_cmd[@]}" 2>> $seqres.full) for fname in "${fnames[@]}"; do $XFS_IO_PROG -x "${xfs_io_args[@]}" "$fname" 2>&1 | \ __stress_scrub_filter_output "${extra_filters[@]}"
@@ -692,6 +699,7 @@ __stress_scrub_fsstress_loop() { # Make sure we have everything we need to run stress and scrub _require_xfs_stress_scrub() { _require_xfs_io_command "scrub" + _require_test_program "xfsfind" _require_command "$KILLALL_PROG" killall _require_freeze command -v _filter_scratch &>/dev/null || \
@@ -769,7 +777,8 @@ _scratch_xfs_stress_scrub_cleanup() { # filesystem before we start running them in a loop. __stress_scrub_check_commands() { local scrub_tgt="$1" - shift + local start_agno="$2" + shift; shift local cooked_tgt="$scrub_tgt" case "$scrub_tgt" in
@@ -798,7 +807,7 @@ __stress_scrub_check_commands() { if [ -n "$SCRUBSTRESS_USE_FORCE_REBUILD" ]; then cooked_arg="$(echo "$cooked_arg" | sed -e 's/^repair/repair -R/g')" fi - cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/0/g")" + cooked_arg="$(echo "$cooked_arg" | sed -e "s/%agno%/$start_agno/g")" 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"
@@ -817,6 +826,7 @@ __stress_scrub_check_commands() { # # Various options include: # +# -a For %agno% substitution, start with this AG instead of AG 0. # -f Run a freeze/thaw loop while we're doing other things. Defaults to # disabled, unless XFS_SCRUB_STRESS_FREEZE is set. # -i Pass this command to xfs_io to exercise something that is not scrub
@@ -867,6 +877,7 @@ _scratch_xfs_stress_scrub() { local io_args=() local remount_period="${XFS_SCRUB_STRESS_REMOUNT_PERIOD}" local stress_tgt="${XFS_SCRUB_STRESS_TARGET:-default}" + local start_agno=0 __SCRUB_STRESS_FREEZE_PID="" __SCRUB_STRESS_REMOUNT_LOOP=""
@@ -874,8 +885,9 @@ _scratch_xfs_stress_scrub() { touch "$runningfile" OPTIND=1 - while getopts "fi:r:s:S:t:w:x:X:" c; do + while getopts "a:fi:r:s:S:t:w:x:X:" c; do case "$c" in + a) start_agno="$OPTARG";; f) freeze=yes;; i) io_args+=("$OPTARG");; r) remount_period="$OPTARG";;
@@ -889,7 +901,8 @@ _scratch_xfs_stress_scrub() { esac done - __stress_scrub_check_commands "$scrub_tgt" "${one_scrub_args[@]}" + __stress_scrub_check_commands "$scrub_tgt" "$start_agno" \ + "${one_scrub_args[@]}" if ! command -v "__stress_scrub_${exerciser}_loop" &>/dev/null; then echo "${exerciser}: Unknown fs exercise program."
@@ -936,7 +949,8 @@ _scratch_xfs_stress_scrub() { if [ "${#one_scrub_args[@]}" -gt 0 ]; then __stress_one_scrub_loop "$end" "$runningfile" "$scrub_tgt" \ - "$scrub_startat" "${one_scrub_args[@]}" & + "$scrub_startat" "$start_agno" \ + "${one_scrub_args[@]}" & fi if [ "${#xfs_scrub_args[@]}" -gt 0 ]; then
tests/xfs/725 new file +37 -0
@@ -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. 725 +# +# Race fsstress and bnobt repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair bnobt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/725.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 725 +Silence is golden
tests/xfs/726 new file +37 -0
@@ -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. 725 +# +# Race fsstress and inobt repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair inobt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/726.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 726 +Silence is golden
tests/xfs/727 new file +38 -0
@@ -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. 725 +# +# Race fsstress and refcountbt repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" reflink +_scratch_xfs_stress_online_repair -s "repair refcountbt %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/727.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 727 +Silence is golden
tests/xfs/728 new file +37 -0
@@ -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. 728 +# +# Race fsstress and superblock repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -a 1 -s "repair sb %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/728.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is golden
tests/xfs/729 new file +37 -0
@@ -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. 729 +# +# Race fsstress and agf repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair agf %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/729.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 729 +Silence is golden
tests/xfs/730 new file +37 -0
@@ -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. 730 +# +# Race fsstress and agfl repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair agfl %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/730.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 730 +Silence is golden
tests/xfs/731 new file +37 -0
@@ -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. 731 +# +# Race fsstress and agi repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair agi %agno%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/731.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 731 +Silence is golden
Re: [PATCHSET v24.0 0/2] fstests: online repair of AG btrees
In reply to Darrick J. WongQuoted 9 lines · Darrick J. Wong
Hi all,
Now that we've spent a lot of time reworking common code in online fsck, we're ready to start rebuilding the AG space btrees. This series implements repair functions for the free space, inode, and refcount btrees. Rebuilding the reverse mapping btree is much more intense and is left for a subsequent patchset. The fstests counterpart of this patchset implements stress testing of repair.
Quoted 7 lines
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
LGTM,
Quoted 44 lines
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-ag-btreesxfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-ag-btreesfstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-ag-btrees--- README | 3 ++ common/fuzzy | 39 +++++++++++++++++++-------- common/rc | 2 + common/xfs | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/725 | 37 +++++++++++++++++++++++++ tests/xfs/725.out | 2 + tests/xfs/726 | 37 +++++++++++++++++++++++++ tests/xfs/726.out | 2 + tests/xfs/727 | 38 ++++++++++++++++++++++++++ tests/xfs/727.out | 2 + tests/xfs/728 | 37 +++++++++++++++++++++++++ tests/xfs/728.out | 2 + tests/xfs/729 | 37 +++++++++++++++++++++++++ tests/xfs/729.out | 2 + tests/xfs/730 | 37 +++++++++++++++++++++++++ tests/xfs/730.out | 2 + tests/xfs/731 | 37 +++++++++++++++++++++++++ tests/xfs/731.out | 2 + 18 files changed, 382 insertions(+), 13 deletions(-) create mode 100755 tests/xfs/725 create mode 100644 tests/xfs/725.out create mode 100755 tests/xfs/726 create mode 100644 tests/xfs/726.out create mode 100755 tests/xfs/727 create mode 100644 tests/xfs/727.out create mode 100755 tests/xfs/728 create mode 100644 tests/xfs/728.out create mode 100755 tests/xfs/729 create mode 100644 tests/xfs/729.out create mode 100755 tests/xfs/730 create mode 100644 tests/xfs/730.out create mode 100755 tests/xfs/731 create mode 100644 tests/xfs/731.out
cover fstests: online repair of inodes
In reply to Darrick J. WongHi all,
In this series, online repair gains the ability to repair inode records. To do this, we must repair the ondisk inode and fork information enough to pass the iget verifiers and hence make the inode igettable again. Once that's done, we can perform higher level repairs on the incore inode. The fstests counterpart of this patchset implements stress testing of repair.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-inodes
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-inodes
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-inodes
--- tests/xfs/806 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/806.out | 2 ++ 2 files changed, 40 insertions(+) create mode 100755 tests/xfs/806 create mode 100644 tests/xfs/806.out
PATCH 1/1 xfs: race fsstress with online repair for inode record metadata
From: Darrick J. Wong <[email protected]>
Create a test that runs the inode record repairer in the foreground and fsstress in the background.
--- tests/xfs/806 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/806.out | 2 ++ 2 files changed, 40 insertions(+) create mode 100755 tests/xfs/806 create mode 100644 tests/xfs/806.out
tests/xfs/806 new file +38 -0
@@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 806 +# +# Race fsstress and inode record repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair inode" -t "%file%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/806.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 806 +Silence is golden
Re: [PATCH 1/1] xfs: race fsstress with online repair for inode record metadata
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Create a test that runs the inode record repairer in the foreground and fsstress in the background.
Signed-off-by Darrick J. Wong <[email protected]>---
LGTM,
Quoted 60 lines
tests/xfs/806 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/806.out | 2 ++ 2 files changed, 40 insertions(+) create mode 100755 tests/xfs/806 create mode 100644 tests/xfs/806.outtests/xfs/806 new file +38
-0@@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 806 +# +# Race fsstress and inode record repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair inode" -t "%file%" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/806.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 806 +Silence is golden
cover fstests: online repair of file fork mappings
In reply to Darrick J. WongHi all,
In this series, online repair gains the ability to rebuild data and attr fork mappings from the reverse mapping information. It is at this point where we reintroduce the ability to reap file extents.
Repair of CoW forks is a little different -- on disk, CoW staging extents are owned by the refcount btree and cannot be mapped back to individual files. Hence we can only detect staging extents that don't quite look right (missing reverse mappings, shared staging extents) and replace them with fresh allocations.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-file-mappings
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-file-mappings
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-file-mappings
--- tests/xfs/746 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/746.out | 2 + tests/xfs/807 | 37 +++++++++++++++++++++++ tests/xfs/807.out | 2 + tests/xfs/808 | 39 ++++++++++++++++++++++++ tests/xfs/808.out | 2 + tests/xfs/828 | 38 ++++++++++++++++++++++++ tests/xfs/828.out | 2 + tests/xfs/829 | 39 ++++++++++++++++++++++++ tests/xfs/829.out | 2 + tests/xfs/840 | 72 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/840.out | 3 ++ tests/xfs/846 | 39 ++++++++++++++++++++++++ tests/xfs/846.out | 2 + 14 files changed, 364 insertions(+) create mode 100755 tests/xfs/746 create mode 100644 tests/xfs/746.out create mode 100755 tests/xfs/807 create mode 100644 tests/xfs/807.out create mode 100755 tests/xfs/808 create mode 100644 tests/xfs/808.out create mode 100755 tests/xfs/828 create mode 100644 tests/xfs/828.out create mode 100755 tests/xfs/829 create mode 100644 tests/xfs/829.out create mode 100755 tests/xfs/840 create mode 100644 tests/xfs/840.out create mode 100755 tests/xfs/846 create mode 100644 tests/xfs/846.out
PATCH 1/4 xfs: test rebuilding xattrs when the data fork is btree format
From: Darrick J. Wong <[email protected]>
Make sure we handle the case of rebuilding extended attributes properly when the data fork is in btree format and we therefore cannot zap the attr fork.
--- tests/xfs/746 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/746.out | 2 + 2 files changed, 87 insertions(+) create mode 100755 tests/xfs/746 create mode 100644 tests/xfs/746.out
tests/xfs/746 new file +85 -0
@@ -0,0 +1,85 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test No. 746 +# +# Make sure online repair can handle rebuilding xattrs when the data fork is +# in btree format and we cannot just zap the attr fork. + +. ./common/preamble +_begin_fstest auto quick online_repair + +# Override the default cleanup function. +_cleanup() +{ + cd / +} + +# Import common functions. +. ./common/inject +. ./common/filter + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_io_error_injection "force_repair" +_require_xfs_io_command "falloc" +_require_xfs_io_command "repair" +_require_test_program "punch-alternating" + +_scratch_mkfs > $tmp.mkfs +_scratch_mount + +_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" + +# Force data device extents so that we can create a file with the exact bmbt +# that we need regardless of rt configuration. +_xfs_force_bdev data $SCRATCH_MNT + +file=$SCRATCH_MNT/moofile +touch $file + +# Create some xattrs so that we have to rebuild them. +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 76' $file.txt >> $seqres.full +$SETFATTR_PROG -n user.SGI_BCL_FILE -v "$(cat $file.txt)" $file + +$SETFATTR_PROG -n user.crtime_usec -v 12345678 $file + +blksz=$(_get_file_block_size $SCRATCH_MNT) +ino=$(stat -c '%i' $file) + +# Figure out how many extents we need to have to create a data fork that's in +# btree format. +umount $SCRATCH_MNT +di_forkoff=$(_scratch_xfs_db -c "inode $ino" -c "p core.forkoff" | \ + awk '{print $3}') +_scratch_xfs_db -c "inode $ino" -c "p" >> $seqres.full +_scratch_mount + +# Create a data fork in btree format +min_ext_for_btree=$((di_forkoff * 8 / 16)) +$XFS_IO_PROG -c "falloc 0 $(( (min_ext_for_btree + 1) * 2 * blksz))" $file +$here/src/punch-alternating $file + +# Make sure the data fork is in btree format. +umount $SCRATCH_MNT +_scratch_xfs_db -c "inode $ino" -c "p core.format" | grep -q "btree" || \ + echo "data fork not in btree format?" +echo "about to start test" >> $seqres.full +_scratch_xfs_db -c "inode $ino" -c "p" >> $seqres.full +_scratch_mount + +# Force repair the xattr fork +_scratch_inject_error force_repair +$XFS_IO_PROG -x -c 'repair xattr' $file 2>&1 | tee $tmp.repair.log +grep -q 'Operation not supported' $tmp.repair.log && \ + _notrun "online xattr repair not supported" + +# If online repair did it correctly, the filesystem won't be corrupt. Let the +# post-test check do its thing. + +# success, all done +echo "Silence is golden." +status=0 +exit
tests/xfs/746.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 746 +Silence is golden.
PATCH 2/4 xfs: race fsstress with online repair for inode and fork metadata
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
For each XFS_SCRUB_TYPE_* that looks at inode and data/attr/cow fork metadata, create a test that runs that repairer in the foreground and fsstress in the background.
--- tests/xfs/807 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/807.out | 2 ++ tests/xfs/808 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/808.out | 2 ++ tests/xfs/846 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/846.out | 2 ++ 6 files changed, 121 insertions(+) create mode 100755 tests/xfs/807 create mode 100644 tests/xfs/807.out create mode 100755 tests/xfs/808 create mode 100644 tests/xfs/808.out create mode 100755 tests/xfs/846 create mode 100644 tests/xfs/846.out
tests/xfs/807 new file +37 -0
@@ -0,0 +1,37 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 807 +# +# Race fsstress and data fork repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair bmapbtd" -t "%datafile%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/807.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 807 +Silence is golden
tests/xfs/808 new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 808 +# +# Race fsstress and attr fork repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/attr + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_attrs +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -x 'xattr' -s "repair bmapbta" -t "%attrfile%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/808.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 808 +Silence is golden
tests/xfs/846 new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 846 +# +# Race fsstress and CoW fork repair for a while to see if we crash or livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/reflink + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_has_feature "$SCRATCH_MNT" reflink +_scratch_xfs_stress_online_repair -s "repair bmapbtc" -t "%cowfile%" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/846.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 846 +Silence is golden
PATCH 3/4 xfs: ensure that online file data fork repairs don't hit EDQUOT
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Add a test to ensure that the sysadmin doesn't get EDQUOT if they try to repair file data fork metadata when we've already exceeded a quota limit somewhere.
--- tests/xfs/840 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/840.out | 3 ++ 2 files changed, 75 insertions(+) create mode 100755 tests/xfs/840 create mode 100644 tests/xfs/840.out
tests/xfs/840 new file +72 -0
@@ -0,0 +1,72 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test 840 +# +# Ensure that the sysadmin won't hit EDQUOT while repairing file data forks +# even if the file's quota limits have been exceeded. This tests the quota +# reservation handling inside the bmap btree rebuilding code. +# +. ./common/preamble +_begin_fstest online_repair + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/quota + +# real QA test starts here + +# Modify as appropriate. +_supported_fs xfs +_require_xfs_io_command "falloc" +_require_quota +_require_user +_require_test_program "punch-alternating" +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_qmount_option usrquota +_qmount + +blocksize=$(_get_block_size $SCRATCH_MNT) +alloc_unit=$(_get_file_block_size $SCRATCH_MNT) + +# Make sure we can actually repair a data fork +scratchfile=$SCRATCH_MNT/file +touch $scratchfile +$XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT +__stress_scrub_check_commands "$scratchfile" "" 'repair bmapbtd' + +# Compute the number of extent records needed to guarantee btree format, +# assuming 16 bytes for each ondisk extent record +bmbt_records=$(( (blocksize / 16) * 5 / 4 )) +total_size=$(( bmbt_records * 2 * alloc_unit )) + +# Create a file with a data fork in bmap btree format +$XFS_IO_PROG -c "falloc 0 $total_size" $scratchfile >> $seqres.full +$here/src/punch-alternating $scratchfile + +# Set a low quota hardlimit for an unprivileged uid and chown the file to it +echo "set up quota" >> $seqres.full +$XFS_QUOTA_PROG -x -c "limit -u bhard=$((alloc_unit * 2)) $qa_user" $SCRATCH_MNT +chown $qa_user $scratchfile +$XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full + +# Rebuild the data fork +echo "repairs" >> $seqres.full +$XFS_IO_PROG -x -c 'inject force_repair' -c 'repair bmapbtd' $scratchfile +$XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full + +# Fail at appending the file as qa_user to ensure quota enforcement works +echo "fail quota" >> $seqres.full +su - "$qa_user" -c "$XFS_IO_PROG -c 'pwrite 10g 1' $scratchfile" >> $seqres.full +$XFS_QUOTA_PROG -x -c 'report -u' $SCRATCH_MNT >> $seqres.full + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/840.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 840 +pwrite: Disk quota exceeded +Silence is golden
PATCH 4/4 xfs: race fsstress with online repair for special file metadata
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
For each XFS_SCRUB_TYPE_* that looks at symbolic link and special file metadata, create a test that runs that repairer in the foreground and fsstress in the background.
--- tests/xfs/828 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/828.out | 2 ++ tests/xfs/829 | 39 +++++++++++++++++++++++++++++++++++++++ tests/xfs/829.out | 2 ++ 4 files changed, 81 insertions(+) create mode 100755 tests/xfs/828 create mode 100644 tests/xfs/828.out create mode 100755 tests/xfs/829 create mode 100644 tests/xfs/829.out
tests/xfs/828 new file +38 -0
@@ -0,0 +1,38 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 828 +# +# Race fsstress and symlink repair 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 online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +XFS_SCRUB_PHASE=3 _scratch_xfs_stress_online_repair -x 'symlink' -S '-k' + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/828.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 828 +Silence is golden
tests/xfs/829 new file +39 -0
@@ -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 repair 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 online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +XFS_SCRUB_PHASE=3 _scratch_xfs_stress_online_repair -x 'mknod' -S '-k' + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/829.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 829 +Silence is golden
Re: [PATCHSET v24.0 0/4] fstests: online repair of file fork mappings
In reply to Darrick J. WongQuoted 12 lines · Darrick J. Wong
Hi all,
In this series, online repair gains the ability to rebuild data and attr fork mappings from the reverse mapping information. It is at this point where we reintroduce the ability to reap file extents.
Repair of CoW forks is a little different -- on disk, CoW staging extents are owned by the refcount btree and cannot be mapped back to individual files. Hence we can only detect staging extents that don't quite look right (missing reverse mappings, shared staging extents) and replace them with fresh allocations.
Quoted 7 lines
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
Ack, will merge this patchset
Quoted 40 lines
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-file-mappingsxfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-file-mappingsfstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-file-mappings--- tests/xfs/746 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/746.out | 2 + tests/xfs/807 | 37 +++++++++++++++++++++++ tests/xfs/807.out | 2 + tests/xfs/808 | 39 ++++++++++++++++++++++++ tests/xfs/808.out | 2 + tests/xfs/828 | 38 ++++++++++++++++++++++++ tests/xfs/828.out | 2 + tests/xfs/829 | 39 ++++++++++++++++++++++++ tests/xfs/829.out | 2 + tests/xfs/840 | 72 +++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/840.out | 3 ++ tests/xfs/846 | 39 ++++++++++++++++++++++++ tests/xfs/846.out | 2 + 14 files changed, 364 insertions(+) create mode 100755 tests/xfs/746 create mode 100644 tests/xfs/746.out create mode 100755 tests/xfs/807 create mode 100644 tests/xfs/807.out create mode 100755 tests/xfs/808 create mode 100644 tests/xfs/808.out create mode 100755 tests/xfs/828 create mode 100644 tests/xfs/828.out create mode 100755 tests/xfs/829 create mode 100644 tests/xfs/829.out create mode 100755 tests/xfs/840 create mode 100644 tests/xfs/840.out create mode 100755 tests/xfs/846 create mode 100644 tests/xfs/846.out
cover fstests: online repair of quota and counters
In reply to Darrick J. WongHi all,
XFS stores quota records and free space bitmap information in files. Add the necessary infrastructure to enable repairing metadata inodes and their forks, and then make it so that we can repair the file metadata for the rtbitmap. Repairing the bitmap contents (and the summary file) is left for subsequent patchsets.
We also add the ability to repair file metadata the quota files. As part of these repairs, we also reinitialize the ondisk dquot records as necessary to get the incore dquots working. We can also correct obviously bad dquot record attributes, but we leave checking the resource usage counts for the next patchsets.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-quota
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-quota
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-quota
--- tests/xfs/809 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/809.out | 2 ++ tests/xfs/810 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/810.out | 2 ++ tests/xfs/811 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/811.out | 2 ++ 6 files changed, 126 insertions(+) create mode 100755 tests/xfs/809 create mode 100644 tests/xfs/809.out create mode 100755 tests/xfs/810 create mode 100644 tests/xfs/810.out create mode 100755 tests/xfs/811 create mode 100644 tests/xfs/811.out
PATCH 1/1 xfs: race fsstress with online scrub and repair for quota metadata
From: Darrick J. Wong <[email protected]>
Create tests to race fsstress with dquot repair while running fsstress in the background.
--- tests/xfs/809 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/809.out | 2 ++ tests/xfs/810 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/810.out | 2 ++ tests/xfs/811 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/811.out | 2 ++ 6 files changed, 126 insertions(+) create mode 100755 tests/xfs/809 create mode 100644 tests/xfs/809.out create mode 100755 tests/xfs/810 create mode 100644 tests/xfs/810.out create mode 100755 tests/xfs/811 create mode 100644 tests/xfs/811.out
tests/xfs/809 new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 809 +# +# Race fsstress and user quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" usrquota +_scratch_xfs_stress_online_repair -s "repair usrquota" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/809.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 809 +Silence is golden
tests/xfs/810 new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 810 +# +# Race fsstress and group quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" grpquota +_scratch_xfs_stress_online_repair -s "repair grpquota" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/810.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 810 +Silence is golden
tests/xfs/811 new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 811 +# +# Race fsstress and project quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" prjquota +_scratch_xfs_stress_online_repair -s "repair prjquota" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/811.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 811 +Silence is golden
Re: [PATCH 1/1] xfs: race fsstress with online scrub and repair for quota metadata
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Create tests to race fsstress with dquot repair while running fsstress in the background.
Signed-off-by Darrick J. Wong <[email protected]>---
Quoted 178 lines
tests/xfs/809 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/809.out | 2 ++ tests/xfs/810 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/810.out | 2 ++ tests/xfs/811 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/811.out | 2 ++ 6 files changed, 126 insertions(+) create mode 100755 tests/xfs/809 create mode 100644 tests/xfs/809.out create mode 100755 tests/xfs/810 create mode 100644 tests/xfs/810.out create mode 100755 tests/xfs/811 create mode 100644 tests/xfs/811.outtests/xfs/809 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 809 +# +# Race fsstress and user quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" usrquota +_scratch_xfs_stress_online_repair -s "repair usrquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/809.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 809 +Silence is goldentests/xfs/810 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 810 +# +# Race fsstress and group quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" grpquota +_scratch_xfs_stress_online_repair -s "repair grpquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/810.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 810 +Silence is goldentests/xfs/811 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 811 +# +# Race fsstress and project quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" prjquota +_scratch_xfs_stress_online_repair -s "repair prjquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/811.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 811 +Silence is golden
Re: [PATCH 1/1] xfs: race fsstress with online scrub and repair for quota metadata
In reply to Darrick J. WongQuoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Create tests to race fsstress with dquot repair while running fsstress in the background.
Signed-off-by Darrick J. Wong <[email protected]>---
Quoted 178 lines
tests/xfs/809 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/809.out | 2 ++ tests/xfs/810 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/810.out | 2 ++ tests/xfs/811 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/811.out | 2 ++ 6 files changed, 126 insertions(+) create mode 100755 tests/xfs/809 create mode 100644 tests/xfs/809.out create mode 100755 tests/xfs/810 create mode 100644 tests/xfs/810.out create mode 100755 tests/xfs/811 create mode 100644 tests/xfs/811.outtests/xfs/809 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 809 +# +# Race fsstress and user quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" usrquota +_scratch_xfs_stress_online_repair -s "repair usrquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/809.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 809 +Silence is goldentests/xfs/810 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 810 +# +# Race fsstress and group quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" grpquota +_scratch_xfs_stress_online_repair -s "repair grpquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/810.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 810 +Silence is goldentests/xfs/811 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 811 +# +# Race fsstress and project quota repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" prjquota +_scratch_xfs_stress_online_repair -s "repair prjquota" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/811.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 811 +Silence is golden
cover fstests: online repair of quota counters
In reply to Darrick J. WongHi all,
This series uses the inode scanner and live update hook functionality introduced in the last patchset to implement quotacheck on a live filesystem. The quotacheck scrubber builds an incore copy of the dquot resource usage counters and compares it to the live dquots to report discrepancies.
If the user chooses to repair the quota counters, the repair function visits each incore dquot to update the counts from the live information. The live update hooks are key to keeping the incore copy up to date.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-quotacheck
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-quotacheck
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-quotacheck
--- tests/xfs/715 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/715.out | 2 ++ tests/xfs/812 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/812.out | 2 ++ 4 files changed, 84 insertions(+) create mode 100755 tests/xfs/715 create mode 100644 tests/xfs/715.out create mode 100755 tests/xfs/812 create mode 100644 tests/xfs/812.out
PATCH 1/1 xfs: race fsstress with online scrub and repair for quotacheck
From: Darrick J. Wong <[email protected]>
Create tests to race fsstress with quota count check and repair while running fsstress in the background.
--- tests/xfs/715 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/715.out | 2 ++ tests/xfs/812 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/812.out | 2 ++ 4 files changed, 84 insertions(+) create mode 100755 tests/xfs/715 create mode 100644 tests/xfs/715.out create mode 100755 tests/xfs/812 create mode 100644 tests/xfs/812.out
tests/xfs/715 new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 715 +# +# Race fsstress and quotacheck repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" any +_scratch_xfs_stress_online_repair -s "repair quotacheck" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/715.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 715 +Silence is golden
tests/xfs/812 new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 812 +# +# Race fsstress and quotacheck 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" any +_scratch_xfs_stress_scrub -s "scrub quotacheck" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/812.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 812 +Silence is golden
Re: [PATCH 1/1] xfs: race fsstress with online scrub and repair for quotacheck
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Create tests to race fsstress with quota count check and repair while running fsstress in the background.
Signed-off-by Darrick J. Wong <[email protected]>---
Quoted 120 lines
tests/xfs/715 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/715.out | 2 ++ tests/xfs/812 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/xfs/812.out | 2 ++ 4 files changed, 84 insertions(+) create mode 100755 tests/xfs/715 create mode 100644 tests/xfs/715.out create mode 100755 tests/xfs/812 create mode 100644 tests/xfs/812.outtests/xfs/715 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 715 +# +# Race fsstress and quotacheck repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs +. ./common/quota + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_require_xfs_quota_acct_enabled "$SCRATCH_DEV" any +_scratch_xfs_stress_online_repair -s "repair quotacheck" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/715.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 715 +Silence is goldentests/xfs/812 new file +40
-0@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022 Oracle. Inc. All Rights Reserved. +# +# FS QA Test No. 812 +# +# Race fsstress and quotacheck 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" any +_scratch_xfs_stress_scrub -s "scrub quotacheck" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/812.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 812 +Silence is golden
cover fstests: online repair of file link counts
In reply to Darrick J. WongHi all,
Now that we've created the infrastructure to perform live scans of every file in the filesystem and the necessary hook infrastructure to observe live updates, use it to scan directories to compute the correct link counts for files in the filesystem, and reset those link counts.
This patchset creates a tailored readdir implementation for scrub because the regular version has to cycle ILOCKs to copy information to userspace. We can't cycle the ILOCK during the nlink scan and we don't need all the other VFS support code (maintaining a readdir cursor and translating XFS structures to VFS structures and back) so it was easier to duplicate the code.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=scrub-nlinks
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=scrub-nlinks
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=scrub-nlinks
--- tests/xfs/772 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/772.out | 2 ++ tests/xfs/820 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/820.out | 2 ++ 4 files changed, 79 insertions(+) create mode 100755 tests/xfs/772 create mode 100644 tests/xfs/772.out create mode 100755 tests/xfs/820 create mode 100644 tests/xfs/820.out
PATCH 1/1 xfs: race fsstress with inode link count check and repair
From: Darrick J. Wong <[email protected]>
Race fsstress with inode link count checking and repair.
--- tests/xfs/772 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/772.out | 2 ++ tests/xfs/820 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/820.out | 2 ++ 4 files changed, 79 insertions(+) create mode 100755 tests/xfs/772 create mode 100644 tests/xfs/772.out create mode 100755 tests/xfs/820 create mode 100644 tests/xfs/820.out
tests/xfs/772 new file +38 -0
@@ -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. 772 +# +# Race fsstress and inode link count repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -x "dir" -s "repair nlinks" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/772.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 772 +Silence is golden
tests/xfs/820 new file +37 -0
@@ -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. 820 +# +# Race fsstress and nlinks 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 nlinks" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/820.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 820 +Silence is golden
Re: [PATCH 1/1] xfs: race fsstress with inode link count check and repair
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Race fsstress with inode link count checking and repair.
Signed-off-by Darrick J. Wong <[email protected]>---
Quoted 115 lines
tests/xfs/772 | 38 ++++++++++++++++++++++++++++++++++++++ tests/xfs/772.out | 2 ++ tests/xfs/820 | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/820.out | 2 ++ 4 files changed, 79 insertions(+) create mode 100755 tests/xfs/772 create mode 100644 tests/xfs/772.out create mode 100755 tests/xfs/820 create mode 100644 tests/xfs/820.outtests/xfs/772 new file +38
-0@@ -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. 772 +# +# Race fsstress and inode link count repair for a while to see if we crash or +# livelock. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +_cleanup() { + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -r -f $tmp.* +} +_register_cleanup "_cleanup" BUS + +# Import common functions. +. ./common/filter +. ./common/fuzzy +. ./common/inject +. ./common/xfs + +# real QA test starts here +_supported_fs xfs +_require_scratch +_require_xfs_stress_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -x "dir" -s "repair nlinks" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/772.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 772 +Silence is goldentests/xfs/820 new file +37
-0@@ -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. 820 +# +# Race fsstress and nlinks 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 nlinks" + +# success, all done +echo Silence is golden +status=0 +exittests/xfs/820.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 820 +Silence is golden
cover fstests: online repair for fs summary counters
In reply to Darrick J. WongHi all,
A longstanding deficiency in the online fs summary counter scrubbing code is that it hasn't any means to quiesce the incore percpu counters while it's running. There is no way to coordinate with other threads are reserving or freeing free space simultaneously, which leads to false error reports. Right now, if the discrepancy is large, we just sort of shrug and bail out with an incomplete flag, but this is lame.
For repair activity, we actually /do/ need to stabilize the counters to get an accurate reading and install it in the percpu counter. To improve the former and enable the latter, allow the fscounters online fsck code to perform an exclusive mini-freeze on the filesystem. The exclusivity prevents userspace from thawing while we're running, and the mini-freeze means that we don't wait for the log to quiesce, which will make both speedier.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-fscounters
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-fscounters
--- tests/xfs/713 | 36 ++++++++++++++++++++++++++++++++++++ tests/xfs/713.out | 4 ++++ tests/xfs/714 | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/714.out | 2 ++ tests/xfs/762 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/762.out | 2 ++ 6 files changed, 131 insertions(+) create mode 100755 tests/xfs/713 create mode 100644 tests/xfs/713.out create mode 100755 tests/xfs/714 create mode 100644 tests/xfs/714.out create mode 100755 tests/xfs/762 create mode 100644 tests/xfs/762.out
PATCH 1/2 xfs: test fs summary counter online repair
From: Darrick J. Wong <[email protected]>
Fuzz the fs summary counters in the primary super and see if online repair can fix them.
--- tests/xfs/713 | 36 ++++++++++++++++++++++++++++++++++++ tests/xfs/713.out | 4 ++++ 2 files changed, 40 insertions(+) create mode 100755 tests/xfs/713 create mode 100644 tests/xfs/713.out
tests/xfs/713 new file +36 -0
@@ -0,0 +1,36 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test No. 713 +# +# Populate a XFS filesystem and fuzz every fscounter 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_scratch_xfs_fuzz_fields + +echo "Format and populate" +_scratch_populate_cached nofill > $seqres.full 2>&1 + +echo "Fuzz fscounters" +test -z "$SCRATCH_XFS_LIST_METADATA_FIELDS" && + SCRATCH_XFS_LIST_METADATA_FIELDS='icount,ifree,fdblocks' +export SCRATCH_XFS_LIST_METADATA_FIELDS +_scratch_xfs_fuzz_metadata '' 'online' 'sb 0' >> $seqres.full +echo "Done fuzzing fscounters" + +# success, all done +status=0 +exit
tests/xfs/713.out new file +4 -0
@@ -0,0 +1,4 @@ +QA output created by 713 +Format and populate +Fuzz fscounters +Done fuzzing fscounters
PATCH 2/2 xfs: race fsstress with online repair for summary counters
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Create tests to race fsstress with fs summary counter repair while running fsstress in the background.
--- tests/xfs/714 | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/714.out | 2 ++ tests/xfs/762 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/762.out | 2 ++ 4 files changed, 91 insertions(+) create mode 100755 tests/xfs/714 create mode 100644 tests/xfs/714.out create mode 100755 tests/xfs/762 create mode 100644 tests/xfs/762.out
tests/xfs/714 new file +41 -0
@@ -0,0 +1,41 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test No. 714 +# +# Race fsstress and fscounter repair for a while to see if we crash or livelock. +# Summary counter repair requires us to freeze the filesystem to stop all +# filesystem activity, so we can't have userspace wandering in and thawing it. +# +. ./common/preamble +_begin_fstest online_repair dangerous_fsstress_repair + +# Override the default cleanup function. +_cleanup() +{ + _scratch_xfs_stress_scrub_cleanup &> /dev/null + cd / + rm -rf $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_online_repair + +_scratch_mkfs > "$seqres.full" 2>&1 +_scratch_mount +_scratch_xfs_stress_online_repair -s "repair fscounters" + +# success, all done +echo Silence is golden +status=0 +exit
tests/xfs/714.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 714 +Silence is golden
tests/xfs/762 new file +46 -0
46 lines not on this page · raw message
tests/xfs/762.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 762 +Silence is golden
Re: [PATCHSET v24.0 0/2] fstests: online repair for fs summary counters
In reply to Darrick J. WongQuoted 17 lines · Darrick J. Wong
Hi all,
A longstanding deficiency in the online fs summary counter scrubbing code is that it hasn't any means to quiesce the incore percpu counters while it's running. There is no way to coordinate with other threads are reserving or freeing free space simultaneously, which leads to false error reports. Right now, if the discrepancy is large, we just sort of shrug and bail out with an incomplete flag, but this is lame.
For repair activity, we actually /do/ need to stabilize the counters to get an accurate reading and install it in the percpu counter. To improve the former and enable the latter, allow the fscounters online fsck code to perform an exclusive mini-freeze on the filesystem. The exclusivity prevents userspace from thawing while we're running, and the mini-freeze means that we don't wait for the log to quiesce, which will make both speedier.
Quoted 7 lines
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
This patchset looks good to me,
Quoted 21 lines
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-fscountersfstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-fscounters--- tests/xfs/713 | 36 ++++++++++++++++++++++++++++++++++++ tests/xfs/713.out | 4 ++++ tests/xfs/714 | 41 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/714.out | 2 ++ tests/xfs/762 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/762.out | 2 ++ 6 files changed, 131 insertions(+) create mode 100755 tests/xfs/713 create mode 100644 tests/xfs/713.out create mode 100755 tests/xfs/714 create mode 100644 tests/xfs/714.out create mode 100755 tests/xfs/762 create mode 100644 tests/xfs/762.out
cover fstests: online repair of rmap btrees
In reply to Darrick J. WongHi all,
We have now constructed the four tools that we need to scan the filesystem looking for reverse mappings: an inode scanner, hooks to receive live updates from other writer threads, the ability to construct btrees in memory, and a btree bulk loader.
This series glues those three together, enabling us to scan the filesystem for mappings and keep it up to date while other writers run, and then commit the new btree to disk atomically.
To reduce the size of each patch, the functionality is left disabled until the end of the series and broken up into three patches: one to create the mechanics of scanning the filesystem, a second to transition to in-memory btrees, and a third to set up the live hooks.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=repair-rmap-btree
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=repair-rmap-btree
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=repair-rmap-btree
--- tests/xfs/422 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
PATCH 1/1 xfs/422: don't freeze while racing rmap repair and fsstress
From: Darrick J. Wong <[email protected]>
Since we're moving away from freezing the filesystem for rmap repair, remove the freeze/thaw race from this test to make it more interesting.
--- tests/xfs/422 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
tests/xfs/422 +1 -3
@@ -5,8 +5,6 @@ # FS QA Test No. 422 # # Race fsstress and rmapbt repair for a while to see if we crash or livelock. -# rmapbt repair requires us to freeze the filesystem to stop all filesystem -# activity, so we can't have userspace wandering in and thawing it. # . ./common/preamble _begin_fstest online_repair dangerous_fsstress_repair freeze
@@ -31,7 +29,7 @@ _require_xfs_stress_online_repair _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" rmapbt -_scratch_xfs_stress_online_repair -f -s "repair rmapbt %agno%" +_scratch_xfs_stress_online_repair -s "repair rmapbt %agno%" # success, all done echo Silence is golden
Re: [PATCH 1/1] xfs/422: don't freeze while racing rmap repair and fsstress
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Since we're moving away from freezing the filesystem for rmap repair, remove the freeze/thaw race from this test to make it more interesting.
Signed-off-by Darrick J. Wong <[email protected]>---
Looks good to me,
Quoted 27 lines
tests/xfs/422 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)tests/xfs/422 +1
-3@@ -5,8 +5,6 @@ # FS QA Test No. 422 # # Race fsstress and rmapbt repair for a while to see if we crash or livelock. -# rmapbt repair requires us to freeze the filesystem to stop all filesystem -# activity, so we can't have userspace wandering in and thawing it. # . ./common/preamble _begin_fstest online_repair dangerous_fsstress_repair freeze@@ -31,7 +29,7 @@ _require_xfs_stress_online_repair _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount _require_xfs_has_feature "$SCRATCH_MNT" rmapbt -_scratch_xfs_stress_online_repair -f -s "repair rmapbt %agno%" +_scratch_xfs_stress_online_repair -s "repair rmapbt %agno%" # success, all done echo Silence is golden
cover fstests: fix a few bugs in fs population
In reply to Darrick J. WongHi all,
Before we start on an intense patchset of improving the XFS fuzz testing framework, let's fix a couple of bugs in the code that creates sample filesystems with all types of metadata.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=fix-populate-problems
--- common/populate | 70 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 24 deletions(-)
PATCH 1/2 populate: take a snapshot of the filesystem if creation fails
From: Darrick J. Wong <[email protected]>
There have been a few bug reports filed about people not being able to use the filesystem metadata population code to create filesystems with all types of metadata on them. Right now this is super-annoying to debug because we don't capture a metadump for easy debugging. Fix that.
--- common/populate | 59 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 19 deletions(-)
common/populate +40 -19
@@ -40,6 +40,27 @@ __populate_create_file() { $XFS_IO_PROG -f -c "pwrite -S 0x62 -W -b 1m 0 $sz" "${fname}" } +# Fail the test if we failed to create some kind of filesystem metadata. +# Create a metadata dump of the failed filesystem so that we can analyze +# how things went rong. +__populate_fail() { + local flatdev="$(basename "$SCRATCH_DEV")" + local metadump="$seqres.$flatdev.populate.md" + + case "$FSTYP" in + xfs) + _scratch_unmount + _scratch_xfs_metadump "$metadump" + ;; + ext4) + _scratch_unmount + _ext4_metadump "${SCRATCH_DEV}" "$metadump" + ;; + esac + + _fail "$@" +} + # Punch out every other hole in this file, if it exists. # # The goal here is to force the creation of a large number of metadata records
@@ -501,7 +522,7 @@ __populate_check_xfs_dformat() { format="$2" fmt="$(_scratch_xfs_db -c "inode ${inode}" -c 'p core.format' | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')" - test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} dformat expected ${format} saw ${fmt}" + test "${format}" = "${fmt}" || __populate_fail "failed to create ino ${inode} dformat expected ${format} saw ${fmt}" } # Check attr fork format of XFS file
@@ -510,7 +531,7 @@ __populate_check_xfs_aformat() { format="$2" fmt="$(_scratch_xfs_db -c "inode ${inode}" -c 'p core.aformat' | sed -e 's/^.*(\([a-z]*\)).*$/\1/g')" - test "${format}" = "${fmt}" || _fail "failed to create ino ${inode} aformat expected ${format} saw ${fmt}" + test "${format}" = "${fmt}" || __populate_fail "failed to create ino ${inode} aformat expected ${format} saw ${fmt}" } # Check structure of XFS directory
@@ -529,21 +550,21 @@ __populate_check_xfs_dir() { case "${dtype}" in "shortform"|"inline"|"local") - (test "${datab}" -eq 0 && test "${leafb}" -eq 0 && test "${freeb}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" + (test "${datab}" -eq 0 && test "${leafb}" -eq 0 && test "${freeb}" -eq 0) || __populate_fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" ;; "block") - (test "${datab}" -eq 1 && test "${leafb}" -eq 0 && test "${freeb}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" + (test "${datab}" -eq 1 && test "${leafb}" -eq 0 && test "${freeb}" -eq 0) || __populate_fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" ;; "leaf") - (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" + (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 0) || __populate_fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" ;; "leafn") _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "p lhdr.info.hdr.magic" | grep -q '0x3dff' && return _scratch_xfs_db -x -c "inode ${inode}" -c "dblock ${leaf_lblk}" -c "p lhdr.info.magic" | grep -q '0xd2ff' && return - _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" + __populate_fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" ;; "node"|"btree") - (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 1) || _fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" + (test "${datab}" -eq 1 && test "${leafb}" -eq 1 && test "${freeb}" -eq 1) || __populate_fail "failed to create ${dtype} dir ino ${inode} datab ${datab} leafb ${leafb} freeb ${freeb}" ;; *) _fail "Unknown directory type ${dtype}"
@@ -563,13 +584,13 @@ __populate_check_xfs_attr() { case "${atype}" in "shortform"|"inline"|"local") - (test "${datab}" -eq 0 && test "${leafb}" -eq 0) || _fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" + (test "${datab}" -eq 0 && test "${leafb}" -eq 0) || __populate_fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" ;; "leaf") - (test "${datab}" -eq 1 && test "${leafb}" -eq 0) || _fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" + (test "${datab}" -eq 1 && test "${leafb}" -eq 0) || __populate_fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" ;; "node"|"btree") - (test "${datab}" -eq 1 && test "${leafb}" -eq 1) || _fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" + (test "${datab}" -eq 1 && test "${leafb}" -eq 1) || __populate_fail "failed to create ${atype} attr ino ${inode} datab ${datab} leafb ${leafb}" ;; *) _fail "Unknown attribute type ${atype}"
@@ -605,7 +626,7 @@ __populate_check_xfs_agbtree_height() { return 100 fi done - test $? -eq 100 || _fail "Failed to create ${bt_type} of sufficient height!" + test $? -eq 100 || __populate_fail "Failed to create ${bt_type} of sufficient height!" return 1 }
@@ -678,13 +699,13 @@ __populate_check_ext4_dformat() { case "${format}" in "blockmap") - test "${extents}" -eq 0 || _fail "failed to create ino ${inode} with blockmap" + test "${extents}" -eq 0 || __populate_fail "failed to create ino ${inode} with blockmap" ;; "extent"|"extents") - test "${extents}" -eq 1 || _fail "failed to create ino ${inode} with extents" + test "${extents}" -eq 1 || __populate_fail "failed to create ino ${inode} with extents" ;; "etree") - (test "${extents}" -eq 1 && test "${etree}" -eq 1) || _fail "failed to create ino ${inode} with extent tree" + (test "${extents}" -eq 1 && test "${etree}" -eq 1) || __populate_fail "failed to create ino ${inode} with extent tree" ;; *) _fail "Unknown dformat ${format}"
@@ -702,10 +723,10 @@ __populate_check_ext4_aformat() { case "${format}" in "local"|"inline") - test "${ablock}" -eq 0 || _fail "failed to create inode ${inode} with ${format} xattr" + test "${ablock}" -eq 0 || __populate_fail "failed to create inode ${inode} with ${format} xattr" ;; "block") - test "${extents}" -eq 1 || _fail "failed to create inode ${inode} with ${format} xattr" + test "${extents}" -eq 1 || __populate_fail "failed to create inode ${inode} with ${format} xattr" ;; *) _fail "Unknown aformat ${format}"
@@ -726,13 +747,13 @@ __populate_check_ext4_dir() { case "${dtype}" in "inline") - (test "${inline}" -eq 1 && test "${htree}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" + (test "${inline}" -eq 1 && test "${htree}" -eq 0) || __populate_fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" ;; "block") - (test "${inline}" -eq 0 && test "${htree}" -eq 0) || _fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" + (test "${inline}" -eq 0 && test "${htree}" -eq 0) || __populate_fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" ;; "htree") - (test "${inline}" -eq 0 && test "${htree}" -eq 1) || _fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" + (test "${inline}" -eq 0 && test "${htree}" -eq 1) || __populate_fail "failed to create ${dtype} dir ino ${inode} htree ${htree} inline ${inline}" ;; *) _fail "Unknown directory type ${dtype}"
PATCH 2/2 populate: fix some weirdness in __populate_check_xfs_agbtree_height
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Use a for loop to scan the AGs, and make all the variables local like you'd expect them to be.
--- common/populate | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
common/populate +7 -6
@@ -599,8 +599,8 @@ __populate_check_xfs_attr() { # Check that there's at least one per-AG btree with multiple levels __populate_check_xfs_agbtree_height() { - bt_type="$1" - nr_ags=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}') + local bt_type="$1" + local agcount=$(_scratch_xfs_db -c 'sb 0' -c 'p agcount' | awk '{print $3}') case "${bt_type}" in "bno"|"cnt"|"rmap"|"refcnt")
@@ -620,13 +620,14 @@ __populate_check_xfs_agbtree_height() { ;; esac - seq 0 $((nr_ags - 1)) | while read ag; do - bt_level=$(_scratch_xfs_db -c "${hdr} ${ag}" -c "p ${bt_prefix}level" | awk '{print $3}') + for ((agno = 0; agno < agcount; agno++)); do + bt_level=$(_scratch_xfs_db -c "${hdr} ${agno}" -c "p ${bt_prefix}level" | awk '{print $3}') + # "level" is really the btree height if [ "${bt_level}" -gt 1 ]; then - return 100 + return 0 fi done - test $? -eq 100 || __populate_fail "Failed to create ${bt_type} of sufficient height!" + __populate_fail "Failed to create ${bt_type} of sufficient height!" return 1 }
Re: [PATCHSET v24.0 0/2] fstests: fix a few bugs in fs population
In reply to Darrick J. WongQuoted 6 lines · Darrick J. Wong
Hi all,
Before we start on an intense patchset of improving the XFS fuzz testing framework, let's fix a couple of bugs in the code that creates sample filesystems with all types of metadata.
Quoted 7 lines
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
Ack,
Quoted 7 lines
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=fix-populate-problems--- common/populate | 70 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 24 deletions(-)
cover fstests: improve xfs fuzzing
In reply to Darrick J. WongHi all,
There are a ton of improvements to the XFS fuzzing code in this update. We start by disabling by default two parts of the fuzz testing that don't lead to predictable golden output: fuzzing with the 'random' verb, and fuzzing the 'LSN' field.
Next, refactor the inner fuzzing loop so that each of the four repair strategies are broken out into separate functions, as well as the post-repair attempts to modify the filesystem. This splitting makes it much easier to fix some longstanding problems with the fuzzer logic. We also revise the strategies a bit so that they more accurately reflect the intended usage patterns of the repair programs.
Then, strengthen other parts of the fuzzing -- we make the post-repair modification exercises a bit more strenuous by running fsstress on the repaired fs; adding an evaluation of xfs_check vs. xfs_repair; and making it possible to check the xfs health reporting system. The xfs_check changes were key to disabling it in fstests in 2021.
Finally, improve the array handling of the xfs fuzz tests so that we actually know about array indices as a first class concept, instead of the current mucking around we do with regular expressions.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=fuzzer-improvements
--- common/fuzzy | 513 ++++++++++++++++++++++++++++++++++++++++++++------------- common/xfs | 80 +++++++++ tests/xfs/354 | 7 + tests/xfs/355 | 7 + tests/xfs/358 | 5 - tests/xfs/359 | 5 - tests/xfs/360 | 5 - tests/xfs/361 | 5 - tests/xfs/362 | 5 - tests/xfs/363 | 5 - tests/xfs/364 | 5 - tests/xfs/365 | 5 - tests/xfs/366 | 5 - tests/xfs/367 | 5 - tests/xfs/368 | 5 - tests/xfs/369 | 5 - tests/xfs/370 | 5 - tests/xfs/371 | 5 - tests/xfs/372 | 5 - tests/xfs/373 | 7 + tests/xfs/410 | 5 - tests/xfs/411 | 5 - tests/xfs/455 | 7 + tests/xfs/457 | 5 - tests/xfs/458 | 5 - tests/xfs/459 | 5 - tests/xfs/460 | 5 - tests/xfs/461 | 5 - tests/xfs/462 | 5 - tests/xfs/463 | 5 - tests/xfs/464 | 7 + tests/xfs/483 | 5 - 32 files changed, 606 insertions(+), 147 deletions(-)
PATCH 1/24 fuzzy: disable per-field random fuzzing by default
From: Darrick J. Wong <[email protected]>
Don't run the random fuzzer by default so that we can try to stabilize the output somewhat.
--- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/fuzzy +2 -1
@@ -284,7 +284,8 @@ _scratch_xfs_list_fuzz_verbs() { return; fi _scratch_xfs_db -x -c 'sb 0' -c 'fuzz' | grep '^Fuzz commands:' | \ - sed -e 's/[,.]//g' -e 's/Fuzz commands: //g' -e 's/ /\n/g' + sed -e 's/[,.]//g' -e 's/Fuzz commands: //g' -e 's/ /\n/g' | \ + grep -v '^random$' } # Fuzz some of the fields of some piece of metadata
PATCH 2/24 fuzzy: disable timstamp fuzzing by default
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Don't fuzz timestamps since all bit patterns are valid and XFS itself does not perform any validation on them.
--- common/fuzzy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
common/fuzzy +9 -1
@@ -73,6 +73,14 @@ __filter_xfs_db_keys() { -e '/pad/d' } +# Filter out metadata fields that are completely controlled by userspace +# or are arbitrary bit sequences. In other words, fields where the filesystem +# does no validation. +__filter_unvalidated_xfs_db_fields() { + sed -e '/\.sec/d' \ + -e '/\.nsec/d' +} + # Filter the xfs_db print command's field debug information # into field name and type. __filter_xfs_db_print_fields() {
@@ -91,7 +99,7 @@ __filter_xfs_db_print_fields() { else echo "${fuzzkey}" fi - done | grep -E "${filter}" + done | grep -E "${filter}" | __filter_unvalidated_xfs_db_fields } # Navigate to some part of the filesystem and print the field info.
PATCH 3/24 fuzzy: don't fuzz the log sequence number
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Don't bother filtering log sequence numbers since xfs_db doesn't have the ability to tell us the range of LSNs that would actually cause validation failures.
--- common/fuzzy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
common/fuzzy +3 -1
@@ -78,7 +78,9 @@ __filter_xfs_db_keys() { # does no validation. __filter_unvalidated_xfs_db_fields() { sed -e '/\.sec/d' \ - -e '/\.nsec/d' + -e '/\.nsec/d' \ + -e '/^lsn$/d' \ + -e '/\.lsn/d' } # Filter the xfs_db print command's field debug information
PATCH 4/24 fuzzy: don't fuzz obsolete inode fields
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
We don't really care about inode fields were used in V4 (deprecated) or DMAPI (unsupported) so don't bother fuzzing them.
--- common/fuzzy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
common/fuzzy +4 -1
@@ -80,7 +80,10 @@ __filter_unvalidated_xfs_db_fields() { sed -e '/\.sec/d' \ -e '/\.nsec/d' \ -e '/^lsn$/d' \ - -e '/\.lsn/d' + -e '/\.lsn/d' \ + -e '/^core.flushiter/d' \ + -e '/^core.dmevmask/d' \ + -e '/^core.dmstate/d' } # Filter the xfs_db print command's field debug information
PATCH 5/24 fuzzy: don't fuzz inode generation numbers
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
The inode generation number is a randomly selected 32-bit integer that isn't itself validated anywhere. No need to fuzz that.
--- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/fuzzy +2 -1
@@ -83,7 +83,8 @@ __filter_unvalidated_xfs_db_fields() { -e '/\.lsn/d' \ -e '/^core.flushiter/d' \ -e '/^core.dmevmask/d' \ - -e '/^core.dmstate/d' + -e '/^core.dmstate/d' \ + -e '/^core.gen/d' } # Filter the xfs_db print command's field debug information
PATCH 6/24 fuzzy: don't fuzz user-controllable inode flags
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Don't fuzz the inode flags that are controlled by userspace and don't actually have any other effects on the ondisk metadata.
--- common/fuzzy | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
common/fuzzy +9 -1
@@ -84,7 +84,15 @@ __filter_unvalidated_xfs_db_fields() { -e '/^core.flushiter/d' \ -e '/^core.dmevmask/d' \ -e '/^core.dmstate/d' \ - -e '/^core.gen/d' + -e '/^core.gen/d' \ + -e '/^core.prealloc/d' \ + -e '/^core.immutable/d' \ + -e '/^core.append/d' \ + -e '/^core.sync/d' \ + -e '/^core.noatime/d' \ + -e '/^core.nodump/d' \ + -e '/^core.nodefrag/d' \ + -e '/^v3.dax/d' } # Filter the xfs_db print command's field debug information
PATCH 7/24 fuzzy: don't fuzz xattr namespace flags and values
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Extended attribute namespace flags are controlled by userspace, and there is no validation imposed on the values. Don't bother fuzzing either of these things.
--- common/fuzzy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
common/fuzzy +7 -1
@@ -92,7 +92,13 @@ __filter_unvalidated_xfs_db_fields() { -e '/^core.noatime/d' \ -e '/^core.nodump/d' \ -e '/^core.nodefrag/d' \ - -e '/^v3.dax/d' + -e '/^v3.dax/d' \ + -e '/^nvlist.*value/d' \ + -e '/^entries.*root/d' \ + -e '/^entries.*secure/d' \ + -e '/^a.sfattr.list.*value/d' \ + -e '/^a.sfattr.list.*root/d' \ + -e '/^a.sfattr.list.*secure/d' } # Filter the xfs_db print command's field debug information
PATCH 8/24 common/fuzzy: split out each repair strategy into a separate helper
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Refactor __scratch_xfs_fuzz_field_test to split out each repair strategy into a separate helper function.
--- common/fuzzy | 212 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 166 insertions(+), 46 deletions(-)
common/fuzzy +166 -46
@@ -194,6 +194,148 @@ __fuzz_notify() { test -w /dev/ttyprintk && echo "$@" >> /dev/ttyprintk } +# Perform the online repair part of a fuzz test. +__scratch_xfs_fuzz_field_online() { + local fuzz_action="$1" + + # Mount or else we can't do anything online + echo "+ Mount filesystem to try online repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "scrub didn't fail with ${fuzz_action}.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem online" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Offline scrub should pass now + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + + return 0 +} + +# Perform the offline repair part of a fuzz test. +__scratch_xfs_fuzz_field_offline() { + local fuzz_action="$1" + + # Mount or else we can't do anything offline + echo "+ Mount filesystem to try offline repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "scrub didn't fail with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Repair the filesystem offline + echo "+ Try to repair the filesystem offline" + _repair_scratch_fs 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + + # See if repair finds a clean fs + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + + return 0 +} + +# Perform the no-repair part of a fuzz test. +__scratch_xfs_fuzz_field_norepair() { + local fuzz_action="$1" + + # Mount or else we can't do anything in norepair mode + echo "+ Mount filesystem to try no repair" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + __scratch_xfs_fuzz_unmount + + return 0 +} + +# Perform the online-then-offline repair part of a fuzz test. +__scratch_xfs_fuzz_field_both() { + local fuzz_action="$1" + + # Mount or else we can't do anything in both repair mode + echo "+ Mount filesystem to try both repairs" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "mount failed ($res) with ${fuzz_action}.") + return 0 + fi + + # Make sure online scrub will catch whatever we fuzzed + echo "++ Online scrub" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "online scrub didn't fail with ${fuzz_action}.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem online" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + + __scratch_xfs_fuzz_unmount + + # Repair the filesystem offline? + echo "+ Try to repair the filesystem offline" + _repair_scratch_fs 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + + # See if repair finds a clean fs + echo "+ Make sure error is gone (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "offline re-scrub ($res) with ${fuzz_action}.") + + return 0 +} + # Fuzz one field of some piece of metadata. # First arg is the field name # Second arg is the fuzz verb (ones, zeroes, random, add, sub...)
@@ -211,54 +353,32 @@ __scratch_xfs_fuzz_field_test() { res=$? test $res -ne 0 && return - # Try to catch the error with scrub - echo "+ Try to catch the error" - _try_scratch_mount 2>&1 - res=$? - if [ $res -eq 0 ]; then - # Try an online scrub unless we're fuzzing ag 0's sb, - # which scrub doesn't know how to fix. - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - if [ "$1" != "sb 0" ]; then - _scratch_scrub -n -a 1 -e continue 2>&1 - res=$? - test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${field} = ${fuzzverb}.") - fi - fi - - # Try fixing the filesystem online?! - if [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then - __fuzz_notify "++ Try to repair filesystem online" - _scratch_scrub 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${field} = ${fuzzverb}.") - fi - - __scratch_xfs_fuzz_unmount - elif [ "${repair}" = "online" ] || [ "${repair}" = "both" ]; then - (>&2 echo "mount failed ($res) with ${field} = ${fuzzverb}.") - fi - - # Repair the filesystem offline? - if [ "${repair}" = "offline" ] || [ "${repair}" = "both" ]; then - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 + # Try to catch the error with whatever repair strategy we picked. + # The fs should not be mounted before or after the strategy call. + local fuzz_action="${field} = ${fuzzverb}" + case "${repair}" in + "online") + __scratch_xfs_fuzz_field_online "${fuzz_action}" res=$? - test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${field} = ${fuzzverb}.") - fi - - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + ;; + "offline") + __scratch_xfs_fuzz_field_offline "${fuzz_action}" res=$? - test $res -ne 0 && \ - (>&2 echo "offline re-scrub ($res) with ${field} = ${fuzzverb}.") - fi + ;; + "none") + __scratch_xfs_fuzz_field_norepair "${fuzz_action}" + res=$? + ;; + "both") + __scratch_xfs_fuzz_field_both "${fuzz_action}" + res=$? + ;; + *) + (>&2 echo "unknown repair strategy ${repair}.") + res=2 + ;; + esac + test $res -eq 0 || return $res # See if scrub finds a clean fs echo "+ Make sure error is gone (online)"
PATCH 9/24 common/fuzzy: add an underline to the full log between sections
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
The fuzz scripts use __fuzz_notify in effect to log each step in the fuzz process. Enhance it to print an "underline" to ease readability a bit.
--- common/fuzzy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/fuzzy +2 -1
@@ -190,7 +190,9 @@ __scratch_xfs_fuzz_mdrestore() } __fuzz_notify() { + echo '========================================' echo "$@" + echo '========================================' test -w /dev/ttyprintk && echo "$@" >> /dev/ttyprintk }
@@ -348,7 +350,6 @@ __scratch_xfs_fuzz_field_test() { # Set the new field value __fuzz_notify "+ Fuzz ${field} = ${fuzzverb}" - echo "========================" _scratch_xfs_fuzz_metadata_field "${field}" ${fuzzverb} "$@" res=$? test $res -ne 0 && return
PATCH 10/24 common/fuzzy: hoist the post-repair fs modification step
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Hoist the code that tries to modify an fs after repairing our fuzz damage into a separate function, so that we can further simplify the caller.
--- common/fuzzy | 77 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 33 deletions(-)
common/fuzzy +44 -33
@@ -338,6 +338,47 @@ __scratch_xfs_fuzz_field_both() { return 0 } +# Assess the state of the filesystem after a repair strategy has been run by +# trying to make changes to it. +_scratch_xfs_fuzz_field_modifyfs() { + local fuzz_action="$1" + local repair="$2" + + # Try to mount the filesystem + echo "+ Make sure error is gone (online)" + _try_scratch_mount 2>&1 + res=$? + if [ $res -eq 0 ]; then + # Make sure online scrub says the filesystem is clean now + if [ "${repair}" != "none" ]; then + echo "++ Online scrub" + _scratch_scrub -n -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") + fi + fi + + # Try modifying the filesystem again + __fuzz_notify "++ Try to write filesystem again" + _scratch_fuzz_modify 100 2>&1 + __scratch_xfs_fuzz_unmount + else + (>&2 echo "re-mount failed ($res) with ${fuzz_action}.") + fi + + # See if repair finds a clean fs + if [ "${repair}" != "none" ]; then + echo "+ Re-check the filesystem (offline)" + _scratch_xfs_repair -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") + fi + + return 0 +} + # Fuzz one field of some piece of metadata. # First arg is the field name # Second arg is the fuzz verb (ones, zeroes, random, add, sub...)
@@ -381,39 +422,9 @@ __scratch_xfs_fuzz_field_test() { esac test $res -eq 0 || return $res - # See if scrub finds a clean fs - echo "+ Make sure error is gone (online)" - _try_scratch_mount 2>&1 - res=$? - if [ $res -eq 0 ]; then - # Try an online scrub unless we're fuzzing ag 0's sb, - # which scrub doesn't know how to fix. - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - if [ "$1" != "sb 0" ]; then - _scratch_scrub -n -e continue 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") - fi - fi - - # Try modifying the filesystem again! - __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 - __scratch_xfs_fuzz_unmount - else - (>&2 echo "re-mount failed ($res) with ${field} = ${fuzzverb}.") - fi - - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Re-check the filesystem (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") - fi + # See what happens when we modify the fs + _scratch_xfs_fuzz_field_modifyfs "${fuzz_action}" "${repair}" + return $? } # Make sure we have all the pieces we need for field fuzzing
PATCH 11/24 common/fuzzy: fix some problems with the online repair strategy
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
While auditing the fuzz tester code, I noticed there were numerous problems with the online repair strategy -- the stages of the strategy are not consistently logged to the kernel log, some of the error messages don't identify /which/ scrubber we're calling, and we don't actually re-run online scrub after a repair to make sure that it's verification is ok. Disable xfs_repair prefetch to reduce the chances of an OOM kill, and abort the fuzz test if we can't mount. We also reorganize the error messages to make reading the golden output easier.
--- common/fuzzy | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
common/fuzzy +17 -10
@@ -201,36 +201,43 @@ __scratch_xfs_fuzz_field_online() { local fuzz_action="$1" # Mount or else we can't do anything online - echo "+ Mount filesystem to try online repair" + __fuzz_notify "+ Mount filesystem to try online repair" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" + __fuzz_notify "++ Detect fuzzed field (online)" _scratch_scrub -n -a 1 -e continue 2>&1 res=$? test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online scrub didn't fail.") # Try fixing the filesystem online - __fuzz_notify "++ Try to repair filesystem online" + __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online repair failed ($res).") + + # Online scrub should pass now + __fuzz_notify "++ Make sure error is gone (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online re-scrub failed ($res).") __scratch_xfs_fuzz_unmount # Offline scrub should pass now - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") return 0 }
PATCH 12/24 common/fuzzy: fix some problems with the offline repair strategy
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
While auditing the fuzz tester code, I noticed there were numerous problems with the offline repair strategy -- the stages of the strategy are not consistently logged to the kernel log, we don't actually check that repair -n finds the fuzzed field, and since this is an offline test, we don't need or want to mount or try to run the online scrubber. Also, disable prefetch to reduce the chance of an OOM kill. Rework the error messages to make reading the golden output easier.
--- common/fuzzy | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-)
common/fuzzy +10 -21
@@ -246,37 +246,26 @@ __scratch_xfs_fuzz_field_online() { __scratch_xfs_fuzz_field_offline() { local fuzz_action="$1" - # Mount or else we can't do anything offline - echo "+ Mount filesystem to try offline repair" - _try_scratch_mount 2>&1 - res=$? - if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 - fi - - # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" - _scratch_scrub -n -a 1 -e continue 2>&1 + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -eq 0 && \ - (>&2 echo "scrub didn't fail with ${fuzz_action}.") - - __scratch_xfs_fuzz_unmount + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") # Repair the filesystem offline - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 + __fuzz_notify "+ Try to repair the filesystem (offline)" + _repair_scratch_fs -P 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline repair failed ($res).") # See if repair finds a clean fs - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 res=$? test $res -ne 0 && \ - (>&2 echo "offline re-scrub failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") return 0 }
PATCH 13/24 common/fuzzy: fix some problems with the no-repair strategy
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
While auditing the fuzz tester code, I noticed there were numerous problems with the no repair strategy -- the stages of the strategy are not consistently logged to the kernel log, and we don't actually verify that either online or offline scrubs notice the fuzz. Rework the error messages to make reading the golden output easier.
--- common/fuzzy | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
common/fuzzy +17 -3
@@ -274,15 +274,29 @@ __scratch_xfs_fuzz_field_offline() { __scratch_xfs_fuzz_field_norepair() { local fuzz_action="$1" + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Mount or else we can't do anything in norepair mode - echo "+ Mount filesystem to try no repair" + __fuzz_notify "+ Mount filesystem to try online scan" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi + # Make sure online scrub will catch whatever we fuzzed + __fuzz_notify "++ Detect fuzzed field (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: online scrub didn't fail.") + __scratch_xfs_fuzz_unmount return 0
PATCH 14/24 common/fuzzy: fix some problems with the online-then-offline repair strategy
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
While auditing the fuzz tester code, I noticed there were numerous problems with the online-then-offline repair strategy -- the stages of the strategy are not consistently logged to the kernel log, some of the error messages don't identify /which/ scrubber we're calling, we don't do a pre-repair check to make sure we detect the fuzzed fields, and we don't actually re-run online scrub after a repair to make sure that it's ok. Disable xfs_repair prefetch to reduce the possibility of OOM kills. Rework the error messages to make reading the golden output easier.
--- common/fuzzy | 80 ++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 27 deletions(-)
common/fuzzy +53 -27
@@ -306,45 +306,71 @@ __scratch_xfs_fuzz_field_norepair() { __scratch_xfs_fuzz_field_both() { local fuzz_action="$1" + # Make sure offline scrub will catch whatever we fuzzed + __fuzz_notify "+ Detect fuzzed field (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Mount or else we can't do anything in both repair mode - echo "+ Mount filesystem to try both repairs" + __fuzz_notify "+ Mount filesystem to try both repairs" _try_scratch_mount 2>&1 res=$? if [ $res -ne 0 ]; then - (>&2 echo "mount failed ($res) with ${fuzz_action}.") - return 0 + (>&2 echo "${fuzz_action}: mount failed ($res).") + else + # Make sure online scrub will catch whatever we fuzzed + __fuzz_notify "++ Detect fuzzed field (online)" + _scratch_scrub -n -a 1 -e continue 2>&1 + res=$? + test $res -eq 0 && \ + (>&2 echo "${fuzz_action}: online scrub didn't fail.") + + # Try fixing the filesystem online + __fuzz_notify "++ Try to repair filesystem (online)" + _scratch_scrub 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online repair failed ($res).") + + __scratch_xfs_fuzz_unmount + fi + + # Repair the filesystem offline if online repair failed? + if [ $res -ne 0 ]; then + __fuzz_notify "+ Try to repair the filesystem (offline)" + _repair_scratch_fs -P 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline repair failed ($res).") + fi + + # See if repair finds a clean fs + __fuzz_notify "+ Make sure error is gone (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline re-scrub failed ($res).") + + # Mount so that we can see what scrub says after we've fixed the fs + __fuzz_notify "+ Re-mount filesystem to re-try online scan" + _try_scratch_mount 2>&1 + res=$? + if [ $res -ne 0 ]; then + (>&2 echo "${fuzz_action}: mount failed ($res).") + return 1 fi - # Make sure online scrub will catch whatever we fuzzed - echo "++ Online scrub" + # Online scrub should pass now + __fuzz_notify "++ Make sure error is gone (online)" _scratch_scrub -n -a 1 -e continue 2>&1 res=$? - test $res -eq 0 && \ - (>&2 echo "online scrub didn't fail with ${fuzz_action}.") - - # Try fixing the filesystem online - __fuzz_notify "++ Try to repair filesystem online" - _scratch_scrub 2>&1 - res=$? test $res -ne 0 && \ - (>&2 echo "online repair failed ($res) with ${fuzz_action}.") + (>&2 echo "${fuzz_action}: online re-scrub failed ($res).") __scratch_xfs_fuzz_unmount - # Repair the filesystem offline? - echo "+ Try to repair the filesystem offline" - _repair_scratch_fs 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "offline repair failed ($res) with ${fuzz_action}.") - - # See if repair finds a clean fs - echo "+ Make sure error is gone (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "offline re-scrub ($res) with ${fuzz_action}.") - return 0 }
PATCH 15/24 common/fuzzy: fix some problems with the post-repair fs modification code
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
While auditing the fuzz tester code, I noticed there were numerous problems with the code that test-drives the filesystem after we've run the repair strategy. Now that we've made sure that the repair strategy checks its own efficacy, we can rearrange this function to try making mods and then re-check the filesystem afterwards. Also, disable xfs_repair prefetch to reduce the likelihood of OOM kills.
--- common/fuzzy | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-)
common/fuzzy +31 -25
@@ -380,37 +380,43 @@ _scratch_xfs_fuzz_field_modifyfs() { local fuzz_action="$1" local repair="$2" - # Try to mount the filesystem - echo "+ Make sure error is gone (online)" + # Try to mount the filesystem so that we can make changes + __fuzz_notify "+ Mount filesystem to make changes" _try_scratch_mount 2>&1 res=$? - if [ $res -eq 0 ]; then - # Make sure online scrub says the filesystem is clean now - if [ "${repair}" != "none" ]; then - echo "++ Online scrub" - _scratch_scrub -n -e continue 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "online re-scrub ($res) with ${field} = ${fuzzverb}.") - fi - fi + if [ $res -ne 0 ]; then + (>&2 echo "${fuzz_action}: pre-mod mount failed ($res).") + return $res + fi - # Try modifying the filesystem again - __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 + # Try modifying the filesystem again + __fuzz_notify "++ Try to write filesystem again" + _scratch_fuzz_modify 100 2>&1 + + # If we didn't repair anything, there's no point in checking further, + # the fs is still corrupt. + if [ "${repair}" = "none" ]; then __scratch_xfs_fuzz_unmount - else - (>&2 echo "re-mount failed ($res) with ${fuzz_action}.") + return 0 fi - # See if repair finds a clean fs - if [ "${repair}" != "none" ]; then - echo "+ Re-check the filesystem (offline)" - _scratch_xfs_repair -n 2>&1 - res=$? - test $res -ne 0 && \ - (>&2 echo "re-repair failed ($res) with ${field} = ${fuzzverb}.") - fi + # Run an online check to make sure the fs is still ok, unless we + # are running the norepair strategy. + __fuzz_notify "+ Re-check the filesystem (online)" + _scratch_scrub -n -e continue 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: online post-mod scrub failed ($res).") + + __scratch_xfs_fuzz_unmount + + # Run an offline check to make sure the fs is still ok, unless we + # are running the norepair strategy. + __fuzz_notify "+ Re-check the filesystem (offline)" + _scratch_xfs_repair -P -n 2>&1 + res=$? + test $res -ne 0 && \ + (>&2 echo "${fuzz_action}: offline post-mod scrub failed ($res).") return 0 }
PATCH 16/24 xfs/{35[45],455}: fix bogus corruption errors
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
The AGFL fuzz tests first fuzz the entire block header, and second extract flfirst from the AGF header to start a second round of targeted fuzzing of live bno pointers in the AGFL. However, flfirst (and the AGFL field detection at the start of the second round of fuzzing) are detected after we've already been fuzz testing, which means that the AGFL might be garbage because repair failed or was not called. If this is the case, test will fail because the _scratch_xfs_db -c 'agf 0' -c 'p flfirst' call emits things like this:
Fuzz AGFL flfirst
Metadata corruption detected at 0x55f4f789fbc0, xfs_agfl block 0x3/0x200 Metadata corruption detected at 0x55b7356e0bc0, xfs_agfl block 0x3/0x200 Done fuzzing AGFL flfirst
Fix this by restoring the scratch fs before probing flfirst and starting the second round of fuzzing.
--- tests/xfs/354 | 7 ++++++- tests/xfs/355 | 7 ++++++- tests/xfs/455 | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-)
tests/xfs/354 +6 -1
@@ -28,8 +28,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'offline' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst"
tests/xfs/355 +6 -1
@@ -28,8 +28,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'online' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst"
tests/xfs/455 +6 -1
@@ -29,8 +29,13 @@ echo "Fuzz AGFL" _scratch_xfs_fuzz_metadata '' 'none' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL" -echo "Fuzz AGFL flfirst" +# Restore a correct copy of the filesystem before we start the second round of +# fuzzing. This avoids corruption errors from xfs_db when we probe for flfirst +# in the AGF and later when _scratch_xfs_fuzz_metadata probes the AGFL fields. +__scratch_xfs_fuzz_mdrestore flfirst=$(_scratch_xfs_db -c 'agf 0' -c 'p flfirst' | sed -e 's/flfirst = //g') + +echo "Fuzz AGFL flfirst" SCRATCH_XFS_LIST_METADATA_FIELDS="bno[${flfirst}]" _scratch_xfs_fuzz_metadata '' 'none' 'agfl 0' >> $seqres.full echo "Done fuzzing AGFL flfirst"
PATCH 17/24 common/fuzzy: evaluate xfs_check vs xfs_repair
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
When fuzzing a filesystem and using the offline repair strategy, compare the outputs of xfs_check against xfs_repair to ensure that the newer xfs_repair catches at least as many things as xfs_check does.
--- common/fuzzy | 11 +++++++++++ 1 file changed, 11 insertions(+)
common/fuzzy +11 -0
@@ -253,6 +253,17 @@ __scratch_xfs_fuzz_field_offline() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: offline scrub didn't fail.") + # Make sure xfs_repair catches at least as many things as the old + # xfs_check did. + if [ -n "${SCRATCH_XFS_FUZZ_CHECK}" ]; then + __fuzz_notify "+ Detect fuzzed field (xfs_check)" + _scratch_xfs_check 2>&1 + res1=$? + if [ $res1 -ne 0 ] && [ $res -eq 0 ]; then + (>&2 echo "${fuzz_action}: xfs_repair passed but xfs_check failed ($res1).") + fi + fi + # Repair the filesystem offline __fuzz_notify "+ Try to repair the filesystem (offline)" _repair_scratch_fs -P 2>&1
PATCH 18/24 common: check xfs health after doing an online scrub
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
After we've run xfs_scrub -n to perform a check of a mounted filesystem's metadata, we should check the health reporting system to make sure that the results got recorded. Also wire this up to the xfs fuzz testing helpers.
--- common/fuzzy | 27 +++++++++++++++++++++++++++ common/xfs | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+)
common/fuzzy +27 -0
@@ -216,6 +216,15 @@ __scratch_xfs_fuzz_field_online() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + # Try fixing the filesystem online __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1
@@ -308,6 +317,15 @@ __scratch_xfs_fuzz_field_norepair() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + __scratch_xfs_fuzz_unmount return 0
@@ -338,6 +356,15 @@ __scratch_xfs_fuzz_field_both() { test $res -eq 0 && \ (>&2 echo "${fuzz_action}: online scrub didn't fail.") + # Does the health status report reflect the corruption? + if [ $res -ne 0 ]; then + __fuzz_notify "++ Detect fuzzed field ill-health report" + _check_xfs_health $SCRATCH_MNT 2>&1 + res=$? + test $res -ne 1 && \ + (>&2 echo "${fuzz_action}: online health check failed ($res).") + fi + # Try fixing the filesystem online __fuzz_notify "++ Try to repair filesystem (online)" _scratch_scrub 2>&1
common/xfs +43 -0
55 lines not on this page · raw message
PATCH 19/24 common/fuzzy: exercise the filesystem a little harder after repairing
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Use fsstress to exercise the filesystem a little more strenuously after we've run the fuzzing repair strategy, so that we have a better chance of tripping over corruption problems.
--- common/fuzzy | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-)
common/fuzzy +12 -24
@@ -6,30 +6,18 @@ # Modify various files after a fuzzing operation _scratch_fuzz_modify() { - nr="$1" + echo "+++ stressing filesystem" + mkdir -p $SCRATCH_MNT/data + _xfs_force_bdev data $SCRATCH_MNT/data + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/data - test -z "${nr}" && nr=50000 - echo "+++ touch ${nr} files" - blk_sz=$(stat -f -c '%s' ${SCRATCH_MNT}) - $XFS_IO_PROG -f -c "pwrite -S 0x63 0 ${blk_sz}" "/tmp/afile" > /dev/null - date="$(date)" - find "${SCRATCH_MNT}/" -type f 2> /dev/null | head -n "${nr}" | while read f; do - # try to remove append, immutable (and even dax) flag if exists - $XFS_IO_PROG -rc 'chattr -x -i -a' "$f" > /dev/null 2>&1 - setfattr -n "user.date" -v "${date}" "$f" - cat "/tmp/afile" >> "$f" - mv "$f" "$f.longer" - done - sync - rm -rf "/tmp/afile" - - echo "+++ create files" - mkdir -p "${SCRATCH_MNT}/test.moo" - $XFS_IO_PROG -f -c 'pwrite -S 0x80 0 65536' "${SCRATCH_MNT}/test.moo/urk" > /dev/null - sync - - echo "+++ remove files" - rm -rf "${SCRATCH_MNT}/test.moo" + if _xfs_has_feature "$SCRATCH_MNT" realtime; then + mkdir -p $SCRATCH_MNT/rt + _xfs_force_bdev realtime $SCRATCH_MNT/rt + $FSSTRESS_PROG -n $((TIME_FACTOR * 10000)) -p $((LOAD_FACTOR * 4)) -d $SCRATCH_MNT/rt + else + echo "+++ xfs realtime not configured" + fi } # Try to access files after fuzzing
@@ -429,7 +417,7 @@ _scratch_xfs_fuzz_field_modifyfs() { # Try modifying the filesystem again __fuzz_notify "++ Try to write filesystem again" - _scratch_fuzz_modify 100 2>&1 + _scratch_fuzz_modify 2>&1 # If we didn't repair anything, there's no point in checking further, # the fs is still corrupt.
PATCH 20/24 fuzzy: dump metadata state before fuzzing
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
When we start a fuzz test, dump the metadata to stdout so that anyone analyzing a failure can see what was in the (supposedly) good image, and what it turns into after fuzzing.
--- common/fuzzy | 12 ++++++++++++ 1 file changed, 12 insertions(+)
common/fuzzy +12 -0
@@ -110,6 +110,16 @@ __filter_xfs_db_print_fields() { done | grep -E "${filter}" | __filter_unvalidated_xfs_db_fields } +# Dump the current contents of a metadata object. +# All arguments are xfs_db commands to locate the metadata. +_scratch_xfs_dump_metadata() { + local cmds=() + for arg in "$@"; do + cmds+=("-c" "${arg}") + done + _scratch_xfs_db "${cmds[@]}" -c print +} + # Navigate to some part of the filesystem and print the field info. # The first argument is an grep filter for the fields # The rest of the arguments are xfs_db commands to locate the metadata.
@@ -534,6 +544,8 @@ _scratch_xfs_fuzz_metadata() { echo $(echo "${fields}") echo "Verbs we propose to fuzz with:" echo $(echo "${verbs}") + echo "Current metadata object state:" + _scratch_xfs_dump_metadata "$@" # Always capture full core dumps from crashing tools ulimit -c unlimited
PATCH 21/24 fuzzy: compress coredumps created while fuzzing
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Compress the coredumps and put them in the results directory.
--- common/fuzzy | 8 ++++++++ 1 file changed, 8 insertions(+)
common/fuzzy +8 -0
@@ -554,6 +554,14 @@ _scratch_xfs_fuzz_metadata() { echo "${verbs}" | while read fuzzverb; do __scratch_xfs_fuzz_mdrestore __scratch_xfs_fuzz_field_test "${field}" "${fuzzverb}" "${repair}" "$@" + + # Collect compresssed coredumps in the test results + # directory if the sysadmin didn't override the default + # coredump strategy. + for i in core core.*; do + test -f "$i" || continue + _save_coredump "$i" + done done done }
PATCH 22/24 fuzzy: report the fuzzing repair strategy in seqres.full
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Record in the seqres.full file the filesystem repair strategy that we're going to use to detect the fuzzed metadata.
--- common/fuzzy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/fuzzy +1 -1
@@ -540,7 +540,7 @@ _scratch_xfs_fuzz_metadata() { fields="$(_scratch_xfs_list_metadata_fields "${filter}" "$@")" verbs="$(_scratch_xfs_list_fuzz_verbs)" - echo "Fields we propose to fuzz under: $@" + echo "Fields we propose to fuzz with the \"${repair}\" repair strategy: $@" echo $(echo "${fields}") echo "Verbs we propose to fuzz with:" echo $(echo "${verbs}")
PATCH 23/24 xfs: improve metadata array field handling when fuzzing
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Currently, we use some gnarly regular expressions to try to constrain the amount of time we spend fuzzing each element of a metadata array. This is pretty inflexible (and buggy) since we limit some arrays (e.g. dir hashes) to the first ten elements and other arrays (e.g. extent mappings) that use compact index ranges to the first one.
Replace this whole weird mess with logic that can tease out the array indices, unroll the compact indices if needed, and give the user more flexible control over which array elements get used.
--- common/fuzzy | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-)
common/fuzzy +43 -9
@@ -53,12 +53,46 @@ _scratch_scrub() { esac } -# Filter out any keys with an array index >= 10, collapse any array range -# ("[1-195]") to the first item, and ignore padding fields. -__filter_xfs_db_keys() { - sed -e '/\([a-z]*\)\[\([0-9][0-9]\+\)\].*/d' \ - -e 's/\([a-zA-Z0-9_]*\)\[\([0-9]*\)-[0-9]*\]/\1[\2]/g' \ - -e '/pad/d' +# Expand indexed keys (i.e. arrays) into a long format so that we can filter +# the array indices individually, and pass regular keys right through. +# +# For example, "u3.bmx[0-1] = [foo,bar]" is exploded into: +# u3.bmx[0] = [foo,bar] +# u3.bmx[1] = [foo,bar] +# +# Note that we restrict array indices to [0-9] to reduce fuzz runtime. The +# minimum and maximum array indices can be changed by setting the variables +# SCRATCH_XFS_{MIN,MAX}_ARRAY_IDX. +# +# Also filter padding fields. +__explode_xfs_db_fields() { + local min_idx="${SCRATCH_XFS_MIN_ARRAY_IDX}" + local max_idx="${SCRATCH_XFS_MAX_ARRAY_IDX}" + + test -z "${min_idx}" && min_idx=0 + test -z "${max_idx}" && max_idx=9 + test "${max_idx}" = "none" && max_idx=99999 + + grep ' = ' | \ + sed -e 's/^\([.a-zA-Z0-9_]*\)\[\([0-9]*\)-\([0-9]*\)\]\(.*\) = \(.*\)$/\1[%d]\4 \2 \3 = \5/g' \ + -e 's/^\([.a-zA-Z0-9_]*\)\[\([0-9]*\)\]\(.*\) = \(.*\)$/\1[%d]\3 \2 \2 = \4/g' | \ + while read name col1 col2 rest; do + if [[ "${name}" == *pad* ]]; then + continue + fi + + if [ "${col1}" = "=" ]; then + echo "${name} ${col1} ${col2} ${rest}" + continue + fi + + test "${min_idx}" -gt "${col1}" && col1="${min_idx}" + test "${max_idx}" -lt "${col2}" && col2="${max_idx}" + + seq "${col1}" "${col2}" | while read idx; do + printf "${name} %s\n" "${idx}" "${rest}" + done + done } # Filter out metadata fields that are completely controlled by userspace
@@ -96,14 +130,14 @@ __filter_xfs_db_print_fields() { if [ -z "${filter}" ] || [ "${filter}" = "nofilter" ]; then filter='^' fi - grep ' = ' | while read key equals value; do - fuzzkey="$(echo "${key}" | __filter_xfs_db_keys)" + __explode_xfs_db_fields | while read key equals value; do + fuzzkey="$(echo "${key}")" if [ -z "${fuzzkey}" ]; then continue elif [[ "${value}" == "["* ]]; then echo "${value}" | sed -e 's/^.//g' -e 's/.$//g' -e 's/,/\n/g' | while read subfield; do echo "${fuzzkey}.${subfield}" - done | __filter_xfs_db_keys + done else echo "${fuzzkey}" fi
PATCH 24/24 fuzzy: for fuzzing ag btrees, find the path to the AG header
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
The fs population code creates various btrees in /some/ allocation group with at least two levels. These btrees aren't necessarily created in agno 0, so we need to find it programmatically. While we're at it, fix a few of the comments that failed to mention when we're fuzzing interior nodes and not leaves.
--- common/xfs | 37 +++++++++++++++++++++++++++++++++++++ tests/xfs/358 | 5 ++++- tests/xfs/359 | 5 ++++- tests/xfs/360 | 5 ++++- tests/xfs/361 | 5 ++++- tests/xfs/362 | 5 ++++- tests/xfs/363 | 5 ++++- tests/xfs/364 | 5 ++++- tests/xfs/365 | 5 ++++- tests/xfs/366 | 5 ++++- tests/xfs/367 | 5 ++++- tests/xfs/368 | 5 ++++- tests/xfs/369 | 5 ++++- tests/xfs/370 | 5 ++++- tests/xfs/371 | 5 ++++- tests/xfs/372 | 5 ++++- tests/xfs/373 | 7 +++++-- tests/xfs/410 | 5 ++++- tests/xfs/411 | 5 ++++- tests/xfs/457 | 5 ++++- tests/xfs/458 | 5 ++++- tests/xfs/459 | 5 ++++- tests/xfs/460 | 5 ++++- tests/xfs/461 | 5 ++++- tests/xfs/462 | 5 ++++- tests/xfs/463 | 5 ++++- tests/xfs/464 | 7 +++++-- tests/xfs/483 | 5 ++++- 28 files changed, 147 insertions(+), 29 deletions(-)
common/xfs +37 -0
@@ -1686,3 +1686,40 @@ _xfs_get_inode_core_bytes() echo 96 fi } + +# Find us the path to the AG header containing a per-AG btree with a specific +# height. +_scratch_xfs_find_agbtree_height() { + local bt_type="$1" + local bt_height="$2" + local agcount=$(_xfs_mount_agcount $SCRATCH_DEV) + + case "${bt_type}" in + "bno"|"cnt"|"rmap"|"refcnt") + hdr="agf" + bt_prefix="${bt_type}" + ;; + "ino") + hdr="agi" + bt_prefix="" + ;; + "fino") + hdr="agi" + bt_prefix="free_" + ;; + *) + _fail "Don't know about AG btree ${bt_type}" + ;; + esac + + for ((agno = 0; agno < agcount; agno++)); do + bt_level=$(_scratch_xfs_db -c "${hdr} ${agno}" -c "p ${bt_prefix}level" | awk '{print $3}') + # "level" is really the btree height + if [ "${bt_level}" -eq "${bt_height}" ]; then + echo "${hdr} ${agno}" + return 0 + fi + done + + return 1 +}
tests/xfs/358 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done
tests/xfs/359 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done
tests/xfs/360 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done
tests/xfs/361 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done
tests/xfs/362 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done
tests/xfs/363 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done
tests/xfs/364 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done
tests/xfs/365 +4 -1
@@ -24,8 +24,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'online' 'agi 1' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done
tests/xfs/366 +4 -1
@@ -25,8 +25,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done
tests/xfs/367 +4 -1
@@ -25,8 +25,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'online' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done
tests/xfs/368 +4 -1
@@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done
tests/xfs/369 +4 -1
@@ -25,8 +25,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done
tests/xfs/370 +4 -1
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done
tests/xfs/371 +4 -1
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done
tests/xfs/372 +4 -1
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
tests/xfs/373 +5 -2
@@ -4,7 +4,7 @@ # # FS QA Test No. 373 # -# Populate a XFS filesystem and fuzz every refcountbt field. +# Populate a XFS filesystem and fuzz every refcountbt key/pointer field. # Use xfs_scrub to fix the corruption. # . ./common/preamble
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
tests/xfs/410 +4 -1
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'offline' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'offline' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
tests/xfs/411 +4 -1
@@ -26,8 +26,11 @@ _require_scratch_xfs_fuzz_fields echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'online' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'online' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
tests/xfs/457 +4 -1
@@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt recs" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing bnobt recs" # success, all done
tests/xfs/458 +4 -1
@@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'bno' 2)" || \ + _fail "could not find two-level bnobt" + echo "Fuzz bnobt keyptr" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr bnoroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr bnoroot' >> $seqres.full echo "Done fuzzing bnobt keyptr" # success, all done
tests/xfs/459 +4 -1
@@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'cnt' 2)" || \ + _fail "could not find two-level cntbt" + echo "Fuzz cntbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr cntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr cntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing cntbt" # success, all done
tests/xfs/460 +4 -1
@@ -25,8 +25,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'ino' 2)" || \ + _fail "could not find two-level inobt" + echo "Fuzz inobt" -_scratch_xfs_fuzz_metadata '' 'none' 'agi 1' 'addr root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing inobt" # success, all done
tests/xfs/461 +4 -1
@@ -26,8 +26,11 @@ _require_xfs_finobt echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'fino' 2)" || \ + _fail "could not find two-level finobt" + echo "Fuzz finobt" -_scratch_xfs_fuzz_metadata '' 'none' 'agi 0' 'addr free_root' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr free_root' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing finobt" # success, all done
tests/xfs/462 +4 -1
@@ -26,8 +26,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt recs" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing rmapbt recs" # success, all done
tests/xfs/463 +4 -1
@@ -26,8 +26,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'rmap' 2)" || \ + _fail "could not find two-level rmapbt" + echo "Fuzz rmapbt keyptr" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr rmaproot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr rmaproot' >> $seqres.full echo "Done fuzzing rmapbt keyptr" # success, all done
tests/xfs/464 +5 -2
@@ -4,7 +4,7 @@ # # FS QA Test No. 464 # -# Populate a XFS filesystem and fuzz every refcountbt field. +# Populate a XFS filesystem and fuzz every refcountbt key/pointer field. # Do not fix the filesystem, to test metadata verifiers. . ./common/preamble
@@ -27,8 +27,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
tests/xfs/483 +4 -1
@@ -27,8 +27,11 @@ _disable_dmesg_check echo "Format and populate" _scratch_populate_cached nofill > $seqres.full 2>&1 +path="$(_scratch_xfs_find_agbtree_height 'refcnt' 2)" || \ + _fail "could not find two-level refcountbt" + echo "Fuzz refcountbt" -_scratch_xfs_fuzz_metadata '' 'none' 'agf 0' 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full +_scratch_xfs_fuzz_metadata '' 'none' "$path" 'addr refcntroot' 'addr ptrs[1]' >> $seqres.full echo "Done fuzzing refcountbt" # success, all done
cover fstests: strengthen fuzz testing
In reply to Darrick J. WongHi all,
This patchset fills some gaps in our fuzz testing for XFS. I forgot to include fuzz testing the data fork mappings of directories and xattrs to see how scrub responds to nonsensical file maps, and I omitted tests to fuzz the realtime metadata. Add those.
Finally, add a new fuzz testing strategy known as bothrepair. This simulates what system administrators are most likely to do upon receiving a health alert about a pet filesystem -- try to repair it with xfs_scrub, and if that doesn't work, unmount the filesystem and run xfs_repair. Between the two, we ought to be able to fix every possible problem.
If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below.
This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome.
--D
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=more-fuzz-testing
--- common/fuzzy | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++- tests/xfs/1500 | 35 +++++++++++++ tests/xfs/1500.out | 4 + tests/xfs/1501 | 35 +++++++++++++ tests/xfs/1501.out | 4 + tests/xfs/1502 | 45 +++++++++++++++++ tests/xfs/1502.out | 6 ++ tests/xfs/1503 | 35 +++++++++++++ tests/xfs/1503.out | 4 + tests/xfs/1504 | 38 ++++++++++++++ tests/xfs/1504.out | 4 + tests/xfs/1505 | 38 ++++++++++++++ tests/xfs/1505.out | 4 + tests/xfs/1506 | 38 ++++++++++++++ tests/xfs/1506.out | 4 + tests/xfs/1507 | 38 ++++++++++++++ tests/xfs/1507.out | 4 + tests/xfs/1508 | 39 +++++++++++++++ tests/xfs/1508.out | 4 + tests/xfs/1509 | 39 +++++++++++++++ tests/xfs/1509.out | 4 + tests/xfs/1510 | 39 +++++++++++++++ tests/xfs/1510.out | 4 + tests/xfs/1511 | 40 +++++++++++++++ tests/xfs/1511.out | 4 + tests/xfs/1512 | 40 +++++++++++++++ tests/xfs/1512.out | 5 ++ tests/xfs/1513 | 40 +++++++++++++++ tests/xfs/1513.out | 5 ++ tests/xfs/1514 | 40 +++++++++++++++ tests/xfs/1514.out | 5 ++ tests/xfs/1515 | 42 ++++++++++++++++ tests/xfs/1515.out | 5 ++ tests/xfs/1516 | 40 +++++++++++++++ tests/xfs/1516.out | 5 ++ tests/xfs/1517 | 40 +++++++++++++++ tests/xfs/1517.out | 5 ++ tests/xfs/1518 | 40 +++++++++++++++ tests/xfs/1518.out | 5 ++ tests/xfs/1519 | 41 +++++++++++++++ tests/xfs/1519.out | 5 ++ tests/xfs/1520 | 42 ++++++++++++++++ tests/xfs/1520.out | 5 ++ tests/xfs/1521 | 42 ++++++++++++++++ tests/xfs/1521.out | 5 ++ tests/xfs/1522 | 42 ++++++++++++++++ tests/xfs/1522.out | 5 ++ tests/xfs/1523 | 42 ++++++++++++++++ tests/xfs/1523.out | 5 ++ tests/xfs/1524 | 40 +++++++++++++++ tests/xfs/1524.out | 5 ++ tests/xfs/1525 | 40 +++++++++++++++ tests/xfs/1525.out | 5 ++ tests/xfs/1526 | 40 +++++++++++++++ tests/xfs/1526.out | 5 ++ tests/xfs/1527 | 40 +++++++++++++++ tests/xfs/1527.out | 5 ++ tests/xfs/1530 | 40 +++++++++++++++ tests/xfs/1530.out | 4 + tests/xfs/1531 | 40 +++++++++++++++ tests/xfs/1531.out | 5 ++ tests/xfs/1532 | 40 +++++++++++++++ tests/xfs/1532.out | 5 ++ tests/xfs/1533 | 40 +++++++++++++++ tests/xfs/1533.out | 5 ++ tests/xfs/1534 | 38 ++++++++++++++ tests/xfs/1534.out | 4 + tests/xfs/1535 | 38 ++++++++++++++ tests/xfs/1535.out | 4 + tests/xfs/1536 | 38 ++++++++++++++ tests/xfs/1536.out | 4 + tests/xfs/1537 | 41 +++++++++++++++ tests/xfs/1537.out | 5 ++ tests/xfs/1554 | 48 ++++++++++++++++++ tests/xfs/1554.out | 10 ++++ tests/xfs/1555 | 48 ++++++++++++++++++ tests/xfs/1555.out | 10 ++++ tests/xfs/1556 | 48 ++++++++++++++++++ tests/xfs/1556.out | 10 ++++ tests/xfs/1557 | 48 ++++++++++++++++++ tests/xfs/1557.out | 10 ++++ tests/xfs/1558 | 48 ++++++++++++++++++ tests/xfs/1558.out | 10 ++++ tests/xfs/1559 | 48 ++++++++++++++++++ tests/xfs/1559.out | 10 ++++ tests/xfs/1560 | 49 ++++++++++++++++++ tests/xfs/1560.out | 10 ++++ tests/xfs/1561 | 49 ++++++++++++++++++ tests/xfs/1561.out | 10 ++++ tests/xfs/1562 | 41 +++++++++++++++ tests/xfs/1562.out | 4 + tests/xfs/1563 | 41 +++++++++++++++ tests/xfs/1563.out | 4 + tests/xfs/1564 | 41 +++++++++++++++ tests/xfs/1564.out | 4 + tests/xfs/1565 | 41 +++++++++++++++ tests/xfs/1565.out | 4 + tests/xfs/1566 | 42 ++++++++++++++++ tests/xfs/1566.out | 4 + tests/xfs/1567 | 42 ++++++++++++++++ tests/xfs/1567.out | 4 + tests/xfs/1568 | 41 +++++++++++++++ tests/xfs/1568.out | 4 + tests/xfs/1569 | 41 +++++++++++++++ tests/xfs/1569.out | 4 + tests/xfs/1570 | 36 +++++++++++++ tests/xfs/1570.out | 4 + tests/xfs/1571 | 36 +++++++++++++ tests/xfs/1571.out | 4 + tests/xfs/1572 | 38 ++++++++++++++ tests/xfs/1572.out | 4 + tests/xfs/1573 | 37 ++++++++++++++ tests/xfs/1573.out | 4 + 113 files changed, 2717 insertions(+), 4 deletions(-) create mode 100755 tests/xfs/1500 create mode 100644 tests/xfs/1500.out create mode 100755 tests/xfs/1501 create mode 100644 tests/xfs/1501.out create mode 100755 tests/xfs/1502 create mode 100644 tests/xfs/1502.out create mode 100755 tests/xfs/1503 create mode 100644 tests/xfs/1503.out create mode 100755 tests/xfs/1504 create mode 100644 tests/xfs/1504.out create mode 100755 tests/xfs/1505 create mode 100644 tests/xfs/1505.out create mode 100755 tests/xfs/1506 create mode 100644 tests/xfs/1506.out create mode 100755 tests/xfs/1507 create mode 100644 tests/xfs/1507.out create mode 100755 tests/xfs/1508 create mode 100644 tests/xfs/1508.out create mode 100755 tests/xfs/1509 create mode 100644 tests/xfs/1509.out create mode 100755 tests/xfs/1510 create mode 100644 tests/xfs/1510.out create mode 100755 tests/xfs/1511 create mode 100644 tests/xfs/1511.out create mode 100755 tests/xfs/1512 create mode 100644 tests/xfs/1512.out create mode 100755 tests/xfs/1513 create mode 100644 tests/xfs/1513.out create mode 100755 tests/xfs/1514 create mode 100644 tests/xfs/1514.out create mode 100755 tests/xfs/1515 create mode 100644 tests/xfs/1515.out create mode 100755 tests/xfs/1516 create mode 100644 tests/xfs/1516.out create mode 100755 tests/xfs/1517 create mode 100644 tests/xfs/1517.out create mode 100755 tests/xfs/1518 create mode 100644 tests/xfs/1518.out create mode 100755 tests/xfs/1519 create mode 100644 tests/xfs/1519.out create mode 100755 tests/xfs/1520 create mode 100644 tests/xfs/1520.out create mode 100755 tests/xfs/1521 create mode 100644 tests/xfs/1521.out create mode 100755 tests/xfs/1522 create mode 100644 tests/xfs/1522.out create mode 100755 tests/xfs/1523 create mode 100644 tests/xfs/1523.out create mode 100755 tests/xfs/1524 create mode 100644 tests/xfs/1524.out create mode 100755 tests/xfs/1525 create mode 100644 tests/xfs/1525.out create mode 100755 tests/xfs/1526 create mode 100644 tests/xfs/1526.out create mode 100755 tests/xfs/1527 create mode 100644 tests/xfs/1527.out create mode 100755 tests/xfs/1530 create mode 100644 tests/xfs/1530.out create mode 100755 tests/xfs/1531 create mode 100644 tests/xfs/1531.out create mode 100755 tests/xfs/1532 create mode 100644 tests/xfs/1532.out create mode 100755 tests/xfs/1533 create mode 100644 tests/xfs/1533.out create mode 100755 tests/xfs/1534 create mode 100644 tests/xfs/1534.out create mode 100755 tests/xfs/1535 create mode 100644 tests/xfs/1535.out create mode 100755 tests/xfs/1536 create mode 100644 tests/xfs/1536.out create mode 100755 tests/xfs/1537 create mode 100644 tests/xfs/1537.out create mode 100755 tests/xfs/1554 create mode 100644 tests/xfs/1554.out create mode 100755 tests/xfs/1555 create mode 100644 tests/xfs/1555.out create mode 100755 tests/xfs/1556 create mode 100644 tests/xfs/1556.out create mode 100755 tests/xfs/1557 create mode 100644 tests/xfs/1557.out create mode 100755 tests/xfs/1558 create mode 100644 tests/xfs/1558.out create mode 100755 tests/xfs/1559 create mode 100644 tests/xfs/1559.out create mode 100755 tests/xfs/1560 create mode 100644 tests/xfs/1560.out create mode 100755 tests/xfs/1561 create mode 100644 tests/xfs/1561.out create mode 100755 tests/xfs/1562 create mode 100644 tests/xfs/1562.out create mode 100755 tests/xfs/1563 create mode 100644 tests/xfs/1563.out create mode 100755 tests/xfs/1564 create mode 100644 tests/xfs/1564.out create mode 100755 tests/xfs/1565 create mode 100644 tests/xfs/1565.out create mode 100755 tests/xfs/1566 create mode 100644 tests/xfs/1566.out create mode 100755 tests/xfs/1567 create mode 100644 tests/xfs/1567.out create mode 100755 tests/xfs/1568 create mode 100644 tests/xfs/1568.out create mode 100755 tests/xfs/1569 create mode 100644 tests/xfs/1569.out create mode 100755 tests/xfs/1570 create mode 100644 tests/xfs/1570.out create mode 100755 tests/xfs/1571 create mode 100644 tests/xfs/1571.out create mode 100755 tests/xfs/1572 create mode 100755 tests/xfs/1572.out create mode 100755 tests/xfs/1573 create mode 100644 tests/xfs/1573.out
PATCH 1/5 fuzzy: test fuzzing directory block mappings
From: Darrick J. Wong <[email protected]>
Fuzz the block mappings of directories to see what happens.
--- common/fuzzy | 16 ++++++++++++++++ tests/xfs/1554 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1554.out | 10 ++++++++++ tests/xfs/1555 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1555.out | 10 ++++++++++ tests/xfs/1556 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1556.out | 10 ++++++++++ 7 files changed, 190 insertions(+) create mode 100755 tests/xfs/1554 create mode 100644 tests/xfs/1554.out create mode 100755 tests/xfs/1555 create mode 100644 tests/xfs/1555.out create mode 100755 tests/xfs/1556 create mode 100644 tests/xfs/1556.out
common/fuzzy +16 -0
@@ -549,6 +549,22 @@ _require_scratch_xfs_fuzz_fields() _require_xfs_db_command "fuzz" } +# Sets the array SCRATCH_XFS_DIR_FUZZ_TYPES to the list of directory formats +# available for fuzzing. Each list item must match one of the /S_IFDIR.FMT_* +# files created by the fs population code. Users can override this by setting +# SCRATCH_XFS_LIST_FUZZ_DIRTYPE in the environment. BTREE is omitted here +# because that refers to the fork format and does not affect the directory +# structure at all. +_scratch_xfs_set_dir_fuzz_types() { + if [ -n "${SCRATCH_XFS_LIST_FUZZ_DIRTYPE}" ]; then + mapfile -t SCRATCH_XFS_DIR_FUZZ_TYPES < \ + <(echo "${SCRATCH_XFS_LIST_FUZZ_DIRTYPE}" | tr '[ ,]' '[\n\n]') + return + fi + + SCRATCH_XFS_DIR_FUZZ_TYPES=(BLOCK LEAF LEAFN NODE) +} + # Grab the list of available fuzzing verbs _scratch_xfs_list_fuzz_verbs() { if [ -n "${SCRATCH_XFS_LIST_FUZZ_VERBS}" ]; then
tests/xfs/1554 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1554.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1554 +Format and populate +Fuzz block map for BLOCK +Done fuzzing dir map BLOCK +Fuzz block map for LEAF +Done fuzzing dir map LEAF +Fuzz block map for LEAFN +Done fuzzing dir map LEAFN +Fuzz block map for NODE +Done fuzzing dir map NODE
tests/xfs/1555 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1555.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1555 +Format and populate +Fuzz block map for BLOCK +Done fuzzing dir map BLOCK +Fuzz block map for LEAF +Done fuzzing dir map LEAF +Fuzz block map for LEAFN +Done fuzzing dir map LEAFN +Fuzz block map for NODE +Done fuzzing dir map NODE
tests/xfs/1556 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1556.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1556 +Format and populate +Fuzz block map for BLOCK +Done fuzzing dir map BLOCK +Fuzz block map for LEAF +Done fuzzing dir map LEAF +Fuzz block map for LEAFN +Done fuzzing dir map LEAFN +Fuzz block map for NODE +Done fuzzing dir map NODE
PATCH 2/5 fuzzy: test fuzzing xattr block mappings
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Fuzz the block mappings of extended attributes to see what happens.
--- common/fuzzy | 16 ++++++++++++++++ tests/xfs/1557 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1557.out | 10 ++++++++++ tests/xfs/1558 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1558.out | 10 ++++++++++ tests/xfs/1559 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1559.out | 10 ++++++++++ 7 files changed, 190 insertions(+) create mode 100755 tests/xfs/1557 create mode 100644 tests/xfs/1557.out create mode 100755 tests/xfs/1558 create mode 100644 tests/xfs/1558.out create mode 100755 tests/xfs/1559 create mode 100644 tests/xfs/1559.out
common/fuzzy +16 -0
@@ -565,6 +565,22 @@ _scratch_xfs_set_dir_fuzz_types() { SCRATCH_XFS_DIR_FUZZ_TYPES=(BLOCK LEAF LEAFN NODE) } +# Sets the array SCRATCH_XFS_XATTR_FUZZ_TYPES to the list of xattr formats +# available for fuzzing. Each list item must match one of the /ATTR.FMT_* +# files created by the fs population code. Users can override this by setting +# SCRATCH_XFS_LIST_FUZZ_XATTRTYPE in the environment. BTREE is omitted here +# because that refers to the fork format and does not affect the extended +# attribute structure at all. +_scratch_xfs_set_xattr_fuzz_types() { + if [ -n "${SCRATCH_XFS_LIST_FUZZ_XATTRTYPE}" ]; then + mapfile -t SCRATCH_XFS_XATTR_FUZZ_TYPES < \ + <(echo "${SCRATCH_XFS_LIST_FUZZ_XATTRTYPE}" | tr '[ ,]' '[\n\n]') + return + fi + + SCRATCH_XFS_XATTR_FUZZ_TYPES=(EXTENTS_REMOTE3K EXTENTS_REMOTE4K LEAF NODE) +} + # Grab the list of available fuzzing verbs _scratch_xfs_list_fuzz_verbs() { if [ -n "${SCRATCH_XFS_LIST_FUZZ_VERBS}" ]; then
tests/xfs/1557 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1557.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1557 +Format and populate +Fuzz block map for EXTENTS_REMOTE3K +Done fuzzing attr map EXTENTS_REMOTE3K +Fuzz block map for EXTENTS_REMOTE4K +Done fuzzing attr map EXTENTS_REMOTE4K +Fuzz block map for LEAF +Done fuzzing attr map LEAF +Fuzz block map for NODE +Done fuzzing attr map NODE
tests/xfs/1558 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1558.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1558 +Format and populate +Fuzz block map for EXTENTS_REMOTE3K +Done fuzzing attr map EXTENTS_REMOTE3K +Fuzz block map for EXTENTS_REMOTE4K +Done fuzzing attr map EXTENTS_REMOTE4K +Fuzz block map for LEAF +Done fuzzing attr map LEAF +Fuzz block map for NODE +Done fuzzing attr map NODE
tests/xfs/1559 new file +48 -0
48 lines not on this page · raw message
tests/xfs/1559.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 1559 +Format and populate +Fuzz block map for EXTENTS_REMOTE3K +Done fuzzing attr map EXTENTS_REMOTE3K +Fuzz block map for EXTENTS_REMOTE4K +Done fuzzing attr map EXTENTS_REMOTE4K +Fuzz block map for LEAF +Done fuzzing attr map LEAF +Fuzz block map for NODE +Done fuzzing attr map NODE