On Mon, Jan 21, 2019 at 4:33 PM <jeffm@xxxxxxxx> wrote: > > From: Jeff Mahoney <jeffm@xxxxxxxx> Reviewed-by: Filipe Manana <fdmanana@xxxxxxxx> Looks good. Since it's a btrfs specific change/fix, it would have been a good idea to cc linux-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 <jeffm@xxxxxxxx> > --- > 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.16.4 > -- Filipe David Manana, “Whether you think you can, or you think you can't — you're right.”