From a42f8a6be29e0857ad3ba3a2b6952913f56db877 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Tue, 7 May 2024 16:08:53 -0400 Subject: [PATCH] fstests: mkfs the scratch device if we have missing profiles 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. Reviewed-by: Anand Jain Signed-off-by: Josef Bacik Reviewed-by: Johannes Thumshirn Signed-off-by: Anand Jain --- tests/btrfs/011 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/btrfs/011 b/tests/btrfs/011 index bf63a72b..40dfb157 100755 --- a/tests/btrfs/011 +++ b/tests/btrfs/011 @@ -255,6 +255,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 -- 2.39.5