From 5b1a503aba5f4890c2aa20a3b77ceef87427430a Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Mon, 21 Jan 2019 11:33:10 -0500 Subject: [PATCH] btrfs/010: don't run without /sys/fs/btrfs Older kernels don't have /sys/fs/btrfs. btrfs/010 will happily run until it goes to check its work against sysfs and finds those files don't exist. This patch introduces a require check to ensure that the sysfs files are present before running. Signed-off-by: Jeff Mahoney Reviewed-by: Filipe Manana Signed-off-by: Eryu Guan --- common/btrfs | 8 ++++++++ tests/btrfs/010 | 1 + 2 files changed, 9 insertions(+) diff --git a/common/btrfs b/common/btrfs index 26dc0bb9..f6513c06 100644 --- a/common/btrfs +++ b/common/btrfs @@ -89,6 +89,14 @@ _require_btrfs_fs_feature() _notrun "Feature $feat not supported by the available btrfs version" } +_require_btrfs_fs_sysfs() +{ + modprobe btrfs > /dev/null 2>&1 + [ -e /sys/fs/btrfs/features ] || \ + _notrun "Sysfs not supported by the available btrfs version" + +} + _check_btrfs_filesystem() { device=$1 diff --git a/tests/btrfs/010 b/tests/btrfs/010 index 1a5f0146..72b2c727 100755 --- a/tests/btrfs/010 +++ b/tests/btrfs/010 @@ -33,6 +33,7 @@ rm -f $seqres.full _supported_fs btrfs _supported_os Linux _require_test +_require_btrfs_fs_sysfs # Create 32k extents. All of these extents will be accounted as outstanding and # reserved. -- 2.39.5