_supports_xfs_scrub cleanups v2
Hi all,
this series adds a missing scrub support fix to xfs/262 and cleans up a few bits around this.
Changes since v1:
- use _fail
- also annotate xfs/506
PATCH 1/4 xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
Add a sanity check that the passed in mount point is actually mounted to guard against actually calling _supports_xfs_scrub before $SCRATCH_MNT is mounted.
--- common/xfs | 3 +++ 1 file changed, 3 insertions(+)
common/xfs +3 -0
@@ -649,6 +649,9 @@ _supports_xfs_scrub() test "$FSTYP" = "xfs" || return 1 test -x "$XFS_SCRUB_PROG" || return 1 + mountpoint $mountpoint >/dev/null || \ + _fail "$mountpoint is not mounted" + # Probe for kernel support... $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1 $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1
Signature · 1 line
2.39.2
Re: [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
Quoted 6 lines · Christoph Hellwig
Add a sanity check that the passed in mount point is actually mounted to guard against actually calling
_supports_xfs_scrubbefore $SCRATCH_MNT is mounted.Signed-off-by Christoph Hellwig <[email protected]>---
This version is good to me, thanks!
Quoted 21 lines
common/xfs | 3 +++ 1 file changed, 3 insertions(+)common/xfs +3
-0@@ -649,6 +649,9 @@ _supports_xfs_scrub() test "$FSTYP" = "xfs" || return 1 test -x "$XFS_SCRUB_PROG" || return 1 + mountpoint $mountpoint >/dev/null || \ + _fail "$mountpoint is not mounted" + # Probe for kernel support... $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1 $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1Signature · 1 line
2.39.2
Re: [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
In reply to Christoph HellwigQuoted 14 lines · Christoph Hellwig
Add a sanity check that the passed in mount point is actually mounted to guard against actually calling
_supports_xfs_scrubbefore $SCRATCH_MNT is mounted.Signed-off-by Christoph Hellwig <[email protected]>--- common/xfs | 3 +++ 1 file changed, 3 insertions(+)common/xfs +0
-0
common/xfs _supports_xfs_scrub() · line 653
Quoted 5 lines
common/xfs +2
-0@@ -649,6 +649,9 @@ _supports_xfs_scrub() test "$FSTYP" = "xfs" || return 1 test -x "$XFS_SCRUB_PROG" || return 1 + mountpoint $mountpoint >/dev/null || \ + _fail "$mountpoint is not mounted"
Looks good,
--D
Quoted 8 lines
common/xfs +1
-0+ # Probe for kernel support... $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1 $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1Signature · 1 line
2.39.2
PATCH 2/4 xfs: add a _scratch_require_xfs_scrub helper
In reply to Christoph HellwigAdd a helper to call _supports_xfs_scrub with $SCRATCH_MNT and $SCRATCH_DEV.
--- common/xfs | 7 +++++++ tests/xfs/556 | 2 +- tests/xfs/716 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)
common/xfs +7 -0
@@ -662,6 +662,13 @@ _supports_xfs_scrub() return 0 } +# Does the scratch file system support scrub? +_scratch_require_xfs_scrub() +{ + _supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || \ + _notrun "Scrub not supported" +} + # Save a snapshot of a corrupt xfs filesystem for later debugging. _xfs_metadump() { local metadump="$1"
tests/xfs/556 +1 -1
@@ -40,7 +40,7 @@ _scratch_mkfs >> $seqres.full _dmerror_init _dmerror_mount >> $seqres.full 2>&1 -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Write a file with 4 file blocks worth of data victim=$SCRATCH_MNT/a
tests/xfs/716 +1 -1
@@ -31,7 +31,7 @@ _require_test_program "punch-alternating" _scratch_mkfs > $tmp.mkfs _scratch_mount -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Force data device extents so that we can create a file with the exact bmbt # that we need regardless of rt configuration.
Signature · 1 line
2.39.2
Re: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
Quoted 15 lines · Christoph Hellwig
Add a helper to call
_supports_xfs_scrubwith $SCRATCH_MNT and $SCRATCH_DEV.Signed-off-by Christoph Hellwig <[email protected]>--- common/xfs | 7 +++++++ tests/xfs/556 | 2 +- tests/xfs/716 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-)common/xfs +0
-0
common/xfs _supports_xfs_scrub() · line 666
Quoted 5 lines
common/xfs +2
-0@@ -662,6 +662,13 @@ _supports_xfs_scrub() return 0 } +# Does the scratch file system support scrub? +_scratch_require_xfs_scrub()
Usually we name a require helper as _require_xxxxxxxx, you can find that by running grep -rsn scratch_require common/ and grep -rsn require_scratch common/.
So better to change this name to _require_scratch_xfs_scrub. That's a simple change, I can help to change that when I merge this patchset.
Thanks,
Zorro
Quoted 38 lines
common/xfs +5
-0+{ + _supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || \ + _notrun "Scrub not supported" +} + # Save a snapshot of a corrupt xfs filesystem for later debugging. _xfs_metadump() { local metadump="$1"tests/xfs/556 +1
-1@@ -40,7 +40,7 @@ _scratch_mkfs >> $seqres.full _dmerror_init _dmerror_mount >> $seqres.full 2>&1 -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Write a file with 4 file blocks worth of data victim=$SCRATCH_MNT/atests/xfs/716 +1
-1@@ -31,7 +31,7 @@ _require_test_program "punch-alternating" _scratch_mkfs > $tmp.mkfs _scratch_mount -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported" +_scratch_require_xfs_scrub # Force data device extents so that we can create a file with the exact bmbt # that we need regardless of rt configuration.Signature · 1 line
2.39.2
Re: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
Quoted 5 lines · Zorro Lang
Usually we name a require helper as
_require_xxxxxxxx, you can find that by runninggrep -rsn scratch_require common/andgrep -rsn require_scratch common/.So better to change this name to
_require_scratch_xfs_scrub. That's a simple change, I can help to change that when I merge this patchset.
Fine with me. I just took the name that Darrick suggested.
Darrick J. Wong
Reviewed-byRe: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · Zorro Lang
Usually we name a require helper as
_require_xxxxxxxx, you can find that by runninggrep -rsn scratch_require common/andgrep -rsn require_scratch common/.So better to change this name to
_require_scratch_xfs_scrub. That's a simple change, I can help to change that when I merge this patchset.Fine with me. I just took the name that Darrick suggested.
Either name is fine with me, so go with what the maintainer recommends. Sorry for the churn :)
--D
Quoted 2 lines
PATCH 3/4 xfs/262: call _scratch_require_xfs_scrub
In reply to Christoph HellwigCall _scratch_require_xfs_scrub so that the test is _notrun on kernels without online scrub support.
--- tests/xfs/262 | 3 +++ 1 file changed, 3 insertions(+)
tests/xfs/262 +3 -0
@@ -29,6 +29,9 @@ _require_xfs_io_error_injection "force_repair" echo "Format and populate" _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount + +_scratch_require_xfs_scrub + cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub $LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do cp $lib $SCRATCH_MNT/
Signature · 1 line
2.39.2
Re: [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub
Quoted 4 lines · Christoph Hellwig
Call
_scratch_require_xfs_scrubso that the test is_notrunon kernels without online scrub support.Signed-off-by Christoph Hellwig <[email protected]>
With _require_scratch_xfs_scrub,
--D
Quoted 22 lines
--- tests/xfs/262 | 3 +++ 1 file changed, 3 insertions(+)tests/xfs/262 +3
-0@@ -29,6 +29,9 @@ _require_xfs_io_error_injection "force_repair" echo "Format and populate" _scratch_mkfs > "$seqres.full" 2>&1 _scratch_mount + +_scratch_require_xfs_scrub + cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub $LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do cp $lib $SCRATCH_MNT/Signature · 1 line
2.39.2
PATCH 4/4 xfs/506: call _scratch_require_xfs_scrub
In reply to Christoph HellwigCall _scratch_require_xfs_scrub so that the test is _notrun on kernels without online scrub support.
--- tests/xfs/506 | 3 +++ 1 file changed, 3 insertions(+)
tests/xfs/506 +3 -0
@@ -21,6 +21,9 @@ _require_xfs_spaceman_command "health" _scratch_mkfs > $seqres.full 2>&1 _scratch_mount + +_scratch_require_xfs_scrub + _scratch_cycle_mount # make sure we haven't run quotacheck on this mount # Haven't checked anything, it should tell us to run scrub
Signature · 1 line
2.39.2
Re: [PATCH 4/4] xfs/506: call _scratch_require_xfs_scrub
Quoted 4 lines · Christoph Hellwig
Call
_scratch_require_xfs_scrubso that the test is_notrunon kernels without online scrub support.Signed-off-by Christoph Hellwig <[email protected]>
With whatever name we picked for the helper,
--D
Quoted 22 lines
--- tests/xfs/506 | 3 +++ 1 file changed, 3 insertions(+)tests/xfs/506 +3
-0@@ -21,6 +21,9 @@ _require_xfs_spaceman_command "health" _scratch_mkfs > $seqres.full 2>&1 _scratch_mount + +_scratch_require_xfs_scrub + _scratch_cycle_mount # make sure we haven't run quotacheck on this mount # Haven't checked anything, it should tell us to run scrubSignature · 1 line
2.39.2