From fa560016d4afb7bddbd842bffd7e81254432f524 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 27 May 2026 14:24:51 -0700 Subject: [PATCH] Register .set_acl unconditionally to fix POSIX ACL writes over NFS Scoutfs has supported posix ACLs through the xattr handler table, which allowed NFS to fetch them through this sideband, which worked for older kernels. With recent changes we've pulled in .get_acl because the mainline kernel is changing how ACL ops are called. But we still left .set_acl unreachable. This meant that on el9.7 nfs clients could now reach .get_acl, but still not set them. With this change, we're finally exposing .set_acl consistently across all el releases and allowing nfs clients to both get and set posix ACLs. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 10 ++++++++++ kmod/src/acl.c | 5 +++-- kmod/src/acl.h | 3 ++- kmod/src/dir.c | 2 +- kmod/src/inode.c | 4 ++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 81dc8a58..46825b3e 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -479,6 +479,16 @@ ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h ccflags-y += -DKC_STACK_TRACE_SAVE endif +# +# v3.14-rc1-7-g4e34e719e457 +# +# .set_acl callback added to struct inode_operations. Most kernels +# we target have it, but el7 (3.10 base) does not, so detect. +# +ifneq (,$(shell grep 'int ..set_acl..struct' include/linux/fs.h)) +ccflags-y += -DKC_HAS_SET_ACL +endif + # # v6.1-rc1-2-g138060ba92b3 # diff --git a/kmod/src/acl.c b/kmod/src/acl.c index 356e3107..c836df19 100644 --- a/kmod/src/acl.c +++ b/kmod/src/acl.c @@ -216,7 +216,8 @@ int scoutfs_set_acl(KC_VFS_NS_DEF { struct inode *inode = dentry->d_inode; #else -int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) +int scoutfs_set_acl(KC_VFS_NS_DEF + struct inode *inode, struct posix_acl *acl, int type) { #endif struct super_block *sb = inode->i_sb; @@ -309,7 +310,7 @@ int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *v #ifdef KC_SET_ACL_DENTRY ret = scoutfs_set_acl(KC_VFS_INIT_NS dentry, acl, type); #else - ret = scoutfs_set_acl(dentry->d_inode, acl, type); + ret = scoutfs_set_acl(KC_VFS_INIT_NS dentry->d_inode, acl, type); #endif out: posix_acl_release(acl); diff --git a/kmod/src/acl.h b/kmod/src/acl.h index a5bf21d6..2b64fafa 100644 --- a/kmod/src/acl.h +++ b/kmod/src/acl.h @@ -5,7 +5,8 @@ int scoutfs_set_acl(KC_VFS_NS_DEF struct dentry *dentry, struct posix_acl *acl, int type); #else -int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type); +int scoutfs_set_acl(KC_VFS_NS_DEF + struct inode *inode, struct posix_acl *acl, int type); #endif #ifdef KC_GET_INODE_ACL struct posix_acl *scoutfs_get_acl(struct inode *inode, int type, bool rcu); diff --git a/kmod/src/dir.c b/kmod/src/dir.c index efcdef24..f9729d7d 100644 --- a/kmod/src/dir.c +++ b/kmod/src/dir.c @@ -2063,7 +2063,7 @@ const struct inode_operations scoutfs_dir_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_SET_ACL_DENTRY +#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, #endif .symlink = scoutfs_symlink, diff --git a/kmod/src/inode.c b/kmod/src/inode.c index 96376dc0..621833d2 100644 --- a/kmod/src/inode.c +++ b/kmod/src/inode.c @@ -154,7 +154,7 @@ static const struct inode_operations scoutfs_file_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_SET_ACL_DENTRY +#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, #endif .fiemap = scoutfs_data_fiemap, @@ -174,7 +174,7 @@ static const struct inode_operations scoutfs_special_iops = { #else .get_acl = scoutfs_get_acl, #endif -#ifdef KC_SET_ACL_DENTRY +#ifdef KC_HAS_SET_ACL .set_acl = scoutfs_set_acl, #endif };