Whamcloud - gitweb
LU-15420 llite: add rcu argument to ->get_acl() callback 06/47706/2
authorJian Yu <yujian@whamcloud.com>
Thu, 23 Jun 2022 06:34:24 +0000 (23:34 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 5 Jul 2022 22:13:39 +0000 (22:13 +0000)
Kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
added a rcu argument to the ->get_acl() callback.

Lustre-change: https://review.whamcloud.com/46086
Lustre-commit: 085311dc739903f751d11dc4244aea6316ccb7bd

Test-Parameters: trivial
Change-Id: Icd711b38dda1a5a3c56bd631fa2edd94eab3572c
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/47706
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/llite/acl.c
lustre/llite/llite_internal.h

index aa0aa17..c200045 100644 (file)
@@ -2593,6 +2593,29 @@ task_struct_state, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_TASK_STRUCT_HAS_NEW_STATE
 
+#
+# LC_HAVE_GET_ACL_RCU_ARG
+#
+# kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
+# vfs: add rcu argument to ->get_acl() callback
+# Add a rcu argument to the ->get_acl() callback to allow
+# get_cached_acl_rcu() to call the ->get_acl() method.
+#
+AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'get_acl' has a rcu argument],
+get_acl_rcu_argument, [
+       #include <linux/fs.h>
+],[
+       ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
+],[
+       AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
+               ['get_acl' has a rcu argument])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_HAVE_GET_ACL_RCU_ARG
+
 AC_DEFUN([LC_PROG_LINUX_SRC], [])
 AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
 
@@ -2793,6 +2816,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 5.13
        LC_TASK_STRUCT_HAS_NEW_STATE
 
+       # 5.15
+       LC_HAVE_GET_ACL_RCU_ARG
+
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
 
index fb12ce2..5ae1aab 100644 (file)
 
 #include "llite_internal.h"
 
-struct posix_acl *ll_get_acl(struct inode *inode, int type)
+struct posix_acl *ll_get_acl(struct inode *inode, int type
+#ifdef HAVE_GET_ACL_RCU_ARG
+                            , bool rcu
+#endif /* HAVE_GET_ACL_RCU_ARG */
+                           )
 {
        struct ll_inode_info *lli = ll_i2info(inode);
        struct posix_acl *acl = NULL;
        ENTRY;
 
+#ifdef HAVE_GET_ACL_RCU_ARG
+       if (rcu)
+               return ERR_PTR(-ECHILD);
+#endif
+
        read_lock(&lli->lli_lock);
        /* VFS' acl_permission_check->check_acl will release the refcount */
        acl = posix_acl_dup(lli->lli_posix_acl);
index c813d77..3741380 100644 (file)
@@ -1116,7 +1116,11 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
 int ll_getattr_dentry(struct dentry *de, struct kstat *stat, u32 request_mask,
                      unsigned int flags, bool foreign);
 #ifdef CONFIG_LUSTRE_FS_POSIX_ACL
-struct posix_acl *ll_get_acl(struct inode *inode, int type);
+struct posix_acl *ll_get_acl(struct inode *inode, int type
+#ifdef HAVE_GET_ACL_RCU_ARG
+                            , bool rcu
+#endif /* HAVE_GET_ACL_RCU_ARG */
+                            );
 int ll_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
               struct posix_acl *acl, int type);
 #else  /* !CONFIG_LUSTRE_FS_POSIX_ACL */