[PATCH 3/4] btrfs/220: nologreplay support older kernel

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



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 <anand.jain@xxxxxxxxxx>
---
 tests/btrfs/220 | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tests/btrfs/220 b/tests/btrfs/220
index a01b28a6e42f..9f2f07d723c4 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.27.0




[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