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@xxxxxxxxxx> --- 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