From 52e6b70d4681d73a62785587eceda78f475f60b0 Mon Sep 17 00:00:00 2001 From: Anand Jain Date: Fri, 13 Aug 2021 09:59:34 +0800 Subject: [PATCH] btrfs/220: nologreplay support older kernel mount option -o rescue=nologreplay isn't supported on the older kernel, make this test case older kernel compatible by checking if the mount option is supported. Signed-off-by: Anand Jain Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- tests/btrfs/220 | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/btrfs/220 b/tests/btrfs/220 index a01b28a6..9f2f07d7 100755 --- a/tests/btrfs/220 +++ b/tests/btrfs/220 @@ -209,22 +209,30 @@ test_non_revertible_options() { test_mount_opt "degraded" "degraded" - # nologreplay should be used only with + # nologreplay should be used only with readonly test_should_fail "nologreplay" - test_mount_opt "nologreplay,ro" "ro,rescue=nologreplay" - # norecovery should be used only with. This options is an alias to nologreplay + # norecovery should be used only with readonly. + # This options is an alias to nologreplay test_should_fail "norecovery" - test_mount_opt "norecovery,ro" "ro,rescue=nologreplay" + + if [ "$enable_rescue_nologreplay" = true ]; then + #rescue=nologreplay should be used only with readonly + test_should_fail "rescue=nologreplay" + + test_mount_opt "nologreplay,ro" "ro,rescue=nologreplay" + test_mount_opt "norecovery,ro" "ro,rescue=nologreplay" + test_mount_opt "rescue=nologreplay,ro" "ro,rescue=nologreplay" + else + test_mount_opt "nologreplay,ro" "ro,nologreplay" + test_mount_opt "norecovery,ro" "ro,nologreplay" + fi + test_mount_opt "rescan_uuid_tree" "rescan_uuid_tree" test_mount_opt "skip_balance" "skip_balance" test_mount_opt "user_subvol_rm_allowed" "user_subvol_rm_allowed" test_should_fail "rescue=invalid" - - # nologreplay requires readonly - test_should_fail "rescue=nologreplay" - test_mount_opt "rescue=nologreplay,ro" "ro,rescue=nologreplay" } test_one_shot_options() @@ -304,6 +312,10 @@ enable_discard_sync=false _try_scratch_mount "-o discard=sync" > /dev/null 2>&1 && \ { enable_discard_sync=true; _scratch_unmount; } +enable_rescue_nologreplay=false +_try_scratch_mount "-o ro,rescue=nologreplay" > /dev/null 2>&1 && \ + { enable_rescue_nologreplay=true; _scratch_unmount; } + # real QA test starts here _scratch_mkfs >/dev/null -- 2.39.5