Re: [PATCH] common/fuzzy: don't attempt online scrubbing unless supported

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Apr 21, 2020 at 01:36:42PM +0200, Anthony Iliopoulos wrote:
> Many xfs metadata fuzzing tests invoke xfs_scrub to detect online errors
> even when _scratch_xfs_fuzz_metadata is invoked with "offline". This
> causes those tests to fail with output mismatches on kernels that don't
> enable CONFIG_XFS_ONLINE_SCRUB. Bypass scrubbing when not supported.
> 
> Signed-off-by: Anthony Iliopoulos <ailiop@xxxxxxxx>
> ---
>  common/fuzzy | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/fuzzy b/common/fuzzy
> index 988203b1..83ddc3e8 100644
> --- a/common/fuzzy
> +++ b/common/fuzzy
> @@ -238,7 +238,7 @@ __scratch_xfs_fuzz_field_test() {
>  	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
> +		if _supports_xfs_scrub "${SCRATCH_MNT}" "${SCRATCH_DEV}"; then

Huh?

This changes the behavior of the repair=none fuzz tests, which mutate
filesystems and then write to them without running any checking tools
whatsoever to see if we can trip over the mutations with only regular
filesystem operations.  Whereas before, we'd skip xfs_scrub, now we
always run it if it's supported.

The open-coded repair conditionals scattered through this funciton
probably ought to be refactored into helpers, e.g.

__fuzz_want_scrub_check() {
	local repair="$1"
	local field="$2"

	test "${repair}" != "none" && \
		_supports_xfs_scrub "${SCRATCH_MNT}" "${SCRATCH_DEV}" && \
		[ "${field}" != "sb 0" ]
}

if [ $res -eq 0 ]; then
	# Try an online scrub...
	if __fuzz_want_scrub_check "${repair}" "${field}"; then
		_scratch_scrub -n -a 1 -e continue 2>&1
		...

--D

>  			echo "++ Online scrub"
>  			if [ "$1" != "sb 0" ]; then
>  				_scratch_scrub -n -e continue 2>&1
> -- 
> 2.26.2
> 



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux