diff mbox series

fstests: mkfs the scratch device if we have missing profiles

Message ID adcf935ecd3d44957ee244b91790ee7b73df134b.1715112528.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series fstests: mkfs the scratch device if we have missing profiles | expand

Commit Message

Josef Bacik May 7, 2024, 8:08 p.m. UTC
I have a btrfs config where I specifically exclude raid56 testing, and
this resulted in btrfs/011 failing with an inconsistent file system.
This happens because the last test we run does a btrfs device replace of
the $SCRATCH_DEV, leaving it with no valid file system.  We then skip
the remaining profiles and exit, but then we go to check the device on
$SCRATCH_DEV and it fails because there is no file system.

Fix this to re-make the scratch device if we skip any of the raid
profiles.  This only happens in the case of some idiot user configuring
their testing in a special way, in normal runs of this test we'll never
re-make the fs.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 tests/btrfs/011 | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Johannes Thumshirn May 8, 2024, 11:53 a.m. UTC | #1
On 07.05.24 22:10, Josef Bacik wrote:
> I have a btrfs config where I specifically exclude raid56 testing, and
> this resulted in btrfs/011 failing with an inconsistent file system.
> This happens because the last test we run does a btrfs device replace of
> the $SCRATCH_DEV, leaving it with no valid file system.  We then skip
> the remaining profiles and exit, but then we go to check the device on
> $SCRATCH_DEV and it fails because there is no file system.
> 
> Fix this to re-make the scratch device if we skip any of the raid
> profiles.  This only happens in the case of some idiot user configuring
> their testing in a special way, in normal runs of this test we'll never
> re-make the fs.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   tests/btrfs/011 | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index d8b5a978..b8c14f3b 100755
> --- a/tests/btrfs/011
> +++ b/tests/btrfs/011
> @@ -257,6 +257,12 @@ for t in "-m single -d single:1 no 64" \
>   	workout_option=${t#*:}
>   	if [[ "${_btrfs_profile_configs[@]}" =~ "${mkfs_option/ -M}"( |$) ]]; then
>   		workout "$mkfs_option" $workout_option
> +	else
> +		# If we have limited the profile configs we could leave
> +		# $SCRATCH_DEV in an inconsistent state (because it was
> +		# replaced), so mkfs the scratch device to make sure we don't
> +		# trip the fs check at the end.
> +		_scratch_mkfs > /dev/null 2>&1
>   	fi
>   done
>   

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Btw, looking at test, we'd also need to remove the -M mkfs option in 
case of zoned devices as mixed profiles aren't supported there.
Anand Jain May 24, 2024, 3:51 a.m. UTC | #2
On 5/8/24 04:08, Josef Bacik wrote:
> I have a btrfs config where I specifically exclude raid56 testing, and
> this resulted in btrfs/011 failing with an inconsistent file system.
> This happens because the last test we run does a btrfs device replace of
> the $SCRATCH_DEV, leaving it with no valid file system.  We then skip
> the remaining profiles and exit, but then we go to check the device on
> $SCRATCH_DEV and it fails because there is no file system.
> 
> Fix this to re-make the scratch device if we skip any of the raid
> profiles.  This only happens in the case of some idiot user configuring
> their testing in a special way, in normal runs of this test we'll never
> re-make the fs.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Applied.

Thanks, Anand

> ---
>   tests/btrfs/011 | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/tests/btrfs/011 b/tests/btrfs/011
> index d8b5a978..b8c14f3b 100755
> --- a/tests/btrfs/011
> +++ b/tests/btrfs/011
> @@ -257,6 +257,12 @@ for t in "-m single -d single:1 no 64" \
>   	workout_option=${t#*:}
>   	if [[ "${_btrfs_profile_configs[@]}" =~ "${mkfs_option/ -M}"( |$) ]]; then
>   		workout "$mkfs_option" $workout_option
> +	else
> +		# If we have limited the profile configs we could leave
> +		# $SCRATCH_DEV in an inconsistent state (because it was
> +		# replaced), so mkfs the scratch device to make sure we don't
> +		# trip the fs check at the end.
> +		_scratch_mkfs > /dev/null 2>&1
>   	fi
>   done
>
diff mbox series

Patch

diff --git a/tests/btrfs/011 b/tests/btrfs/011
index d8b5a978..b8c14f3b 100755
--- a/tests/btrfs/011
+++ b/tests/btrfs/011
@@ -257,6 +257,12 @@  for t in "-m single -d single:1 no 64" \
 	workout_option=${t#*:}
 	if [[ "${_btrfs_profile_configs[@]}" =~ "${mkfs_option/ -M}"( |$) ]]; then
 		workout "$mkfs_option" $workout_option
+	else
+		# If we have limited the profile configs we could leave
+		# $SCRATCH_DEV in an inconsistent state (because it was
+		# replaced), so mkfs the scratch device to make sure we don't
+		# trip the fs check at the end.
+		_scratch_mkfs > /dev/null 2>&1
 	fi
 done