File 0044-LU-15420-llite-add-rcu-argument-to-get_acl-callback.patch of Package lustre_2_12
From 085311dc739903f751d11dc4244aea6316ccb7bd Mon Sep 17 00:00:00 2001
From: Jian Yu <yujian@whamcloud.com>
Date: Mon, 24 Jan 2022 21:51:02 -0800
Subject: [PATCH] LU-15420 llite: add rcu argument to ->get_acl() callback
Kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
added a rcu argument to the ->get_acl() callback.
Test-Parameters: trivial
Change-Id: Icd711b38dda1a5a3c56bd631fa2edd94eab3572c
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46086
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
lustre/autoconf/lustre-core.m4 | 26 ++++++++++++++++++++++++++
lustre/llite/file.c | 11 ++++++++++-
lustre/llite/llite_internal.h | 6 +++++-
3 files changed, 41 insertions(+), 2 deletions(-)
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -2334,6 +2334,29 @@ user_namespace_argument, [
EXTRA_KCFLAGS="$tmp_flags"
]) # LC_HAVE_USER_NAMESPACE_ARG
+#
+# 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], [])
@@ -3533,6 +3556,9 @@ AC_DEFUN([LC_PROG_LINUX], [
# 5.10
LC_FORCE_UACCESS_BEGIN
+ # 5.15
+ LC_HAVE_GET_ACL_RCU_ARG
+
# kernel patch to extend integrity interface
LC_BIO_INTEGRITY_PREP_FN
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -4610,12 +4610,21 @@ out:
return rc;
}
-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
+
spin_lock(&lli->lli_lock);
/* VFS' acl_permission_check->check_acl will release the refcount */
acl = posix_acl_dup(lli->lli_posix_acl);
--- a/lustre/llite/llite_internal.h
+++ b/lustre/llite/llite_internal.h
@@ -883,7 +883,11 @@ int ll_getattr(struct user_namespace *mn
#else
int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
#endif /* HAVE_USER_NAMESPACE_ARG */
-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 */
+ );
#ifdef HAVE_IOP_SET_ACL
#ifdef CONFIG_FS_POSIX_ACL
int ll_set_acl(struct user_namespace *mnt_userns, struct inode *inode,