]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
fs: take the ACL checks to common code
authorChristoph Hellwig <hch@lst.de>
Sat, 23 Jul 2011 15:37:31 +0000 (17:37 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 25 Jul 2011 18:30:23 +0000 (14:30 -0400)
Replace the ->check_acl method with a ->get_acl method that simply reads an
ACL from disk after having a cache miss.  This means we can replace the ACL
checking boilerplate code with a single implementation in namei.c.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
52 files changed:
Documentation/filesystems/Locking
Documentation/filesystems/porting
Documentation/filesystems/vfs.txt
fs/9p/acl.c
fs/9p/acl.h
fs/9p/vfs_inode_dotl.c
fs/btrfs/acl.c
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/ext2/acl.c
fs/ext2/acl.h
fs/ext2/file.c
fs/ext2/namei.c
fs/ext3/acl.c
fs/ext3/acl.h
fs/ext3/file.c
fs/ext3/namei.c
fs/ext4/acl.c
fs/ext4/acl.h
fs/ext4/file.c
fs/ext4/namei.c
fs/generic_acl.c
fs/gfs2/acl.c
fs/gfs2/acl.h
fs/gfs2/inode.c
fs/jffs2/acl.c
fs/jffs2/acl.h
fs/jffs2/dir.c
fs/jffs2/file.c
fs/jffs2/symlink.c
fs/jfs/acl.c
fs/jfs/file.c
fs/jfs/jfs_acl.h
fs/jfs/namei.c
fs/namei.c
fs/ocfs2/acl.c
fs/ocfs2/acl.h
fs/ocfs2/file.c
fs/ocfs2/namei.c
fs/posix_acl.c
fs/reiserfs/file.c
fs/reiserfs/namei.c
fs/reiserfs/xattr.c
fs/xfs/linux-2.6/xfs_acl.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/linux-2.6/xfs_trace.h
fs/xfs/xfs_acl.h
include/linux/fs.h
include/linux/generic_acl.h
include/linux/reiserfs_acl.h
include/linux/reiserfs_xattr.h
mm/shmem.c

index ca7e25292542a6934f4d3210846167e4343228c4..7e4699146fe172d15fed459d8e702cc38035b59b 100644 (file)
@@ -52,7 +52,7 @@ ata *);
        void (*put_link) (struct dentry *, struct nameidata *, void *);
        void (*truncate) (struct inode *);
        int (*permission) (struct inode *, int, unsigned int);
-       int (*check_acl)(struct inode *, int);
+       int (*get_acl)(struct inode *, int);
        int (*setattr) (struct dentry *, struct iattr *);
        int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
        int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -80,7 +80,7 @@ put_link:     no
 truncate:      yes             (see below)
 setattr:       yes
 permission:    no (may not block if called in rcu-walk mode)
-check_acl:     no
+get_acl:       no
 getattr:       no
 setxattr:      yes
 getxattr:      no
index 7f8861d341ea83321092db0b94e79953c795b5e1..b4a3d765ff9ac07aa41e8d12ddbd4e97be5b9bc6 100644 (file)
@@ -407,10 +407,11 @@ to some pointer to returning that pointer.  On errors return ERR_PTR(...).
 
 --
 [mandatory]
-       ->permission(), generic_permission() and ->check_acl() have lost flags
+       ->permission() and generic_permission()have lost flags
 argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
-       generic_permission() has also lost the check_acl argument; if you want
-non-NULL to be used for that inode, put it into ->i_op->check_acl.
+       generic_permission() has also 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.
 
 --
 [mandatory]
index eff6617c9a0f6fe7c3824926c8a79b26ccd5b290..52d8fb81cffffdffe3cb8f4ddb1cd65d586855fb 100644 (file)
@@ -356,7 +356,7 @@ struct inode_operations {
         void (*put_link) (struct dentry *, struct nameidata *, void *);
        void (*truncate) (struct inode *);
        int (*permission) (struct inode *, int);
-       int (*check_acl)(struct inode *, int);
+       int (*get_acl)(struct inode *, int);
        int (*setattr) (struct dentry *, struct iattr *);
        int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
        int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
index 075bc909da179c5b99d98e2bac93ba41da6c17ba..814be079c185277e5fde8f186cd1d2611e32e73d 100644 (file)
@@ -96,7 +96,7 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
        return acl;
 }
 
-int v9fs_check_acl(struct inode *inode, int mask)
+struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        struct v9fs_session_info *v9ses;
@@ -108,18 +108,10 @@ int v9fs_check_acl(struct inode *inode, int mask)
                 * On access = client  and acl = on mode get the acl
                 * values from the server
                 */
-               return -EAGAIN;
+               return NULL;
        }
-       acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
+       return v9fs_get_cached_acl(inode, type);
 
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-       return -EAGAIN;
 }
 
 static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
index 3eba10f3af1e6b27f0c5e7aa56eca9d9ed739233..ddb7ae19d9718933398fad6d18ac11bcc15c116c 100644 (file)
 
 #ifdef CONFIG_9P_FS_POSIX_ACL
 extern int v9fs_get_acl(struct inode *, struct p9_fid *);
-extern int v9fs_check_acl(struct inode *inode, int mask);
+extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
 extern int v9fs_acl_chmod(struct dentry *);
 extern int v9fs_set_create_acl(struct dentry *,
                               struct posix_acl **, struct posix_acl **);
 extern int v9fs_acl_mode(struct inode *dir, mode_t *modep,
                         struct posix_acl **dpacl, struct posix_acl **pacl);
 #else
-#define v9fs_check_acl NULL
+#define v9fs_iop_get_acl NULL
 static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
 {
        return 0;
index 803f59ff2faa556e40ccde956eea57e7b86e4977..9d808d0e0cd9ccf896c0ab20b571cfebc7188a79 100644 (file)
@@ -872,7 +872,7 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = {
        .getxattr = generic_getxattr,
        .removexattr = generic_removexattr,
        .listxattr = v9fs_listxattr,
-       .check_acl = v9fs_check_acl,
+       .get_acl = v9fs_iop_get_acl,
 };
 
 const struct inode_operations v9fs_file_inode_operations_dotl = {
@@ -882,7 +882,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
        .getxattr = generic_getxattr,
        .removexattr = generic_removexattr,
        .listxattr = v9fs_listxattr,
-       .check_acl = v9fs_check_acl,
+       .get_acl = v9fs_iop_get_acl,
 };
 
 const struct inode_operations v9fs_symlink_inode_operations_dotl = {
index 9508ad14c924aff585f0bc656e648d14ee08bfa3..65a735d8f6e44443c6044d6b71a59e5acf91f546 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
 
-static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
+struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 {
        int size;
        const char *name;
@@ -195,22 +195,6 @@ out:
        return ret;
 }
 
-int btrfs_check_acl(struct inode *inode, int mask)
-{
-       int error = -EAGAIN;
-       struct posix_acl *acl;
-
-       acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-       }
-
-       return error;
-}
-
 /*
  * btrfs_init_acl is already generally called under fs_mutex, so the locking
  * stuff has been fixed to work with that.  If the locking stuff changes, we
index 82be74efbb26dd833a8a0b32bbf108ecfc63baca..fe9287b064969d503e0e2c44f8c7446a8767ce9b 100644 (file)
@@ -2645,9 +2645,9 @@ do {                                                              \
 
 /* acl.c */
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
-int btrfs_check_acl(struct inode *inode, int mask);
+struct posix_acl *btrfs_get_acl(struct inode *inode, int type);
 #else
-#define btrfs_check_acl NULL
+#define btrfs_get_acl NULL
 #endif
 int btrfs_init_acl(struct btrfs_trans_handle *trans,
                   struct inode *inode, struct inode *dir);
index 2548a04a0230c0f515bb45f71f1e3357727a7616..e91b097e7252a911dcaa61eed0188bfeae500d2a 100644 (file)
@@ -7351,12 +7351,12 @@ static const struct inode_operations btrfs_dir_inode_operations = {
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_dir_ro_inode_operations = {
        .lookup         = btrfs_lookup,
        .permission     = btrfs_permission,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 
 static const struct file_operations btrfs_dir_file_operations = {
@@ -7425,7 +7425,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
        .fiemap         = btrfs_fiemap,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_special_inode_operations = {
        .getattr        = btrfs_getattr,
@@ -7435,7 +7435,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
        .getxattr       = btrfs_getxattr,
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 static const struct inode_operations btrfs_symlink_inode_operations = {
        .readlink       = generic_readlink,
@@ -7447,7 +7447,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
        .getxattr       = btrfs_getxattr,
        .listxattr      = btrfs_listxattr,
        .removexattr    = btrfs_removexattr,
-       .check_acl      = btrfs_check_acl,
+       .get_acl        = btrfs_get_acl,
 };
 
 const struct dentry_operations btrfs_dentry_operations = {
index ba99fa4b2f35af628ecf89357122adafbc93a144..52c053763942eb0db19f72b7fb4618bbeeffd012 100644 (file)
@@ -128,7 +128,7 @@ fail:
 /*
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext2_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -231,23 +231,6 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return error;
 }
 
-int
-ext2_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext2_new_inode.
  *
index 3ff6cbb9ac4486e2c6bc4e7b0ca83485ab01fd1f..5c0a6a4fb052c78a3d14df3b25bfc47a26b5fe9b 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size)
 #ifdef CONFIG_EXT2_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext2_check_acl (struct inode *, int);
+extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
 extern int ext2_acl_chmod (struct inode *);
 extern int ext2_init_acl (struct inode *, struct inode *);
 
 #else
 #include <linux/sched.h>
-#define ext2_check_acl NULL
+#define ext2_get_acl   NULL
 #define ext2_get_acl   NULL
 #define ext2_set_acl   NULL
 
index 82e06321de359176c20c9603ba1a9dee2b15b638..a5b3a5db31206f8f3c84781362f7c45e919ddf0e 100644 (file)
@@ -102,6 +102,6 @@ const struct inode_operations ext2_file_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
        .fiemap         = ext2_fiemap,
 };
index d60b7099e2db3c649be7707924575891bd3d77d1..761fde807fc910f7961d494db363c341fa5f2baf 100644 (file)
@@ -408,7 +408,7 @@ const struct inode_operations ext2_dir_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
 };
 
 const struct inode_operations ext2_special_inode_operations = {
@@ -419,5 +419,5 @@ const struct inode_operations ext2_special_inode_operations = {
        .removexattr    = generic_removexattr,
 #endif
        .setattr        = ext2_setattr,
-       .check_acl      = ext2_check_acl,
+       .get_acl        = ext2_get_acl,
 };
index a9fdd77d4b583ea539dfe890ac8f95090c29ac34..6c29bf0df04a0d0ed619a3b886e2d24847ab7a45 100644 (file)
@@ -131,7 +131,7 @@ fail:
  *
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext3_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -239,23 +239,6 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
        return error;
 }
 
-int
-ext3_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext3_new_inode.
  *
index 597334626de93aee68631305d98a823e815058c4..dbc921e458c5599177fb86fc6e3fc95481cf06ab 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size)
 #ifdef CONFIG_EXT3_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext3_check_acl (struct inode *, int);
+extern struct posix_acl *ext3_get_acl(struct inode *inode, int type);
 extern int ext3_acl_chmod (struct inode *);
 extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
 
 #else  /* CONFIG_EXT3_FS_POSIX_ACL */
 #include <linux/sched.h>
-#define ext3_check_acl NULL
+#define ext3_get_acl NULL
 
 static inline int
 ext3_acl_chmod(struct inode *inode)
index f55df0e61cbded50f25db7dc094c0ffc5a8dc7a3..2be5b99097f13ad44f2db41ca680bfc82a3fa741 100644 (file)
@@ -79,7 +79,7 @@ const struct inode_operations ext3_file_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
        .fiemap         = ext3_fiemap,
 };
 
index c095cf5640c79c4462ed0a60cd7aed5fd8c5472f..3b57230a17bbf9adad3748d790cc3376e7b3f9c2 100644 (file)
@@ -2529,7 +2529,7 @@ const struct inode_operations ext3_dir_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
 };
 
 const struct inode_operations ext3_special_inode_operations = {
@@ -2540,5 +2540,5 @@ const struct inode_operations ext3_special_inode_operations = {
        .listxattr      = ext3_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext3_check_acl,
+       .get_acl        = ext3_get_acl,
 };
index 7b094d1a8d3e7ee839d77f0a457cf077f37b0623..dca2d1ded931eafbad76cda7cd9b0f07bf7fa6f8 100644 (file)
@@ -131,7 +131,7 @@ fail:
  *
  * inode->i_mutex: don't care
  */
-static struct posix_acl *
+struct posix_acl *
 ext4_get_acl(struct inode *inode, int type)
 {
        int name_index;
@@ -237,23 +237,6 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
        return error;
 }
 
-int
-ext4_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 /*
  * Initialize the ACLs of a new inode. Called from ext4_new_inode.
  *
index 9d843d5deac402593b8b557e27c6ed25aafe401d..18cb39ed7c7bbb88dfb72f67150b40cf859e2a58 100644 (file)
@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size)
 #ifdef CONFIG_EXT4_FS_POSIX_ACL
 
 /* acl.c */
-extern int ext4_check_acl(struct inode *, int);
+struct posix_acl *ext4_get_acl(struct inode *inode, int type);
 extern int ext4_acl_chmod(struct inode *);
 extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
 
 #else  /* CONFIG_EXT4_FS_POSIX_ACL */
 #include <linux/sched.h>
-#define ext4_check_acl NULL
+#define ext4_get_acl NULL
 
 static inline int
 ext4_acl_chmod(struct inode *inode)
index ce766f974b1d49509941552983936e5e9ea62141..e4095e988ebacb379a7784f72f52f78f51176ac4 100644 (file)
@@ -301,7 +301,7 @@ const struct inode_operations ext4_file_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
        .fiemap         = ext4_fiemap,
 };
 
index 707d605bf76985dfe0b873b8fccda9c6459682b1..8c9babac43dc941fa62ece2773f234044b8a5b7b 100644 (file)
@@ -2590,7 +2590,7 @@ const struct inode_operations ext4_dir_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
        .fiemap         = ext4_fiemap,
 };
 
@@ -2602,5 +2602,5 @@ const struct inode_operations ext4_special_inode_operations = {
        .listxattr      = ext4_listxattr,
        .removexattr    = generic_removexattr,
 #endif
-       .check_acl      = ext4_check_acl,
+       .get_acl        = ext4_get_acl,
 };
index ea19ca47d452a7a20a5cbbcf49841156fd445b48..d5e33a077a67e7bb7cce426b5a4c5616e201c686 100644 (file)
@@ -172,20 +172,6 @@ generic_acl_chmod(struct inode *inode)
        return error;
 }
 
-int
-generic_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-       return -EAGAIN;
-}
-
 const struct xattr_handler generic_acl_access_handler = {
        .prefix = POSIX_ACL_XATTR_ACCESS,
        .flags  = ACL_TYPE_ACCESS,
index a2dd63c0c11a8465e517295161fdbbc3d8abcfcf..884c9af0542fac0658cf5108d7869e5a08668e5a 100644 (file)
@@ -67,30 +67,9 @@ static struct posix_acl *gfs2_acl_get(struct gfs2_inode *ip, int type)
        return acl;
 }
 
-/**
- * gfs2_check_acl - Check an ACL to see if we're allowed to do something
- * @inode: the file we want to do something to
- * @mask: what we want to do
- *
- * Returns: errno
- */
-
-int gfs2_check_acl(struct inode *inode, int mask)
+struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
 {
-       struct posix_acl *acl;
-       int error;
-
-       acl = gfs2_acl_get(GFS2_I(inode), ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-
-       if (acl) {
-               error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
+       return gfs2_acl_get(GFS2_I(inode), type);
 }
 
 static int gfs2_set_mode(struct inode *inode, mode_t mode)
index b522b0cb39eaa12798649c2a8bd2b1e952a746f9..0da38dc7efec24959a1ad656ff2cda8b561db1e0 100644 (file)
@@ -16,7 +16,7 @@
 #define GFS2_POSIX_ACL_DEFAULT         "posix_acl_default"
 #define GFS2_ACL_MAX_ENTRIES           25
 
-extern int gfs2_check_acl(struct inode *inode, int mask);
+extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type);
 extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode);
 extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr);
 extern const struct xattr_handler gfs2_xattr_system_handler;
index 0fb51a96eff0a8bb743fc83b2961a16465d8fa0c..900cf986aadcc155d26028971f71bc6fa9a972ec 100644 (file)
@@ -1846,7 +1846,7 @@ const struct inode_operations gfs2_file_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
 const struct inode_operations gfs2_dir_iops = {
@@ -1867,7 +1867,7 @@ const struct inode_operations gfs2_dir_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
 const struct inode_operations gfs2_symlink_iops = {
@@ -1882,6 +1882,6 @@ const struct inode_operations gfs2_symlink_iops = {
        .listxattr = gfs2_listxattr,
        .removexattr = gfs2_removexattr,
        .fiemap = gfs2_fiemap,
-       .check_acl = gfs2_check_acl,
+       .get_acl = gfs2_get_acl,
 };
 
index 5783ed81171b80153ae15af3e8811afc92d02144..27c511a1cf053f3dbbae46e76588af66f2bff7aa 100644 (file)
@@ -156,7 +156,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
        return ERR_PTR(-EINVAL);
 }
 
-static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
+struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        char *value = NULL;
@@ -259,22 +259,6 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return rc;
 }
 
-int jffs2_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-       int rc;
-
-       acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               rc = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return rc;
-       }
-       return -EAGAIN;
-}
-
 int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode)
 {
        struct posix_acl *acl;
index 9973073b9c4772bee9d3c3e36174c40fe2b8fba5..b3421c78d9f85482be72d045fdde7194e2bb63d8 100644 (file)
@@ -26,7 +26,7 @@ struct jffs2_acl_header {
 
 #ifdef CONFIG_JFFS2_FS_POSIX_ACL
 
-extern int jffs2_check_acl(struct inode *, int);
+struct posix_acl *jffs2_get_acl(struct inode *inode, int type);
 extern int jffs2_acl_chmod(struct inode *);
 extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *);
 extern int jffs2_init_acl_post(struct inode *);
@@ -36,7 +36,7 @@ extern const struct xattr_handler jffs2_acl_default_xattr_handler;
 
 #else
 
-#define jffs2_check_acl                                (NULL)
+#define jffs2_get_acl                          (NULL)
 #define jffs2_acl_chmod(inode)                 (0)
 #define jffs2_init_acl_pre(dir_i,inode,mode)   (0)
 #define jffs2_init_acl_post(inode)             (0)
index 5f243cd63afc330e817f1dbfa1a52cb5eb83b33c..9659b7c00468064cdc9e51be4d68d06229fc85eb 100644 (file)
@@ -56,7 +56,7 @@ const struct inode_operations jffs2_dir_inode_operations =
        .rmdir =        jffs2_rmdir,
        .mknod =        jffs2_mknod,
        .rename =       jffs2_rename,
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index 3989f7e09f7f649c96ad9e5737de886697c018b4..61e6723535b9d56f6cf727328ca7ae8d2a94090a 100644 (file)
@@ -63,7 +63,7 @@ const struct file_operations jffs2_file_operations =
 
 const struct inode_operations jffs2_file_inode_operations =
 {
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index b955626071c28acb8be9728b88399f8c9cdd7ab4..e3035afb18145e60add43a86640b1464fdac5aa4 100644 (file)
@@ -20,7 +20,7 @@ const struct inode_operations jffs2_symlink_inode_operations =
 {
        .readlink =     generic_readlink,
        .follow_link =  jffs2_follow_link,
-       .check_acl =    jffs2_check_acl,
+       .get_acl =      jffs2_get_acl,
        .setattr =      jffs2_setattr,
        .setxattr =     jffs2_setxattr,
        .getxattr =     jffs2_getxattr,
index 687a1ae42e3fc7dba2c8c61b110d80666c4d0ce2..b3a32caf2b4596d8ce0fa8a53c5084787088c4cc 100644 (file)
@@ -27,7 +27,7 @@
 #include "jfs_xattr.h"
 #include "jfs_acl.h"
 
-static struct posix_acl *jfs_get_acl(struct inode *inode, int type)
+struct posix_acl *jfs_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        char *ea_name;
@@ -114,22 +114,6 @@ out:
        return rc;
 }
 
-int jfs_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-
-       acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               int error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return error;
-       }
-
-       return -EAGAIN;
-}
-
 int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
 {
        struct posix_acl *acl = NULL;
index 7527855b5cc6fc71ec5b613fbf022bd725843f20..844f9460cb11344dc65253c79ef5ec0baf6fe576 100644 (file)
@@ -140,7 +140,7 @@ const struct inode_operations jfs_file_inode_operations = {
        .removexattr    = jfs_removexattr,
        .setattr        = jfs_setattr,
 #ifdef CONFIG_JFS_POSIX_ACL
-       .check_acl      = jfs_check_acl,
+       .get_acl        = jfs_get_acl,
 #endif
 };
 
index 54e07559878d12e2fe77c7b39e4f2114c7a3abdb..ad84fe50ca9e897362caa12101d63a590b56073f 100644 (file)
@@ -20,7 +20,7 @@
 
 #ifdef CONFIG_JFS_POSIX_ACL
 
-int jfs_check_acl(struct inode *, int);
+struct posix_acl *jfs_get_acl(struct inode *inode, int type);
 int jfs_init_acl(tid_t, struct inode *, struct inode *);
 int jfs_acl_chmod(struct inode *inode);
 
index 03787ef6a11826523abaa38fcfce77f57c8c199d..29b1f1a21142d773d9fe0ec783745cc82cd2a21b 100644 (file)
@@ -1537,7 +1537,7 @@ const struct inode_operations jfs_dir_inode_operations = {
        .removexattr    = jfs_removexattr,
        .setattr        = jfs_setattr,
 #ifdef CONFIG_JFS_POSIX_ACL
-       .check_acl      = jfs_check_acl,
+       .get_acl        = jfs_get_acl,
 #endif
 };
 
index 120efc76d3d06e3980db48c97199e9b604b5c94c..ec2e5656b444038e57e37e44ad491b8511c7df19 100644 (file)
@@ -196,20 +196,22 @@ static int check_acl(struct inode *inode, int mask)
        acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
 
        /*
-        * A filesystem can force a ACL callback by just never
-        * filling the ACL cache. But normally you'd fill the
-        * cache either at inode instantiation time, or on the
-        * first ->check_acl call.
+        * A filesystem can force a ACL callback by just never filling the
+        * ACL cache. But normally you'd fill the cache either at inode
+        * instantiation time, or on the first ->get_acl call.
         *
-        * If the filesystem doesn't have a check_acl() function
-        * at all, we'll just create the negative cache entry.
+        * If the filesystem doesn't have a get_acl() function at all, we'll
+        * just create the negative cache entry.
         */
        if (acl == ACL_NOT_CACHED) {
-               if (inode->i_op->check_acl)
-                       return inode->i_op->check_acl(inode, mask);
-
-               set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
-               return -EAGAIN;
+               if (inode->i_op->get_acl) {
+                       acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS);
+                       if (IS_ERR(acl))
+                               return PTR_ERR(acl);
+               } else {
+                       set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
+                       return -EAGAIN;
+               }
        }
 
        if (acl) {
index 480200e94e83a18a5e5e40e2924e8dd992838a2f..783c58d9daf11b92898676b2af2f55765cdd3caf 100644 (file)
@@ -290,7 +290,7 @@ static int ocfs2_set_acl(handle_t *handle,
        return ret;
 }
 
-int ocfs2_check_acl(struct inode *inode, int mask)
+struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
 {
        struct ocfs2_super *osb;
        struct buffer_head *di_bh = NULL;
@@ -299,29 +299,17 @@ int ocfs2_check_acl(struct inode *inode, int mask)
 
        osb = OCFS2_SB(inode->i_sb);
        if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
-               return ret;
+               return NULL;
 
        ret = ocfs2_read_inode_block(inode, &di_bh);
-       if (ret < 0) {
-               mlog_errno(ret);
-               return ret;
-       }
+       if (ret < 0)
+               return ERR_PTR(ret);
 
-       acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh);
+       acl = ocfs2_get_acl_nolock(inode, type, di_bh);
 
        brelse(di_bh);
 
-       if (IS_ERR(acl)) {
-               mlog_errno(PTR_ERR(acl));
-               return PTR_ERR(acl);
-       }
-       if (acl) {
-               ret = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return ret;
-       }
-
-       return -EAGAIN;
+       return acl;
 }
 
 int ocfs2_acl_chmod(struct inode *inode)
index 5c5d31f05853175476cc0c9ed4c2460c67f40da9..071fbd380f2f52889fe4ddc459df3bf603d7629e 100644 (file)
@@ -26,7 +26,7 @@ struct ocfs2_acl_entry {
        __le32 e_id;
 };
 
-extern int ocfs2_check_acl(struct inode *, int);
+struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type);
 extern int ocfs2_acl_chmod(struct inode *);
 extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
                          struct buffer_head *, struct buffer_head *,
index 0fc2bd34039dafd8d05e4bbe89885afbe11167af..de4ea1af041b654f8f1b4f1a000f6492226f701f 100644 (file)
@@ -2600,14 +2600,14 @@ const struct inode_operations ocfs2_file_iops = {
        .listxattr      = ocfs2_listxattr,
        .removexattr    = generic_removexattr,
        .fiemap         = ocfs2_fiemap,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
 
 const struct inode_operations ocfs2_special_file_iops = {
        .setattr        = ocfs2_setattr,
        .getattr        = ocfs2_getattr,
        .permission     = ocfs2_permission,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
 
 /*
index 33889dc52dd7ee4d856ab482b6ca13cf1b47bb46..53aa41ed7bf39d34d2ad9064813b3e6feeb57971 100644 (file)
@@ -2498,5 +2498,5 @@ const struct inode_operations ocfs2_dir_iops = {
        .listxattr      = ocfs2_listxattr,
        .removexattr    = generic_removexattr,
        .fiemap         = ocfs2_fiemap,
-       .check_acl      = ocfs2_check_acl,
+       .get_acl        = ocfs2_iop_get_acl,
 };
index 0dd0266f97962c1e0c1b9640ab37d189afde6e3f..a6227d219e93028f1bb0adc19002b3e12a89c8ef 100644 (file)
@@ -27,7 +27,6 @@ EXPORT_SYMBOL(posix_acl_alloc);
 EXPORT_SYMBOL(posix_acl_valid);
 EXPORT_SYMBOL(posix_acl_equiv_mode);
 EXPORT_SYMBOL(posix_acl_from_mode);
-EXPORT_SYMBOL(posix_acl_permission);
 
 /*
  * Init a fresh posix_acl
index c7156dc39ce7946b806e210dd0c4382cb1313185..ace635053a3677fa40080fee79897fa8281c7889 100644 (file)
@@ -319,5 +319,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
index 551f1b79dbc479a810a849df2f9ce1a118ead575..ef392324bbf14f7b06de26ef30cc75461f7a1f84 100644 (file)
@@ -1529,7 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
 
 /*
@@ -1546,7 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 
 };
 
@@ -1560,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
        .listxattr = reiserfs_listxattr,
        .removexattr = reiserfs_removexattr,
        .permission = reiserfs_permission,
-       .check_acl = reiserfs_check_acl,
+       .get_acl = reiserfs_get_acl,
 };
index 7ba083eb62bdb6dcc430a914156126d79c1571e8..6bc346c160e71489ead30d54f41afc3e07ed23bd 100644 (file)
@@ -867,24 +867,6 @@ out:
        return err;
 }
 
-int reiserfs_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-       int error = -EAGAIN; /* do regular unix permission checks by default */
-
-       acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
-
-       if (acl) {
-               if (!IS_ERR(acl)) {
-                       error = posix_acl_permission(inode, acl, mask);
-                       posix_acl_release(acl);
-               } else if (PTR_ERR(acl) != -ENODATA)
-                       error = PTR_ERR(acl);
-       }
-
-       return error;
-}
-
 static int create_privroot(struct dentry *dentry)
 {
        int err;
index 2827bbd8366e02a8ce079a771fc5f9e29138cd01..44ce516568045386e282eb03456835f87417a45a 100644 (file)
@@ -114,6 +114,8 @@ xfs_get_acl(struct inode *inode, int type)
        if (acl != ACL_NOT_CACHED)
                return acl;
 
+       trace_xfs_get_acl(ip);
+
        switch (type) {
        case ACL_TYPE_ACCESS:
                ea_name = SGI_ACL_FILE;
@@ -218,25 +220,6 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return error;
 }
 
-int
-xfs_check_acl(struct inode *inode, int mask)
-{
-       struct posix_acl *acl;
-       int error = -EAGAIN;
-
-       trace_xfs_check_acl(XFS_I(inode));
-
-       acl = xfs_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               error = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-       }
-
-       return error;
-}
-
 static int
 xfs_set_mode(struct inode *inode, mode_t mode)
 {
index 77463dd55198fc849761cca3258be03c48327e9a..6544c3236bc8dd51bff1c8d9935d1f979830553c 100644 (file)
@@ -1022,7 +1022,7 @@ xfs_vn_fiemap(
 }
 
 static const struct inode_operations xfs_inode_operations = {
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1048,7 +1048,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
        .rmdir                  = xfs_vn_unlink,
        .mknod                  = xfs_vn_mknod,
        .rename                 = xfs_vn_rename,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1073,7 +1073,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
        .rmdir                  = xfs_vn_unlink,
        .mknod                  = xfs_vn_mknod,
        .rename                 = xfs_vn_rename,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
@@ -1086,7 +1086,7 @@ static const struct inode_operations xfs_symlink_inode_operations = {
        .readlink               = generic_readlink,
        .follow_link            = xfs_vn_follow_link,
        .put_link               = xfs_vn_put_link,
-       .check_acl              = xfs_check_acl,
+       .get_acl                = xfs_get_acl,
        .getattr                = xfs_vn_getattr,
        .setattr                = xfs_vn_setattr,
        .setxattr               = generic_setxattr,
index fda0708ef2ea82f455bb87dcc0aee00cdbc85632..690fc7a7bd7283f78f24a35dc4e4d7ad10d0a65f 100644 (file)
@@ -571,7 +571,7 @@ DEFINE_INODE_EVENT(xfs_alloc_file_space);
 DEFINE_INODE_EVENT(xfs_free_file_space);
 DEFINE_INODE_EVENT(xfs_readdir);
 #ifdef CONFIG_XFS_POSIX_ACL
-DEFINE_INODE_EVENT(xfs_check_acl);
+DEFINE_INODE_EVENT(xfs_get_acl);
 #endif
 DEFINE_INODE_EVENT(xfs_vm_bmap);
 DEFINE_INODE_EVENT(xfs_file_ioctl);
index 0135e2a669d78924c2e4261450ad5d17676371b8..2c656ef49473b0f429d15861dfde1e1c6eb0b292 100644 (file)
@@ -42,7 +42,6 @@ struct xfs_acl {
 #define SGI_ACL_DEFAULT_SIZE   (sizeof(SGI_ACL_DEFAULT)-1)
 
 #ifdef CONFIG_XFS_POSIX_ACL
-extern int xfs_check_acl(struct inode *inode, int mask);
 extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);
 extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl);
 extern int xfs_acl_chmod(struct inode *inode);
@@ -52,7 +51,6 @@ extern int posix_acl_default_exists(struct inode *inode);
 extern const struct xattr_handler xfs_xattr_acl_access_handler;
 extern const struct xattr_handler xfs_xattr_acl_default_handler;
 #else
-# define xfs_check_acl                                 NULL
 # define xfs_get_acl(inode, type)                      NULL
 # define xfs_inherit_acl(inode, default_acl)           0
 # define xfs_acl_chmod(inode)                          0
index 7a757a48a5c6acbb8b2bca1c9d52c3ad09d46d7a..12f84b30c3cabad04140ee6f5478dca37d85b629 100644 (file)
@@ -1586,7 +1586,7 @@ struct inode_operations {
        struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
        void * (*follow_link) (struct dentry *, struct nameidata *);
        int (*permission) (struct inode *, int);
-       int (*check_acl)(struct inode *, int);
+       struct posix_acl * (*get_acl)(struct inode *, int);
 
        int (*readlink) (struct dentry *, char __user *,int);
        void (*put_link) (struct dentry *, struct nameidata *, void *);
index 574bea4013b618d0816d2280ced3670fa4e75bd4..b6d657544ef1afdbcfe2b867bbdaf0d91cfe749c 100644 (file)
@@ -10,6 +10,5 @@ extern const struct xattr_handler generic_acl_default_handler;
 
 int generic_acl_init(struct inode *, struct inode *);
 int generic_acl_chmod(struct inode *);
-int generic_check_acl(struct inode *inode, int mask);
 
 #endif /* LINUX_GENERIC_ACL_H */
index 3fd8c4506bbb32ef4347784e7a4c529883348bcb..f096b80e73d8145dc35bcdb36f008d29a61f07d9 100644 (file)
@@ -59,11 +59,7 @@ extern const struct xattr_handler reiserfs_posix_acl_access_handler;
 #else
 
 #define reiserfs_cache_default_acl(inode) 0
-
-static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
-{
-       return NULL;
-}
+#define reiserfs_get_acl NULL
 
 static inline int reiserfs_acl_chmod(struct inode *inode)
 {
index 57958c0e1d38319fff4a2f83a3e58250e64cc794..c2b71473266efea1a172055d360c969b74f22680 100644 (file)
@@ -45,7 +45,6 @@ int reiserfs_permission(struct inode *inode, int mask);
 
 #ifdef CONFIG_REISERFS_FS_XATTR
 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
-int reiserfs_check_acl(struct inode *inode, int mask);
 ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
                          void *buffer, size_t size);
 int reiserfs_setxattr(struct dentry *dentry, const char *name,
@@ -123,7 +122,6 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 #define reiserfs_setxattr NULL
 #define reiserfs_listxattr NULL
 #define reiserfs_removexattr NULL
-#define reiserfs_check_acl NULL
 
 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
 {
index fcedf5464eb79dba02ad485681fcc67530bdb720..3e519798b522366b0d003501d67388261ee101e2 100644 (file)
@@ -2715,10 +2715,6 @@ static const struct inode_operations shmem_inode_operations = {
        .listxattr      = shmem_listxattr,
        .removexattr    = shmem_removexattr,
 #endif
-#ifdef CONFIG_TMPFS_POSIX_ACL
-       .check_acl      = generic_check_acl,
-#endif
-
 };
 
 static const struct inode_operations shmem_dir_inode_operations = {
@@ -2741,7 +2737,6 @@ static const struct inode_operations shmem_dir_inode_operations = {
 #endif
 #ifdef CONFIG_TMPFS_POSIX_ACL
        .setattr        = shmem_setattr,
-       .check_acl      = generic_check_acl,
 #endif
 };
 
@@ -2754,7 +2749,6 @@ static const struct inode_operations shmem_special_inode_operations = {
 #endif
 #ifdef CONFIG_TMPFS_POSIX_ACL
        .setattr        = shmem_setattr,
-       .check_acl      = generic_check_acl,
 #endif
 };