btrfs-progs: tests: use new sysfs interface to check prereq ACL

With the kernel commit 070bb0011ccf ("btrfs: sysfs: show if ACL
support has been compiled in") we can now check if ACL is compiled
without requiring a btrfs device. Retain older method for older
kernels.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Anand Jain 2023-11-08 16:51:20 +08:00 committed by David Sterba
parent d7c6baf82f
commit 6049b56971
1 changed files with 9 additions and 0 deletions

View File

@ -578,11 +578,20 @@ setup_root_helper()
# Check if btrfs is compiled with CONFIG_BTRFS_FS_POSIX_ACL, may need TEST_DEV.
check_kernel_support_acl()
{
if [ -f /sys/fs/btrfs/features/acl ]; then
if grep -q 0 /sys/fs/btrfs/features/acl; then
_not_run "ACL is not compiled in"
fi
return
fi
# It is an older kernel without acl sysfs interface.
if [ -f /proc/config.gz ] && \
! zgrep -q "^CONFIG_BTRFS_FS_POSIX_ACL=y" /proc/config.gz; then
_not_run "ACL is not compiled in"
fi
# If kernel is without the /proc/config.gz file.
run_check_mkfs_test_dev
run_check_mount_test_dev