On recent distributions like Ubuntu 24.04, the kernel offers the
.get_inode_acl op on struct inode_operations. This must be defined
and fetch ACLs, otherwise they can end up being incorrect on inodes.
Fixes:
aa636f8ae6 ("LU-18095 sec: fix ACL handling on recent kernels")
Test-Parameters: testlist=sanityn env=ONLY=25a,ONLY_REPEAT=10 mdscount=2 mdtcount=4 osscount=1 ostcount=8 clientcount=2
Test-Parameters: testlist=sanityn env=ONLY=25a,ONLY_REPEAT=10 mdscount=2 mdtcount=4 osscount=1 ostcount=8 clientcount=2 clientdistro=ubuntu2404 serverdistro=el8.8
Test-Parameters: testlist=sanity-sec env=ONLY=23b,ONLY_REPEAT=50 mdscount=2 mdtcount=4 osscount=1 ostcount=8 clientcount=2 clientdistro=ubuntu2404 serverdistro=el8.8
Test-Parameters: testlist=sanity env=ONLY=103a,ONLY_REPEAT=50 mdscount=2 mdtcount=4 osscount=1 ostcount=8 clientcount=2 clientdistro=ubuntu2404 serverdistro=el8.8
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Idcc642a11f6f6198217e5eadb2a2c32e8117b8b7
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56552
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
]) # LC_HAVE_ACL_WITH_DENTRY
#
+# LC_IOP_GET_INODE_ACL
+#
+# linux kernel v6.1-rc1-3-gcac2f8b8d8
+# fs: rename current get acl method
+#
+AC_DEFUN([LC_SRC_IOP_GET_INODE_ACL], [
+ LB2_LINUX_TEST_SRC([inode_ops_get_inode_acl], [
+ #include <linux/fs.h>
+ ],[
+ struct inode_operations iop;
+ iop.get_inode_acl = NULL;
+ ])
+])
+AC_DEFUN([LC_IOP_GET_INODE_ACL], [
+ LB2_MSG_LINUX_TEST_RESULT([if inode_operations has .get_inode_acl member function],
+ [inode_ops_get_inode_acl], [
+ AC_DEFINE(HAVE_IOP_GET_INODE_ACL, 1,
+ [inode_operations has .get_inode_acl member function])
+ ])
+]) # LC_IOP_GET_INODE_ACL
+
+#
# LC_HAVE_U64_CAPABILITY
#
# linux kernel v6.2-13111-gf122a08b197d
LC_SRC_HAVE_GET_RANDOM_U32_AND_U64
LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
+ LC_SRC_IOP_GET_INODE_ACL
# 6.2
LC_SRC_HAVE_GET_RANDOM_U32_BELOW
LC_HAVE_GET_RANDOM_U32_AND_U64
LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
+ LC_IOP_GET_INODE_ACL
# 6.2
LC_HAVE_GET_RANDOM_U32_BELOW
#include "llite_internal.h"
-struct posix_acl *ll_get_acl(
- #ifdef HAVE_ACL_WITH_DENTRY
- struct mnt_idmap *map, struct dentry *dentry, int type)
- #elif defined HAVE_GET_ACL_RCU_ARG
- struct inode *inode, int type, bool rcu)
- #else
- struct inode *inode, int type)
- #endif /* HAVE_GET_ACL_RCU_ARG */
+struct posix_acl *
+ll_get_inode_acl(struct inode *inode, int type, bool rcu)
{
-#ifdef HAVE_ACL_WITH_DENTRY
- struct inode *inode = dentry->d_inode;
-#endif
struct ll_inode_info *lli = ll_i2info(inode);
struct posix_acl *acl = NULL;
char *value = NULL;
char *xname;
ENTRY;
-#ifdef HAVE_GET_ACL_RCU_ARG
if (rcu)
return ERR_PTR(-ECHILD);
-#endif
if (type == ACL_TYPE_ACCESS && lli->lli_posix_acl)
goto lli_acl;
RETURN(acl);
}
+struct posix_acl *ll_get_acl(
+#ifdef HAVE_ACL_WITH_DENTRY
+ struct mnt_idmap *map, struct dentry *dentry, int type)
+#elif defined HAVE_GET_ACL_RCU_ARG
+ struct inode *inode, int type, bool rcu)
+#else
+ struct inode *inode, int type)
+#endif /* HAVE_GET_ACL_RCU_ARG */
+{
+#ifdef HAVE_ACL_WITH_DENTRY
+ struct inode *inode = dentry->d_inode;
+#endif
+#ifndef HAVE_GET_ACL_RCU_ARG
+ bool rcu = false;
+#endif
+
+ return ll_get_inode_acl(inode, type, rcu);
+}
+
#ifdef HAVE_IOP_SET_ACL
int ll_set_acl(struct mnt_idmap *map,
#ifdef HAVE_ACL_WITH_DENTRY
#endif
.listxattr = ll_listxattr,
.fiemap = ll_fiemap,
+#ifdef HAVE_IOP_GET_INODE_ACL
+ .get_inode_acl = ll_get_inode_acl,
+#endif
.get_acl = ll_get_acl,
#ifdef HAVE_IOP_SET_ACL
.set_acl = ll_set_acl,
struct inode *inode, int type);
#endif /* HAVE_GET_ACL_RCU_ARG */
+struct posix_acl *
+ll_get_inode_acl(struct inode *inode, int type, bool rcu);
+
int ll_set_acl(struct mnt_idmap *mnt_userns,
#ifdef HAVE_ACL_WITH_DENTRY
struct dentry *dentry,
.removexattr = ll_removexattr,
#endif
.listxattr = ll_listxattr,
+#ifdef HAVE_IOP_GET_INODE_ACL
+ .get_inode_acl = ll_get_inode_acl,
+#endif
.get_acl = ll_get_acl,
#ifdef HAVE_IOP_SET_ACL
.set_acl = ll_set_acl,
.removexattr = ll_removexattr,
#endif
.listxattr = ll_listxattr,
+#ifdef HAVE_IOP_GET_INODE_ACL
+ .get_inode_acl = ll_get_inode_acl,
+#endif
.get_acl = ll_get_acl,
#ifdef HAVE_IOP_SET_ACL
.set_acl = ll_set_acl,