* [PATCH 1/4] rc: debug add _scratch_mount_options to the _scratch_mount
2021-08-13 1:59 [PATCH 0/4] btrfs/220: make it compatible with older kernels Anand Jain
@ 2021-08-13 1:59 ` Anand Jain
2021-08-13 1:59 ` [PATCH 2/4] btrfs/220: discard=sync support older kernel Anand Jain
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2021-08-13 1:59 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs
When the _scratch_mount fails, there isn't any clue on why it failed as
of now, change this and add the $(_scratch_mount_options $*) to the
_fail.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
common/rc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/rc b/common/rc
index e04d9365d902..4e939da37010 100644
--- a/common/rc
+++ b/common/rc
@@ -339,7 +339,7 @@ _try_scratch_mount()
# mount scratch device with given options and _fail if mount fails
_scratch_mount()
{
- _try_scratch_mount $* || _fail "mount failed"
+ _try_scratch_mount $* || _fail "mount $(_scratch_mount_options $*) failed"
}
_scratch_mount_idmapped()
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] btrfs/220: discard=sync support older kernel
2021-08-13 1:59 [PATCH 0/4] btrfs/220: make it compatible with older kernels Anand Jain
2021-08-13 1:59 ` [PATCH 1/4] rc: debug add _scratch_mount_options to the _scratch_mount Anand Jain
@ 2021-08-13 1:59 ` Anand Jain
2021-08-13 1:59 ` [PATCH 3/4] btrfs/220: nologreplay " Anand Jain
2021-08-13 1:59 ` [PATCH 4/4] btrfs/220: clear_cache fix for " Anand Jain
3 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2021-08-13 1:59 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs
mount option -o discard=sync 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@oracle.com>
---
tests/btrfs/220 | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tests/btrfs/220 b/tests/btrfs/220
index 7207c6967793..a01b28a6e42f 100755
--- a/tests/btrfs/220
+++ b/tests/btrfs/220
@@ -263,9 +263,14 @@ test_revertible_options()
test_roundtrip_mount "nodatasum" "nodatasum" "datasum" "$DEFAULT_OPTS"
test_should_fail "discard=invalid"
- test_roundtrip_mount "discard" "discard" "discard=sync" "discard"
- test_roundtrip_mount "discard=async" "discard=async" "discard=sync" "discard"
- test_roundtrip_mount "discard=sync" "discard" "nodiscard" "$DEFAULT_OPTS"
+ if [ "$enable_discard_sync" = true ]; then
+ test_roundtrip_mount "discard" "discard" "discard=sync" "discard"
+ test_roundtrip_mount "discard=async" "discard=async" "discard=sync" "discard"
+ test_roundtrip_mount "discard=sync" "discard" "nodiscard" "$DEFAULT_OPTS"
+ else
+ test_roundtrip_mount "discard" "discard" "discard" "discard"
+ test_roundtrip_mount "discard" "discard" "nodiscard" "$DEFAULT_OPTS"
+ fi
test_roundtrip_mount "enospc_debug" "enospc_debug" "noenospc_debug" "$DEFAULT_OPTS"
@@ -292,6 +297,13 @@ test_revertible_options()
test_roundtrip_mount "notreelog" "notreelog" "treelog" "$DEFAULT_OPTS"
}
+# Find out if the running kernel supports the -o discard=sync option.
+_scratch_mkfs >/dev/null
+MOUNT_OPTIONS=
+enable_discard_sync=false
+_try_scratch_mount "-o discard=sync" > /dev/null 2>&1 && \
+ { enable_discard_sync=true; _scratch_unmount; }
+
# real QA test starts here
_scratch_mkfs >/dev/null
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] btrfs/220: nologreplay support older kernel
2021-08-13 1:59 [PATCH 0/4] btrfs/220: make it compatible with older kernels Anand Jain
2021-08-13 1:59 ` [PATCH 1/4] rc: debug add _scratch_mount_options to the _scratch_mount Anand Jain
2021-08-13 1:59 ` [PATCH 2/4] btrfs/220: discard=sync support older kernel Anand Jain
@ 2021-08-13 1:59 ` Anand Jain
2021-08-13 1:59 ` [PATCH 4/4] btrfs/220: clear_cache fix for " Anand Jain
3 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2021-08-13 1:59 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs
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@oracle.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] btrfs/220: clear_cache fix for older kernel
2021-08-13 1:59 [PATCH 0/4] btrfs/220: make it compatible with older kernels Anand Jain
` (2 preceding siblings ...)
2021-08-13 1:59 ` [PATCH 3/4] btrfs/220: nologreplay " Anand Jain
@ 2021-08-13 1:59 ` Anand Jain
3 siblings, 0 replies; 5+ messages in thread
From: Anand Jain @ 2021-08-13 1:59 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs
mount option -o clear_cache shown in /proc/self/mounts isn't supported
in the newer kernel, make this test case older kernel compatible by
checking if clear_cache is shown in the /proc/self/mounts.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
tests/btrfs/220 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/220 b/tests/btrfs/220
index 9f2f07d723c4..fa91a38493af 100755
--- a/tests/btrfs/220
+++ b/tests/btrfs/220
@@ -237,7 +237,11 @@ test_non_revertible_options()
test_one_shot_options()
{
- test_mount_opt "clear_cache" ""
+ if [ "$enable_clear_cache_shown" = true ]; then
+ test_mount_opt "clear_cache" "clear_cache"
+ else
+ test_mount_opt "clear_cache" ""
+ fi
}
# All these options can be reverted (with their "no" counterpart), or can have
@@ -316,6 +320,13 @@ enable_rescue_nologreplay=false
_try_scratch_mount "-o ro,rescue=nologreplay" > /dev/null 2>&1 && \
{ enable_rescue_nologreplay=true; _scratch_unmount; }
+enable_clear_cache_shown=false
+_try_scratch_mount "-o clear_cache" > /dev/null 2>&1 && \
+ { shown_opts=$(cat /proc/self/mounts | grep $SCRATCH_MNT | \
+ $AWK_PROG '{ print $4 }')
+ echo $shown_opts | grep -q clear_cache && enable_clear_cache_shown=true
+ _scratch_unmount; }
+
# real QA test starts here
_scratch_mkfs >/dev/null
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread