aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/lustre/files/0004-LU-1337-vfs-provides-ll_get_acl-to-i_op-get_acl.patch')
-rw-r--r--sys-cluster/lustre/files/0004-LU-1337-vfs-provides-ll_get_acl-to-i_op-get_acl.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/sys-cluster/lustre/files/0004-LU-1337-vfs-provides-ll_get_acl-to-i_op-get_acl.patch b/sys-cluster/lustre/files/0004-LU-1337-vfs-provides-ll_get_acl-to-i_op-get_acl.patch
new file mode 100644
index 000000000..deaf4ad54
--- /dev/null
+++ b/sys-cluster/lustre/files/0004-LU-1337-vfs-provides-ll_get_acl-to-i_op-get_acl.patch
@@ -0,0 +1,150 @@
+From 734984d6c88784cde03d17e115dd6478a67daa58 Mon Sep 17 00:00:00 2001
+From: Liu Xuezhao <xuezhao.liu@emc.com>
+Date: Mon, 27 Aug 2012 17:19:22 +0800
+Subject: [PATCH 04/13] LU-1337 vfs: provides ll_get_acl to ->i_op->get_acl
+
+Since kernel 3.1 generic_permission() has lost the check_acl
+argument, ACL checking has been taken to VFS and filesystems
+need to provide a non-NULL ->i_op->get_acl to read an ACL
+from disk.
+
+This patch is a complementarity to http://review.whamcloud.com/3397
+(d018b087c962b8c66e8dc479fc66e964a2e5fd94), to fix failure of test_25
+of sanityn.sh.
+
+Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
+Change-Id: Ica96adac03c1792e2e8b668b959457a4ffec9a43
+---
+ lustre/autoconf/lustre-core.m4 | 3 +++
+ lustre/llite/file.c | 28 +++++++++++++++++++++-------
+ lustre/llite/llite_internal.h | 3 +++
+ lustre/llite/namei.c | 6 ++++++
+ 4 files changed, 33 insertions(+), 7 deletions(-)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index 0aef14f..a2d8efc 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -1783,6 +1783,9 @@ LB_LINUX_TRY_COMPILE([
+ #
+ # 3.1 generic_permission taken 2 parameters.
+ # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
++# When generic_permission taken 2 parameters, it also means
++# inode_operations has get_acl member function,
++# see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
+ #
+ AC_DEFUN([LC_GENERIC_PERMISSION],
+ [AC_MSG_CHECKING([if generic_permission take 2 or 4 arguments])
+diff --git a/lustre/llite/file.c b/lustre/llite/file.c
+index 1525b07..bf9ba2f 100644
+--- a/lustre/llite/file.c
++++ b/lustre/llite/file.c
+@@ -2536,16 +2536,29 @@ int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+ }
+ #endif
+
++struct posix_acl * ll_get_acl(struct inode *inode, int type)
++{
++ struct ll_inode_info *lli = ll_i2info(inode);
++ struct posix_acl *acl = NULL;
++ ENTRY;
++
++ cfs_spin_lock(&lli->lli_lock);
++ /* VFS' acl_permission_check->check_acl will release the refcount */
++ acl = posix_acl_dup(lli->lli_posix_acl);
++ cfs_spin_unlock(&lli->lli_lock);
++
++ RETURN(acl);
++}
++
+ #ifndef HAVE_GENERIC_PERMISSION_2ARGS
+ static int
+ # ifdef HAVE_GENERIC_PERMISSION_4ARGS
+-lustre_check_acl(struct inode *inode, int mask, unsigned int flags)
++ll_check_acl(struct inode *inode, int mask, unsigned int flags)
+ # else
+-lustre_check_acl(struct inode *inode, int mask)
++ll_check_acl(struct inode *inode, int mask)
+ # endif
+ {
+ # ifdef CONFIG_FS_POSIX_ACL
+- struct ll_inode_info *lli = ll_i2info(inode);
+ struct posix_acl *acl;
+ int rc;
+ ENTRY;
+@@ -2554,9 +2567,7 @@ lustre_check_acl(struct inode *inode, int mask)
+ if (flags & IPERM_FLAG_RCU)
+ return -ECHILD;
+ # endif
+- cfs_spin_lock(&lli->lli_lock);
+- acl = posix_acl_dup(lli->lli_posix_acl);
+- cfs_spin_unlock(&lli->lli_lock);
++ acl = ll_get_acl(inode, ACL_TYPE_ACCESS);
+
+ if (!acl)
+ RETURN(-EAGAIN);
+@@ -2608,7 +2619,7 @@ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
+ return lustre_check_remote_perm(inode, mask);
+
+ ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_INODE_PERM, 1);
+- rc = ll_generic_permission(inode, mask, flags, lustre_check_acl);
++ rc = ll_generic_permission(inode, mask, flags, ll_check_acl);
+
+ RETURN(rc);
+ }
+@@ -2703,6 +2714,9 @@ struct inode_operations ll_file_inode_operations = {
+ #ifdef HAVE_LINUX_FIEMAP_H
+ .fiemap = ll_fiemap,
+ #endif
++#ifdef HAVE_GENERIC_PERMISSION_2ARGS
++ .get_acl = ll_get_acl,
++#endif
+ };
+
+ /* dynamic ioctl number support routins */
+diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
+index 0c9f6d6..a1c02e5 100644
+--- a/lustre/llite/llite_internal.h
++++ b/lustre/llite/llite_internal.h
+@@ -748,6 +748,8 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
+ struct lookup_intent *it, struct kstat *stat);
+ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
+ struct ll_file_data *ll_file_data_get(void);
++struct posix_acl * ll_get_acl(struct inode *inode, int type);
++
+ #ifdef HAVE_GENERIC_PERMISSION_4ARGS
+ int ll_inode_permission(struct inode *inode, int mask, unsigned int flags);
+ #else
+@@ -757,6 +759,7 @@ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
+ int ll_inode_permission(struct inode *inode, int mask);
+ # endif
+ #endif
++
+ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
+ int flags, struct lov_user_md *lum,
+ int lum_size);
+diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
+index 4cb3bf4..036674f 100644
+--- a/lustre/llite/namei.c
++++ b/lustre/llite/namei.c
+@@ -1193,6 +1193,9 @@ struct inode_operations ll_dir_inode_operations = {
+ .getxattr = ll_getxattr,
+ .listxattr = ll_listxattr,
+ .removexattr = ll_removexattr,
++#ifdef HAVE_GENERIC_PERMISSION_2ARGS
++ .get_acl = ll_get_acl,
++#endif
+ };
+
+ struct inode_operations ll_special_inode_operations = {
+@@ -1203,4 +1206,7 @@ struct inode_operations ll_special_inode_operations = {
+ .getxattr = ll_getxattr,
+ .listxattr = ll_listxattr,
+ .removexattr = ll_removexattr,
++#ifdef HAVE_GENERIC_PERMISSION_2ARGS
++ .get_acl = ll_get_acl,
++#endif
+ };
+--
+1.7.12
+