aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-23 11:37:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-25 14:30:23 -0400
commit4e34e719e457f2e031297175410fc0bd4016a085 (patch)
treeab969a371e0d2efc6bfbf503ca6cdfce3af3bf6c
parentedde854e8bb34a7f32fa993d721f1da0faf64165 (diff)
fs: take the ACL checks to common code
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>
-rw-r--r--Documentation/filesystems/Locking4
-rw-r--r--Documentation/filesystems/porting7
-rw-r--r--Documentation/filesystems/vfs.txt2
-rw-r--r--fs/9p/acl.c14
-rw-r--r--fs/9p/acl.h4
-rw-r--r--fs/9p/vfs_inode_dotl.c4
-rw-r--r--fs/btrfs/acl.c18
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/inode.c10
-rw-r--r--fs/ext2/acl.c19
-rw-r--r--fs/ext2/acl.h4
-rw-r--r--fs/ext2/file.c2
-rw-r--r--fs/ext2/namei.c4
-rw-r--r--fs/ext3/acl.c19
-rw-r--r--fs/ext3/acl.h4
-rw-r--r--fs/ext3/file.c2
-rw-r--r--fs/ext3/namei.c4
-rw-r--r--fs/ext4/acl.c19
-rw-r--r--fs/ext4/acl.h4
-rw-r--r--fs/ext4/file.c2
-rw-r--r--fs/ext4/namei.c4
-rw-r--r--fs/generic_acl.c14
-rw-r--r--fs/gfs2/acl.c25
-rw-r--r--fs/gfs2/acl.h2
-rw-r--r--fs/gfs2/inode.c6
-rw-r--r--fs/jffs2/acl.c18
-rw-r--r--fs/jffs2/acl.h4
-rw-r--r--fs/jffs2/dir.c2
-rw-r--r--fs/jffs2/file.c2
-rw-r--r--fs/jffs2/symlink.c2
-rw-r--r--fs/jfs/acl.c18
-rw-r--r--fs/jfs/file.c2
-rw-r--r--fs/jfs/jfs_acl.h2
-rw-r--r--fs/jfs/namei.c2
-rw-r--r--fs/namei.c24
-rw-r--r--fs/ocfs2/acl.c24
-rw-r--r--fs/ocfs2/acl.h2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/namei.c2
-rw-r--r--fs/posix_acl.c1
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/reiserfs/xattr.c18
-rw-r--r--fs/xfs/linux-2.6/xfs_acl.c21
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c8
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h2
-rw-r--r--fs/xfs/xfs_acl.h2
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/generic_acl.h1
-rw-r--r--include/linux/reiserfs_acl.h6
-rw-r--r--include/linux/reiserfs_xattr.h2
-rw-r--r--mm/shmem.c6
52 files changed, 92 insertions, 294 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index ca7e25292542..7e4699146fe1 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -52,7 +52,7 @@ ata *);
52 void (*put_link) (struct dentry *, struct nameidata *, void *); 52 void (*put_link) (struct dentry *, struct nameidata *, void *);
53 void (*truncate) (struct inode *); 53 void (*truncate) (struct inode *);
54 int (*permission) (struct inode *, int, unsigned int); 54 int (*permission) (struct inode *, int, unsigned int);
55 int (*check_acl)(struct inode *, int); 55 int (*get_acl)(struct inode *, int);
56 int (*setattr) (struct dentry *, struct iattr *); 56 int (*setattr) (struct dentry *, struct iattr *);
57 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); 57 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
58 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 58 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -80,7 +80,7 @@ put_link: no
80truncate: yes (see below) 80truncate: yes (see below)
81setattr: yes 81setattr: yes
82permission: no (may not block if called in rcu-walk mode) 82permission: no (may not block if called in rcu-walk mode)
83check_acl: no 83get_acl: no
84getattr: no 84getattr: no
85setxattr: yes 85setxattr: yes
86getxattr: no 86getxattr: no
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index 7f8861d341ea..b4a3d765ff9a 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -407,10 +407,11 @@ to some pointer to returning that pointer. On errors return ERR_PTR(...).
407 407
408-- 408--
409[mandatory] 409[mandatory]
410 ->permission(), generic_permission() and ->check_acl() have lost flags 410 ->permission() and generic_permission()have lost flags
411argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask. 411argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
412 generic_permission() has also lost the check_acl argument; if you want 412 generic_permission() has also lost the check_acl argument; ACL checking
413non-NULL to be used for that inode, put it into ->i_op->check_acl. 413has been taken to VFS and filesystems need to provide a non-NULL ->i_op->get_acl
414to read an ACL from disk.
414 415
415-- 416--
416[mandatory] 417[mandatory]
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index eff6617c9a0f..52d8fb81cfff 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -356,7 +356,7 @@ struct inode_operations {
356 void (*put_link) (struct dentry *, struct nameidata *, void *); 356 void (*put_link) (struct dentry *, struct nameidata *, void *);
357 void (*truncate) (struct inode *); 357 void (*truncate) (struct inode *);
358 int (*permission) (struct inode *, int); 358 int (*permission) (struct inode *, int);
359 int (*check_acl)(struct inode *, int); 359 int (*get_acl)(struct inode *, int);
360 int (*setattr) (struct dentry *, struct iattr *); 360 int (*setattr) (struct dentry *, struct iattr *);
361 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 361 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
362 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 362 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 075bc909da17..814be079c185 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -96,7 +96,7 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
96 return acl; 96 return acl;
97} 97}
98 98
99int v9fs_check_acl(struct inode *inode, int mask) 99struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
100{ 100{
101 struct posix_acl *acl; 101 struct posix_acl *acl;
102 struct v9fs_session_info *v9ses; 102 struct v9fs_session_info *v9ses;
@@ -108,18 +108,10 @@ int v9fs_check_acl(struct inode *inode, int mask)
108 * On access = client and acl = on mode get the acl 108 * On access = client and acl = on mode get the acl
109 * values from the server 109 * values from the server
110 */ 110 */
111 return -EAGAIN; 111 return NULL;
112 } 112 }
113 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS); 113 return v9fs_get_cached_acl(inode, type);
114 114
115 if (IS_ERR(acl))
116 return PTR_ERR(acl);
117 if (acl) {
118 int error = posix_acl_permission(inode, acl, mask);
119 posix_acl_release(acl);
120 return error;
121 }
122 return -EAGAIN;
123} 115}
124 116
125static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) 117static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
diff --git a/fs/9p/acl.h b/fs/9p/acl.h
index 3eba10f3af1e..ddb7ae19d971 100644
--- a/fs/9p/acl.h
+++ b/fs/9p/acl.h
@@ -16,14 +16,14 @@
16 16
17#ifdef CONFIG_9P_FS_POSIX_ACL 17#ifdef CONFIG_9P_FS_POSIX_ACL
18extern int v9fs_get_acl(struct inode *, struct p9_fid *); 18extern int v9fs_get_acl(struct inode *, struct p9_fid *);
19extern int v9fs_check_acl(struct inode *inode, int mask); 19extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
20extern int v9fs_acl_chmod(struct dentry *); 20extern int v9fs_acl_chmod(struct dentry *);
21extern int v9fs_set_create_acl(struct dentry *, 21extern int v9fs_set_create_acl(struct dentry *,
22 struct posix_acl **, struct posix_acl **); 22 struct posix_acl **, struct posix_acl **);
23extern int v9fs_acl_mode(struct inode *dir, mode_t *modep, 23extern int v9fs_acl_mode(struct inode *dir, mode_t *modep,
24 struct posix_acl **dpacl, struct posix_acl **pacl); 24 struct posix_acl **dpacl, struct posix_acl **pacl);
25#else 25#else
26#define v9fs_check_acl NULL 26#define v9fs_iop_get_acl NULL
27static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) 27static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
28{ 28{
29 return 0; 29 return 0;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 803f59ff2faa..9d808d0e0cd9 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -872,7 +872,7 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = {
872 .getxattr = generic_getxattr, 872 .getxattr = generic_getxattr,
873 .removexattr = generic_removexattr, 873 .removexattr = generic_removexattr,
874 .listxattr = v9fs_listxattr, 874 .listxattr = v9fs_listxattr,
875 .check_acl = v9fs_check_acl, 875 .get_acl = v9fs_iop_get_acl,
876}; 876};
877 877
878const struct inode_operations v9fs_file_inode_operations_dotl = { 878const struct inode_operations v9fs_file_inode_operations_dotl = {
@@ -882,7 +882,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = {
882 .getxattr = generic_getxattr, 882 .getxattr = generic_getxattr,
883 .removexattr = generic_removexattr, 883 .removexattr = generic_removexattr,
884 .listxattr = v9fs_listxattr, 884 .listxattr = v9fs_listxattr,
885 .check_acl = v9fs_check_acl, 885 .get_acl = v9fs_iop_get_acl,
886}; 886};
887 887
888const struct inode_operations v9fs_symlink_inode_operations_dotl = { 888const struct inode_operations v9fs_symlink_inode_operations_dotl = {
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 9508ad14c924..65a735d8f6e4 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -30,7 +30,7 @@
30 30
31#ifdef CONFIG_BTRFS_FS_POSIX_ACL 31#ifdef CONFIG_BTRFS_FS_POSIX_ACL
32 32
33static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) 33struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
34{ 34{
35 int size; 35 int size;
36 const char *name; 36 const char *name;
@@ -195,22 +195,6 @@ out:
195 return ret; 195 return ret;
196} 196}
197 197
198int btrfs_check_acl(struct inode *inode, int mask)
199{
200 int error = -EAGAIN;
201 struct posix_acl *acl;
202
203 acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
204 if (IS_ERR(acl))
205 return PTR_ERR(acl);
206 if (acl) {
207 error = posix_acl_permission(inode, acl, mask);
208 posix_acl_release(acl);
209 }
210
211 return error;
212}
213
214/* 198/*
215 * btrfs_init_acl is already generally called under fs_mutex, so the locking 199 * btrfs_init_acl is already generally called under fs_mutex, so the locking
216 * stuff has been fixed to work with that. If the locking stuff changes, we 200 * stuff has been fixed to work with that. If the locking stuff changes, we
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 82be74efbb26..fe9287b06496 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2645,9 +2645,9 @@ do { \
2645 2645
2646/* acl.c */ 2646/* acl.c */
2647#ifdef CONFIG_BTRFS_FS_POSIX_ACL 2647#ifdef CONFIG_BTRFS_FS_POSIX_ACL
2648int btrfs_check_acl(struct inode *inode, int mask); 2648struct posix_acl *btrfs_get_acl(struct inode *inode, int type);
2649#else 2649#else
2650#define btrfs_check_acl NULL 2650#define btrfs_get_acl NULL
2651#endif 2651#endif
2652int btrfs_init_acl(struct btrfs_trans_handle *trans, 2652int btrfs_init_acl(struct btrfs_trans_handle *trans,
2653 struct inode *inode, struct inode *dir); 2653 struct inode *inode, struct inode *dir);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2548a04a0230..e91b097e7252 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7351,12 +7351,12 @@ static const struct inode_operations btrfs_dir_inode_operations = {
7351 .listxattr = btrfs_listxattr, 7351 .listxattr = btrfs_listxattr,
7352 .removexattr = btrfs_removexattr, 7352 .removexattr = btrfs_removexattr,
7353 .permission = btrfs_permission, 7353 .permission = btrfs_permission,
7354 .check_acl = btrfs_check_acl, 7354 .get_acl = btrfs_get_acl,
7355}; 7355};
7356static const struct inode_operations btrfs_dir_ro_inode_operations = { 7356static const struct inode_operations btrfs_dir_ro_inode_operations = {
7357 .lookup = btrfs_lookup, 7357 .lookup = btrfs_lookup,
7358 .permission = btrfs_permission, 7358 .permission = btrfs_permission,
7359 .check_acl = btrfs_check_acl, 7359 .get_acl = btrfs_get_acl,
7360}; 7360};
7361 7361
7362static const struct file_operations btrfs_dir_file_operations = { 7362static const struct file_operations btrfs_dir_file_operations = {
@@ -7425,7 +7425,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
7425 .removexattr = btrfs_removexattr, 7425 .removexattr = btrfs_removexattr,
7426 .permission = btrfs_permission, 7426 .permission = btrfs_permission,
7427 .fiemap = btrfs_fiemap, 7427 .fiemap = btrfs_fiemap,
7428 .check_acl = btrfs_check_acl, 7428 .get_acl = btrfs_get_acl,
7429}; 7429};
7430static const struct inode_operations btrfs_special_inode_operations = { 7430static const struct inode_operations btrfs_special_inode_operations = {
7431 .getattr = btrfs_getattr, 7431 .getattr = btrfs_getattr,
@@ -7435,7 +7435,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
7435 .getxattr = btrfs_getxattr, 7435 .getxattr = btrfs_getxattr,
7436 .listxattr = btrfs_listxattr, 7436 .listxattr = btrfs_listxattr,
7437 .removexattr = btrfs_removexattr, 7437 .removexattr = btrfs_removexattr,
7438 .check_acl = btrfs_check_acl, 7438 .get_acl = btrfs_get_acl,
7439}; 7439};
7440static const struct inode_operations btrfs_symlink_inode_operations = { 7440static const struct inode_operations btrfs_symlink_inode_operations = {
7441 .readlink = generic_readlink, 7441 .readlink = generic_readlink,
@@ -7447,7 +7447,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
7447 .getxattr = btrfs_getxattr, 7447 .getxattr = btrfs_getxattr,
7448 .listxattr = btrfs_listxattr, 7448 .listxattr = btrfs_listxattr,
7449 .removexattr = btrfs_removexattr, 7449 .removexattr = btrfs_removexattr,
7450 .check_acl = btrfs_check_acl, 7450 .get_acl = btrfs_get_acl,
7451}; 7451};
7452 7452
7453const struct dentry_operations btrfs_dentry_operations = { 7453const struct dentry_operations btrfs_dentry_operations = {
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index ba99fa4b2f35..52c053763942 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -128,7 +128,7 @@ fail:
128/* 128/*
129 * inode->i_mutex: don't care 129 * inode->i_mutex: don't care
130 */ 130 */
131static struct posix_acl * 131struct posix_acl *
132ext2_get_acl(struct inode *inode, int type) 132ext2_get_acl(struct inode *inode, int type)
133{ 133{
134 int name_index; 134 int name_index;
@@ -231,23 +231,6 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
231 return error; 231 return error;
232} 232}
233 233
234int
235ext2_check_acl(struct inode *inode, int mask)
236{
237 struct posix_acl *acl;
238
239 acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
240 if (IS_ERR(acl))
241 return PTR_ERR(acl);
242 if (acl) {
243 int error = posix_acl_permission(inode, acl, mask);
244 posix_acl_release(acl);
245 return error;
246 }
247
248 return -EAGAIN;
249}
250
251/* 234/*
252 * Initialize the ACLs of a new inode. Called from ext2_new_inode. 235 * Initialize the ACLs of a new inode. Called from ext2_new_inode.
253 * 236 *
diff --git a/fs/ext2/acl.h b/fs/ext2/acl.h
index 3ff6cbb9ac44..5c0a6a4fb052 100644
--- a/fs/ext2/acl.h
+++ b/fs/ext2/acl.h
@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size)
54#ifdef CONFIG_EXT2_FS_POSIX_ACL 54#ifdef CONFIG_EXT2_FS_POSIX_ACL
55 55
56/* acl.c */ 56/* acl.c */
57extern int ext2_check_acl (struct inode *, int); 57extern struct posix_acl *ext2_get_acl(struct inode *inode, int type);
58extern int ext2_acl_chmod (struct inode *); 58extern int ext2_acl_chmod (struct inode *);
59extern int ext2_init_acl (struct inode *, struct inode *); 59extern int ext2_init_acl (struct inode *, struct inode *);
60 60
61#else 61#else
62#include <linux/sched.h> 62#include <linux/sched.h>
63#define ext2_check_acl NULL 63#define ext2_get_acl NULL
64#define ext2_get_acl NULL 64#define ext2_get_acl NULL
65#define ext2_set_acl NULL 65#define ext2_set_acl NULL
66 66
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 82e06321de35..a5b3a5db3120 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -102,6 +102,6 @@ const struct inode_operations ext2_file_inode_operations = {
102 .removexattr = generic_removexattr, 102 .removexattr = generic_removexattr,
103#endif 103#endif
104 .setattr = ext2_setattr, 104 .setattr = ext2_setattr,
105 .check_acl = ext2_check_acl, 105 .get_acl = ext2_get_acl,
106 .fiemap = ext2_fiemap, 106 .fiemap = ext2_fiemap,
107}; 107};
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index d60b7099e2db..761fde807fc9 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -408,7 +408,7 @@ const struct inode_operations ext2_dir_inode_operations = {
408 .removexattr = generic_removexattr, 408 .removexattr = generic_removexattr,
409#endif 409#endif
410 .setattr = ext2_setattr, 410 .setattr = ext2_setattr,
411 .check_acl = ext2_check_acl, 411 .get_acl = ext2_get_acl,
412}; 412};
413 413
414const struct inode_operations ext2_special_inode_operations = { 414const struct inode_operations ext2_special_inode_operations = {
@@ -419,5 +419,5 @@ const struct inode_operations ext2_special_inode_operations = {
419 .removexattr = generic_removexattr, 419 .removexattr = generic_removexattr,
420#endif 420#endif
421 .setattr = ext2_setattr, 421 .setattr = ext2_setattr,
422 .check_acl = ext2_check_acl, 422 .get_acl = ext2_get_acl,
423}; 423};
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index a9fdd77d4b58..6c29bf0df04a 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -131,7 +131,7 @@ fail:
131 * 131 *
132 * inode->i_mutex: don't care 132 * inode->i_mutex: don't care
133 */ 133 */
134static struct posix_acl * 134struct posix_acl *
135ext3_get_acl(struct inode *inode, int type) 135ext3_get_acl(struct inode *inode, int type)
136{ 136{
137 int name_index; 137 int name_index;
@@ -239,23 +239,6 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
239 return error; 239 return error;
240} 240}
241 241
242int
243ext3_check_acl(struct inode *inode, int mask)
244{
245 struct posix_acl *acl;
246
247 acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
248 if (IS_ERR(acl))
249 return PTR_ERR(acl);
250 if (acl) {
251 int error = posix_acl_permission(inode, acl, mask);
252 posix_acl_release(acl);
253 return error;
254 }
255
256 return -EAGAIN;
257}
258
259/* 242/*
260 * Initialize the ACLs of a new inode. Called from ext3_new_inode. 243 * Initialize the ACLs of a new inode. Called from ext3_new_inode.
261 * 244 *
diff --git a/fs/ext3/acl.h b/fs/ext3/acl.h
index 597334626de9..dbc921e458c5 100644
--- a/fs/ext3/acl.h
+++ b/fs/ext3/acl.h
@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size)
54#ifdef CONFIG_EXT3_FS_POSIX_ACL 54#ifdef CONFIG_EXT3_FS_POSIX_ACL
55 55
56/* acl.c */ 56/* acl.c */
57extern int ext3_check_acl (struct inode *, int); 57extern struct posix_acl *ext3_get_acl(struct inode *inode, int type);
58extern int ext3_acl_chmod (struct inode *); 58extern int ext3_acl_chmod (struct inode *);
59extern int ext3_init_acl (handle_t *, struct inode *, struct inode *); 59extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
60 60
61#else /* CONFIG_EXT3_FS_POSIX_ACL */ 61#else /* CONFIG_EXT3_FS_POSIX_ACL */
62#include <linux/sched.h> 62#include <linux/sched.h>
63#define ext3_check_acl NULL 63#define ext3_get_acl NULL
64 64
65static inline int 65static inline int
66ext3_acl_chmod(struct inode *inode) 66ext3_acl_chmod(struct inode *inode)
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index f55df0e61cbd..2be5b99097f1 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -79,7 +79,7 @@ const struct inode_operations ext3_file_inode_operations = {
79 .listxattr = ext3_listxattr, 79 .listxattr = ext3_listxattr,
80 .removexattr = generic_removexattr, 80 .removexattr = generic_removexattr,
81#endif 81#endif
82 .check_acl = ext3_check_acl, 82 .get_acl = ext3_get_acl,
83 .fiemap = ext3_fiemap, 83 .fiemap = ext3_fiemap,
84}; 84};
85 85
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index c095cf5640c7..3b57230a17bb 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -2529,7 +2529,7 @@ const struct inode_operations ext3_dir_inode_operations = {
2529 .listxattr = ext3_listxattr, 2529 .listxattr = ext3_listxattr,
2530 .removexattr = generic_removexattr, 2530 .removexattr = generic_removexattr,
2531#endif 2531#endif
2532 .check_acl = ext3_check_acl, 2532 .get_acl = ext3_get_acl,
2533}; 2533};
2534 2534
2535const struct inode_operations ext3_special_inode_operations = { 2535const struct inode_operations ext3_special_inode_operations = {
@@ -2540,5 +2540,5 @@ const struct inode_operations ext3_special_inode_operations = {
2540 .listxattr = ext3_listxattr, 2540 .listxattr = ext3_listxattr,
2541 .removexattr = generic_removexattr, 2541 .removexattr = generic_removexattr,
2542#endif 2542#endif
2543 .check_acl = ext3_check_acl, 2543 .get_acl = ext3_get_acl,
2544}; 2544};
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 7b094d1a8d3e..dca2d1ded931 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -131,7 +131,7 @@ fail:
131 * 131 *
132 * inode->i_mutex: don't care 132 * inode->i_mutex: don't care
133 */ 133 */
134static struct posix_acl * 134struct posix_acl *
135ext4_get_acl(struct inode *inode, int type) 135ext4_get_acl(struct inode *inode, int type)
136{ 136{
137 int name_index; 137 int name_index;
@@ -237,23 +237,6 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
237 return error; 237 return error;
238} 238}
239 239
240int
241ext4_check_acl(struct inode *inode, int mask)
242{
243 struct posix_acl *acl;
244
245 acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
246 if (IS_ERR(acl))
247 return PTR_ERR(acl);
248 if (acl) {
249 int error = posix_acl_permission(inode, acl, mask);
250 posix_acl_release(acl);
251 return error;
252 }
253
254 return -EAGAIN;
255}
256
257/* 240/*
258 * Initialize the ACLs of a new inode. Called from ext4_new_inode. 241 * Initialize the ACLs of a new inode. Called from ext4_new_inode.
259 * 242 *
diff --git a/fs/ext4/acl.h b/fs/ext4/acl.h
index 9d843d5deac4..18cb39ed7c7b 100644
--- a/fs/ext4/acl.h
+++ b/fs/ext4/acl.h
@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size)
54#ifdef CONFIG_EXT4_FS_POSIX_ACL 54#ifdef CONFIG_EXT4_FS_POSIX_ACL
55 55
56/* acl.c */ 56/* acl.c */
57extern int ext4_check_acl(struct inode *, int); 57struct posix_acl *ext4_get_acl(struct inode *inode, int type);
58extern int ext4_acl_chmod(struct inode *); 58extern int ext4_acl_chmod(struct inode *);
59extern int ext4_init_acl(handle_t *, struct inode *, struct inode *); 59extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
60 60
61#else /* CONFIG_EXT4_FS_POSIX_ACL */ 61#else /* CONFIG_EXT4_FS_POSIX_ACL */
62#include <linux/sched.h> 62#include <linux/sched.h>
63#define ext4_check_acl NULL 63#define ext4_get_acl NULL
64 64
65static inline int 65static inline int
66ext4_acl_chmod(struct inode *inode) 66ext4_acl_chmod(struct inode *inode)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index ce766f974b1d..e4095e988eba 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -301,7 +301,7 @@ const struct inode_operations ext4_file_inode_operations = {
301 .listxattr = ext4_listxattr, 301 .listxattr = ext4_listxattr,
302 .removexattr = generic_removexattr, 302 .removexattr = generic_removexattr,
303#endif 303#endif
304 .check_acl = ext4_check_acl, 304 .get_acl = ext4_get_acl,
305 .fiemap = ext4_fiemap, 305 .fiemap = ext4_fiemap,
306}; 306};
307 307
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 707d605bf769..8c9babac43dc 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2590,7 +2590,7 @@ const struct inode_operations ext4_dir_inode_operations = {
2590 .listxattr = ext4_listxattr, 2590 .listxattr = ext4_listxattr,
2591 .removexattr = generic_removexattr, 2591 .removexattr = generic_removexattr,
2592#endif 2592#endif
2593 .check_acl = ext4_check_acl, 2593 .get_acl = ext4_get_acl,
2594 .fiemap = ext4_fiemap, 2594 .fiemap = ext4_fiemap,
2595}; 2595};
2596 2596
@@ -2602,5 +2602,5 @@ const struct inode_operations ext4_special_inode_operations = {
2602 .listxattr = ext4_listxattr, 2602 .listxattr = ext4_listxattr,
2603 .removexattr = generic_removexattr, 2603 .removexattr = generic_removexattr,
2604#endif 2604#endif
2605 .check_acl = ext4_check_acl, 2605 .get_acl = ext4_get_acl,
2606}; 2606};
diff --git a/fs/generic_acl.c b/fs/generic_acl.c
index ea19ca47d452..d5e33a077a67 100644
--- a/fs/generic_acl.c
+++ b/fs/generic_acl.c
@@ -172,20 +172,6 @@ generic_acl_chmod(struct inode *inode)
172 return error; 172 return error;
173} 173}
174 174
175int
176generic_check_acl(struct inode *inode, int mask)
177{
178 struct posix_acl *acl;
179
180 acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
181 if (acl) {
182 int error = posix_acl_permission(inode, acl, mask);
183 posix_acl_release(acl);
184 return error;
185 }
186 return -EAGAIN;
187}
188
189const struct xattr_handler generic_acl_access_handler = { 175const struct xattr_handler generic_acl_access_handler = {
190 .prefix = POSIX_ACL_XATTR_ACCESS, 176 .prefix = POSIX_ACL_XATTR_ACCESS,
191 .flags = ACL_TYPE_ACCESS, 177 .flags = ACL_TYPE_ACCESS,
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index a2dd63c0c11a..884c9af0542f 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -67,30 +67,9 @@ static struct posix_acl *gfs2_acl_get(struct gfs2_inode *ip, int type)
67 return acl; 67 return acl;
68} 68}
69 69
70/** 70struct posix_acl *gfs2_get_acl(struct inode *inode, int type)
71 * gfs2_check_acl - Check an ACL to see if we're allowed to do something
72 * @inode: the file we want to do something to
73 * @mask: what we want to do
74 *
75 * Returns: errno
76 */
77
78int gfs2_check_acl(struct inode *inode, int mask)
79{ 71{
80 struct posix_acl *acl; 72 return gfs2_acl_get(GFS2_I(inode), type);
81 int error;
82
83 acl = gfs2_acl_get(GFS2_I(inode), ACL_TYPE_ACCESS);
84 if (IS_ERR(acl))
85 return PTR_ERR(acl);
86
87 if (acl) {
88 error = posix_acl_permission(inode, acl, mask);
89 posix_acl_release(acl);
90 return error;
91 }
92
93 return -EAGAIN;
94} 73}
95 74
96static int gfs2_set_mode(struct inode *inode, mode_t mode) 75static int gfs2_set_mode(struct inode *inode, mode_t mode)
diff --git a/fs/gfs2/acl.h b/fs/gfs2/acl.h
index b522b0cb39ea..0da38dc7efec 100644
--- a/fs/gfs2/acl.h
+++ b/fs/gfs2/acl.h
@@ -16,7 +16,7 @@
16#define GFS2_POSIX_ACL_DEFAULT "posix_acl_default" 16#define GFS2_POSIX_ACL_DEFAULT "posix_acl_default"
17#define GFS2_ACL_MAX_ENTRIES 25 17#define GFS2_ACL_MAX_ENTRIES 25
18 18
19extern int gfs2_check_acl(struct inode *inode, int mask); 19extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type);
20extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode); 20extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode);
21extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); 21extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr);
22extern const struct xattr_handler gfs2_xattr_system_handler; 22extern const struct xattr_handler gfs2_xattr_system_handler;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 0fb51a96eff0..900cf986aadc 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1846,7 +1846,7 @@ const struct inode_operations gfs2_file_iops = {
1846 .listxattr = gfs2_listxattr, 1846 .listxattr = gfs2_listxattr,
1847 .removexattr = gfs2_removexattr, 1847 .removexattr = gfs2_removexattr,
1848 .fiemap = gfs2_fiemap, 1848 .fiemap = gfs2_fiemap,
1849 .check_acl = gfs2_check_acl, 1849 .get_acl = gfs2_get_acl,
1850}; 1850};
1851 1851
1852const struct inode_operations gfs2_dir_iops = { 1852const struct inode_operations gfs2_dir_iops = {
@@ -1867,7 +1867,7 @@ const struct inode_operations gfs2_dir_iops = {
1867 .listxattr = gfs2_listxattr, 1867 .listxattr = gfs2_listxattr,
1868 .removexattr = gfs2_removexattr, 1868 .removexattr = gfs2_removexattr,
1869 .fiemap = gfs2_fiemap, 1869 .fiemap = gfs2_fiemap,
1870 .check_acl = gfs2_check_acl, 1870 .get_acl = gfs2_get_acl,
1871}; 1871};
1872 1872
1873const struct inode_operations gfs2_symlink_iops = { 1873const struct inode_operations gfs2_symlink_iops = {
@@ -1882,6 +1882,6 @@ const struct inode_operations gfs2_symlink_iops = {
1882 .listxattr = gfs2_listxattr, 1882 .listxattr = gfs2_listxattr,
1883 .removexattr = gfs2_removexattr, 1883 .removexattr = gfs2_removexattr,
1884 .fiemap = gfs2_fiemap, 1884 .fiemap = gfs2_fiemap,
1885 .check_acl = gfs2_check_acl, 1885 .get_acl = gfs2_get_acl,
1886}; 1886};
1887 1887
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 5783ed81171b..27c511a1cf05 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -156,7 +156,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
156 return ERR_PTR(-EINVAL); 156 return ERR_PTR(-EINVAL);
157} 157}
158 158
159static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 159struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
160{ 160{
161 struct posix_acl *acl; 161 struct posix_acl *acl;
162 char *value = NULL; 162 char *value = NULL;
@@ -259,22 +259,6 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
259 return rc; 259 return rc;
260} 260}
261 261
262int jffs2_check_acl(struct inode *inode, int mask)
263{
264 struct posix_acl *acl;
265 int rc;
266
267 acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
268 if (IS_ERR(acl))
269 return PTR_ERR(acl);
270 if (acl) {
271 rc = posix_acl_permission(inode, acl, mask);
272 posix_acl_release(acl);
273 return rc;
274 }
275 return -EAGAIN;
276}
277
278int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode) 262int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode)
279{ 263{
280 struct posix_acl *acl; 264 struct posix_acl *acl;
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h
index 9973073b9c47..b3421c78d9f8 100644
--- a/fs/jffs2/acl.h
+++ b/fs/jffs2/acl.h
@@ -26,7 +26,7 @@ struct jffs2_acl_header {
26 26
27#ifdef CONFIG_JFFS2_FS_POSIX_ACL 27#ifdef CONFIG_JFFS2_FS_POSIX_ACL
28 28
29extern int jffs2_check_acl(struct inode *, int); 29struct posix_acl *jffs2_get_acl(struct inode *inode, int type);
30extern int jffs2_acl_chmod(struct inode *); 30extern int jffs2_acl_chmod(struct inode *);
31extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *); 31extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *);
32extern int jffs2_init_acl_post(struct inode *); 32extern int jffs2_init_acl_post(struct inode *);
@@ -36,7 +36,7 @@ extern const struct xattr_handler jffs2_acl_default_xattr_handler;
36 36
37#else 37#else
38 38
39#define jffs2_check_acl (NULL) 39#define jffs2_get_acl (NULL)
40#define jffs2_acl_chmod(inode) (0) 40#define jffs2_acl_chmod(inode) (0)
41#define jffs2_init_acl_pre(dir_i,inode,mode) (0) 41#define jffs2_init_acl_pre(dir_i,inode,mode) (0)
42#define jffs2_init_acl_post(inode) (0) 42#define jffs2_init_acl_post(inode) (0)
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 5f243cd63afc..9659b7c00468 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -56,7 +56,7 @@ const struct inode_operations jffs2_dir_inode_operations =
56 .rmdir = jffs2_rmdir, 56 .rmdir = jffs2_rmdir,
57 .mknod = jffs2_mknod, 57 .mknod = jffs2_mknod,
58 .rename = jffs2_rename, 58 .rename = jffs2_rename,
59 .check_acl = jffs2_check_acl, 59 .get_acl = jffs2_get_acl,
60 .setattr = jffs2_setattr, 60 .setattr = jffs2_setattr,
61 .setxattr = jffs2_setxattr, 61 .setxattr = jffs2_setxattr,
62 .getxattr = jffs2_getxattr, 62 .getxattr = jffs2_getxattr,
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 3989f7e09f7f..61e6723535b9 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -63,7 +63,7 @@ const struct file_operations jffs2_file_operations =
63 63
64const struct inode_operations jffs2_file_inode_operations = 64const struct inode_operations jffs2_file_inode_operations =
65{ 65{
66 .check_acl = jffs2_check_acl, 66 .get_acl = jffs2_get_acl,
67 .setattr = jffs2_setattr, 67 .setattr = jffs2_setattr,
68 .setxattr = jffs2_setxattr, 68 .setxattr = jffs2_setxattr,
69 .getxattr = jffs2_getxattr, 69 .getxattr = jffs2_getxattr,
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c
index b955626071c2..e3035afb1814 100644
--- a/fs/jffs2/symlink.c
+++ b/fs/jffs2/symlink.c
@@ -20,7 +20,7 @@ const struct inode_operations jffs2_symlink_inode_operations =
20{ 20{
21 .readlink = generic_readlink, 21 .readlink = generic_readlink,
22 .follow_link = jffs2_follow_link, 22 .follow_link = jffs2_follow_link,
23 .check_acl = jffs2_check_acl, 23 .get_acl = jffs2_get_acl,
24 .setattr = jffs2_setattr, 24 .setattr = jffs2_setattr,
25 .setxattr = jffs2_setxattr, 25 .setxattr = jffs2_setxattr,
26 .getxattr = jffs2_getxattr, 26 .getxattr = jffs2_getxattr,
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 687a1ae42e3f..b3a32caf2b45 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -27,7 +27,7 @@
27#include "jfs_xattr.h" 27#include "jfs_xattr.h"
28#include "jfs_acl.h" 28#include "jfs_acl.h"
29 29
30static struct posix_acl *jfs_get_acl(struct inode *inode, int type) 30struct posix_acl *jfs_get_acl(struct inode *inode, int type)
31{ 31{
32 struct posix_acl *acl; 32 struct posix_acl *acl;
33 char *ea_name; 33 char *ea_name;
@@ -114,22 +114,6 @@ out:
114 return rc; 114 return rc;
115} 115}
116 116
117int jfs_check_acl(struct inode *inode, int mask)
118{
119 struct posix_acl *acl;
120
121 acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
122 if (IS_ERR(acl))
123 return PTR_ERR(acl);
124 if (acl) {
125 int error = posix_acl_permission(inode, acl, mask);
126 posix_acl_release(acl);
127 return error;
128 }
129
130 return -EAGAIN;
131}
132
133int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir) 117int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
134{ 118{
135 struct posix_acl *acl = NULL; 119 struct posix_acl *acl = NULL;
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 7527855b5cc6..844f9460cb11 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -140,7 +140,7 @@ const struct inode_operations jfs_file_inode_operations = {
140 .removexattr = jfs_removexattr, 140 .removexattr = jfs_removexattr,
141 .setattr = jfs_setattr, 141 .setattr = jfs_setattr,
142#ifdef CONFIG_JFS_POSIX_ACL 142#ifdef CONFIG_JFS_POSIX_ACL
143 .check_acl = jfs_check_acl, 143 .get_acl = jfs_get_acl,
144#endif 144#endif
145}; 145};
146 146
diff --git a/fs/jfs/jfs_acl.h b/fs/jfs/jfs_acl.h
index 54e07559878d..ad84fe50ca9e 100644
--- a/fs/jfs/jfs_acl.h
+++ b/fs/jfs/jfs_acl.h
@@ -20,7 +20,7 @@
20 20
21#ifdef CONFIG_JFS_POSIX_ACL 21#ifdef CONFIG_JFS_POSIX_ACL
22 22
23int jfs_check_acl(struct inode *, int); 23struct posix_acl *jfs_get_acl(struct inode *inode, int type);
24int jfs_init_acl(tid_t, struct inode *, struct inode *); 24int jfs_init_acl(tid_t, struct inode *, struct inode *);
25int jfs_acl_chmod(struct inode *inode); 25int jfs_acl_chmod(struct inode *inode);
26 26
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 03787ef6a118..29b1f1a21142 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1537,7 +1537,7 @@ const struct inode_operations jfs_dir_inode_operations = {
1537 .removexattr = jfs_removexattr, 1537 .removexattr = jfs_removexattr,
1538 .setattr = jfs_setattr, 1538 .setattr = jfs_setattr,
1539#ifdef CONFIG_JFS_POSIX_ACL 1539#ifdef CONFIG_JFS_POSIX_ACL
1540 .check_acl = jfs_check_acl, 1540 .get_acl = jfs_get_acl,
1541#endif 1541#endif
1542}; 1542};
1543 1543
diff --git a/fs/namei.c b/fs/namei.c
index 120efc76d3d0..ec2e5656b444 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -196,20 +196,22 @@ static int check_acl(struct inode *inode, int mask)
196 acl = get_cached_acl(inode, ACL_TYPE_ACCESS); 196 acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
197 197
198 /* 198 /*
199 * A filesystem can force a ACL callback by just never 199 * A filesystem can force a ACL callback by just never filling the
200 * filling the ACL cache. But normally you'd fill the 200 * ACL cache. But normally you'd fill the cache either at inode
201 * cache either at inode instantiation time, or on the 201 * instantiation time, or on the first ->get_acl call.
202 * first ->check_acl call.
203 * 202 *
204 * If the filesystem doesn't have a check_acl() function 203 * If the filesystem doesn't have a get_acl() function at all, we'll
205 * at all, we'll just create the negative cache entry. 204 * just create the negative cache entry.
206 */ 205 */
207 if (acl == ACL_NOT_CACHED) { 206 if (acl == ACL_NOT_CACHED) {
208 if (inode->i_op->check_acl) 207 if (inode->i_op->get_acl) {
209 return inode->i_op->check_acl(inode, mask); 208 acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS);
210 209 if (IS_ERR(acl))
211 set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); 210 return PTR_ERR(acl);
212 return -EAGAIN; 211 } else {
212 set_cached_acl(inode, ACL_TYPE_ACCESS, NULL);
213 return -EAGAIN;
214 }
213 } 215 }
214 216
215 if (acl) { 217 if (acl) {
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 480200e94e83..783c58d9daf1 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -290,7 +290,7 @@ static int ocfs2_set_acl(handle_t *handle,
290 return ret; 290 return ret;
291} 291}
292 292
293int ocfs2_check_acl(struct inode *inode, int mask) 293struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type)
294{ 294{
295 struct ocfs2_super *osb; 295 struct ocfs2_super *osb;
296 struct buffer_head *di_bh = NULL; 296 struct buffer_head *di_bh = NULL;
@@ -299,29 +299,17 @@ int ocfs2_check_acl(struct inode *inode, int mask)
299 299
300 osb = OCFS2_SB(inode->i_sb); 300 osb = OCFS2_SB(inode->i_sb);
301 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 301 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
302 return ret; 302 return NULL;
303 303
304 ret = ocfs2_read_inode_block(inode, &di_bh); 304 ret = ocfs2_read_inode_block(inode, &di_bh);
305 if (ret < 0) { 305 if (ret < 0)
306 mlog_errno(ret); 306 return ERR_PTR(ret);
307 return ret;
308 }
309 307
310 acl = ocfs2_get_acl_nolock(inode, ACL_TYPE_ACCESS, di_bh); 308 acl = ocfs2_get_acl_nolock(inode, type, di_bh);
311 309
312 brelse(di_bh); 310 brelse(di_bh);
313 311
314 if (IS_ERR(acl)) { 312 return acl;
315 mlog_errno(PTR_ERR(acl));
316 return PTR_ERR(acl);
317 }
318 if (acl) {
319 ret = posix_acl_permission(inode, acl, mask);
320 posix_acl_release(acl);
321 return ret;
322 }
323
324 return -EAGAIN;
325} 313}
326 314
327int ocfs2_acl_chmod(struct inode *inode) 315int ocfs2_acl_chmod(struct inode *inode)
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
index 5c5d31f05853..071fbd380f2f 100644
--- a/fs/ocfs2/acl.h
+++ b/fs/ocfs2/acl.h
@@ -26,7 +26,7 @@ struct ocfs2_acl_entry {
26 __le32 e_id; 26 __le32 e_id;
27}; 27};
28 28
29extern int ocfs2_check_acl(struct inode *, int); 29struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type);
30extern int ocfs2_acl_chmod(struct inode *); 30extern int ocfs2_acl_chmod(struct inode *);
31extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, 31extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
32 struct buffer_head *, struct buffer_head *, 32 struct buffer_head *, struct buffer_head *,
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 0fc2bd34039d..de4ea1af041b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2600,14 +2600,14 @@ const struct inode_operations ocfs2_file_iops = {
2600 .listxattr = ocfs2_listxattr, 2600 .listxattr = ocfs2_listxattr,
2601 .removexattr = generic_removexattr, 2601 .removexattr = generic_removexattr,
2602 .fiemap = ocfs2_fiemap, 2602 .fiemap = ocfs2_fiemap,
2603 .check_acl = ocfs2_check_acl, 2603 .get_acl = ocfs2_iop_get_acl,
2604}; 2604};
2605 2605
2606const struct inode_operations ocfs2_special_file_iops = { 2606const struct inode_operations ocfs2_special_file_iops = {
2607 .setattr = ocfs2_setattr, 2607 .setattr = ocfs2_setattr,
2608 .getattr = ocfs2_getattr, 2608 .getattr = ocfs2_getattr,
2609 .permission = ocfs2_permission, 2609 .permission = ocfs2_permission,
2610 .check_acl = ocfs2_check_acl, 2610 .get_acl = ocfs2_iop_get_acl,
2611}; 2611};
2612 2612
2613/* 2613/*
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 33889dc52dd7..53aa41ed7bf3 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2498,5 +2498,5 @@ const struct inode_operations ocfs2_dir_iops = {
2498 .listxattr = ocfs2_listxattr, 2498 .listxattr = ocfs2_listxattr,
2499 .removexattr = generic_removexattr, 2499 .removexattr = generic_removexattr,
2500 .fiemap = ocfs2_fiemap, 2500 .fiemap = ocfs2_fiemap,
2501 .check_acl = ocfs2_check_acl, 2501 .get_acl = ocfs2_iop_get_acl,
2502}; 2502};
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 0dd0266f9796..a6227d219e93 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -27,7 +27,6 @@ EXPORT_SYMBOL(posix_acl_alloc);
27EXPORT_SYMBOL(posix_acl_valid); 27EXPORT_SYMBOL(posix_acl_valid);
28EXPORT_SYMBOL(posix_acl_equiv_mode); 28EXPORT_SYMBOL(posix_acl_equiv_mode);
29EXPORT_SYMBOL(posix_acl_from_mode); 29EXPORT_SYMBOL(posix_acl_from_mode);
30EXPORT_SYMBOL(posix_acl_permission);
31 30
32/* 31/*
33 * Init a fresh posix_acl 32 * Init a fresh posix_acl
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index c7156dc39ce7..ace635053a36 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -319,5 +319,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
319 .listxattr = reiserfs_listxattr, 319 .listxattr = reiserfs_listxattr,
320 .removexattr = reiserfs_removexattr, 320 .removexattr = reiserfs_removexattr,
321 .permission = reiserfs_permission, 321 .permission = reiserfs_permission,
322 .check_acl = reiserfs_check_acl, 322 .get_acl = reiserfs_get_acl,
323}; 323};
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 551f1b79dbc4..ef392324bbf1 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1529,7 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
1529 .listxattr = reiserfs_listxattr, 1529 .listxattr = reiserfs_listxattr,
1530 .removexattr = reiserfs_removexattr, 1530 .removexattr = reiserfs_removexattr,
1531 .permission = reiserfs_permission, 1531 .permission = reiserfs_permission,
1532 .check_acl = reiserfs_check_acl, 1532 .get_acl = reiserfs_get_acl,
1533}; 1533};
1534 1534
1535/* 1535/*
@@ -1546,7 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
1546 .listxattr = reiserfs_listxattr, 1546 .listxattr = reiserfs_listxattr,
1547 .removexattr = reiserfs_removexattr, 1547 .removexattr = reiserfs_removexattr,
1548 .permission = reiserfs_permission, 1548 .permission = reiserfs_permission,
1549 .check_acl = reiserfs_check_acl, 1549 .get_acl = reiserfs_get_acl,
1550 1550
1551}; 1551};
1552 1552
@@ -1560,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
1560 .listxattr = reiserfs_listxattr, 1560 .listxattr = reiserfs_listxattr,
1561 .removexattr = reiserfs_removexattr, 1561 .removexattr = reiserfs_removexattr,
1562 .permission = reiserfs_permission, 1562 .permission = reiserfs_permission,
1563 .check_acl = reiserfs_check_acl, 1563 .get_acl = reiserfs_get_acl,
1564}; 1564};
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 7ba083eb62bd..6bc346c160e7 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -867,24 +867,6 @@ out:
867 return err; 867 return err;
868} 868}
869 869
870int reiserfs_check_acl(struct inode *inode, int mask)
871{
872 struct posix_acl *acl;
873 int error = -EAGAIN; /* do regular unix permission checks by default */
874
875 acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
876
877 if (acl) {
878 if (!IS_ERR(acl)) {
879 error = posix_acl_permission(inode, acl, mask);
880 posix_acl_release(acl);
881 } else if (PTR_ERR(acl) != -ENODATA)
882 error = PTR_ERR(acl);
883 }
884
885 return error;
886}
887
888static int create_privroot(struct dentry *dentry) 870static int create_privroot(struct dentry *dentry)
889{ 871{
890 int err; 872 int err;
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c
index 2827bbd8366e..44ce51656804 100644
--- a/fs/xfs/linux-2.6/xfs_acl.c
+++ b/fs/xfs/linux-2.6/xfs_acl.c
@@ -114,6 +114,8 @@ xfs_get_acl(struct inode *inode, int type)
114 if (acl != ACL_NOT_CACHED) 114 if (acl != ACL_NOT_CACHED)
115 return acl; 115 return acl;
116 116
117 trace_xfs_get_acl(ip);
118
117 switch (type) { 119 switch (type) {
118 case ACL_TYPE_ACCESS: 120 case ACL_TYPE_ACCESS:
119 ea_name = SGI_ACL_FILE; 121 ea_name = SGI_ACL_FILE;
@@ -218,25 +220,6 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
218 return error; 220 return error;
219} 221}
220 222
221int
222xfs_check_acl(struct inode *inode, int mask)
223{
224 struct posix_acl *acl;
225 int error = -EAGAIN;
226
227 trace_xfs_check_acl(XFS_I(inode));
228
229 acl = xfs_get_acl(inode, ACL_TYPE_ACCESS);
230 if (IS_ERR(acl))
231 return PTR_ERR(acl);
232 if (acl) {
233 error = posix_acl_permission(inode, acl, mask);
234 posix_acl_release(acl);
235 }
236
237 return error;
238}
239
240static int 223static int
241xfs_set_mode(struct inode *inode, mode_t mode) 224xfs_set_mode(struct inode *inode, mode_t mode)
242{ 225{
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 77463dd55198..6544c3236bc8 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -1022,7 +1022,7 @@ xfs_vn_fiemap(
1022} 1022}
1023 1023
1024static const struct inode_operations xfs_inode_operations = { 1024static const struct inode_operations xfs_inode_operations = {
1025 .check_acl = xfs_check_acl, 1025 .get_acl = xfs_get_acl,
1026 .getattr = xfs_vn_getattr, 1026 .getattr = xfs_vn_getattr,
1027 .setattr = xfs_vn_setattr, 1027 .setattr = xfs_vn_setattr,
1028 .setxattr = generic_setxattr, 1028 .setxattr = generic_setxattr,
@@ -1048,7 +1048,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
1048 .rmdir = xfs_vn_unlink, 1048 .rmdir = xfs_vn_unlink,
1049 .mknod = xfs_vn_mknod, 1049 .mknod = xfs_vn_mknod,
1050 .rename = xfs_vn_rename, 1050 .rename = xfs_vn_rename,
1051 .check_acl = xfs_check_acl, 1051 .get_acl = xfs_get_acl,
1052 .getattr = xfs_vn_getattr, 1052 .getattr = xfs_vn_getattr,
1053 .setattr = xfs_vn_setattr, 1053 .setattr = xfs_vn_setattr,
1054 .setxattr = generic_setxattr, 1054 .setxattr = generic_setxattr,
@@ -1073,7 +1073,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
1073 .rmdir = xfs_vn_unlink, 1073 .rmdir = xfs_vn_unlink,
1074 .mknod = xfs_vn_mknod, 1074 .mknod = xfs_vn_mknod,
1075 .rename = xfs_vn_rename, 1075 .rename = xfs_vn_rename,
1076 .check_acl = xfs_check_acl, 1076 .get_acl = xfs_get_acl,
1077 .getattr = xfs_vn_getattr, 1077 .getattr = xfs_vn_getattr,
1078 .setattr = xfs_vn_setattr, 1078 .setattr = xfs_vn_setattr,
1079 .setxattr = generic_setxattr, 1079 .setxattr = generic_setxattr,
@@ -1086,7 +1086,7 @@ static const struct inode_operations xfs_symlink_inode_operations = {
1086 .readlink = generic_readlink, 1086 .readlink = generic_readlink,
1087 .follow_link = xfs_vn_follow_link, 1087 .follow_link = xfs_vn_follow_link,
1088 .put_link = xfs_vn_put_link, 1088 .put_link = xfs_vn_put_link,
1089 .check_acl = xfs_check_acl, 1089 .get_acl = xfs_get_acl,
1090 .getattr = xfs_vn_getattr, 1090 .getattr = xfs_vn_getattr,
1091 .setattr = xfs_vn_setattr, 1091 .setattr = xfs_vn_setattr,
1092 .setxattr = generic_setxattr, 1092 .setxattr = generic_setxattr,
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index fda0708ef2ea..690fc7a7bd72 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -571,7 +571,7 @@ DEFINE_INODE_EVENT(xfs_alloc_file_space);
571DEFINE_INODE_EVENT(xfs_free_file_space); 571DEFINE_INODE_EVENT(xfs_free_file_space);
572DEFINE_INODE_EVENT(xfs_readdir); 572DEFINE_INODE_EVENT(xfs_readdir);
573#ifdef CONFIG_XFS_POSIX_ACL 573#ifdef CONFIG_XFS_POSIX_ACL
574DEFINE_INODE_EVENT(xfs_check_acl); 574DEFINE_INODE_EVENT(xfs_get_acl);
575#endif 575#endif
576DEFINE_INODE_EVENT(xfs_vm_bmap); 576DEFINE_INODE_EVENT(xfs_vm_bmap);
577DEFINE_INODE_EVENT(xfs_file_ioctl); 577DEFINE_INODE_EVENT(xfs_file_ioctl);
diff --git a/fs/xfs/xfs_acl.h b/fs/xfs/xfs_acl.h
index 0135e2a669d7..2c656ef49473 100644
--- a/fs/xfs/xfs_acl.h
+++ b/fs/xfs/xfs_acl.h
@@ -42,7 +42,6 @@ struct xfs_acl {
42#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) 42#define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
43 43
44#ifdef CONFIG_XFS_POSIX_ACL 44#ifdef CONFIG_XFS_POSIX_ACL
45extern int xfs_check_acl(struct inode *inode, int mask);
46extern struct posix_acl *xfs_get_acl(struct inode *inode, int type); 45extern struct posix_acl *xfs_get_acl(struct inode *inode, int type);
47extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl); 46extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl);
48extern int xfs_acl_chmod(struct inode *inode); 47extern int xfs_acl_chmod(struct inode *inode);
@@ -52,7 +51,6 @@ extern int posix_acl_default_exists(struct inode *inode);
52extern const struct xattr_handler xfs_xattr_acl_access_handler; 51extern const struct xattr_handler xfs_xattr_acl_access_handler;
53extern const struct xattr_handler xfs_xattr_acl_default_handler; 52extern const struct xattr_handler xfs_xattr_acl_default_handler;
54#else 53#else
55# define xfs_check_acl NULL
56# define xfs_get_acl(inode, type) NULL 54# define xfs_get_acl(inode, type) NULL
57# define xfs_inherit_acl(inode, default_acl) 0 55# define xfs_inherit_acl(inode, default_acl) 0
58# define xfs_acl_chmod(inode) 0 56# define xfs_acl_chmod(inode) 0
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7a757a48a5c6..12f84b30c3ca 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1586,7 +1586,7 @@ struct inode_operations {
1586 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1586 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1587 void * (*follow_link) (struct dentry *, struct nameidata *); 1587 void * (*follow_link) (struct dentry *, struct nameidata *);
1588 int (*permission) (struct inode *, int); 1588 int (*permission) (struct inode *, int);
1589 int (*check_acl)(struct inode *, int); 1589 struct posix_acl * (*get_acl)(struct inode *, int);
1590 1590
1591 int (*readlink) (struct dentry *, char __user *,int); 1591 int (*readlink) (struct dentry *, char __user *,int);
1592 void (*put_link) (struct dentry *, struct nameidata *, void *); 1592 void (*put_link) (struct dentry *, struct nameidata *, void *);
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index 574bea4013b6..b6d657544ef1 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -10,6 +10,5 @@ extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
13int generic_check_acl(struct inode *inode, int mask);
14 13
15#endif /* LINUX_GENERIC_ACL_H */ 14#endif /* LINUX_GENERIC_ACL_H */
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 3fd8c4506bbb..f096b80e73d8 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -59,11 +59,7 @@ extern const struct xattr_handler reiserfs_posix_acl_access_handler;
59#else 59#else
60 60
61#define reiserfs_cache_default_acl(inode) 0 61#define reiserfs_cache_default_acl(inode) 0
62 62#define reiserfs_get_acl NULL
63static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
64{
65 return NULL;
66}
67 63
68static inline int reiserfs_acl_chmod(struct inode *inode) 64static inline int reiserfs_acl_chmod(struct inode *inode)
69{ 65{
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 57958c0e1d38..c2b71473266e 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -45,7 +45,6 @@ int reiserfs_permission(struct inode *inode, int mask);
45 45
46#ifdef CONFIG_REISERFS_FS_XATTR 46#ifdef CONFIG_REISERFS_FS_XATTR
47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
48int reiserfs_check_acl(struct inode *inode, int mask);
49ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 48ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
50 void *buffer, size_t size); 49 void *buffer, size_t size);
51int reiserfs_setxattr(struct dentry *dentry, const char *name, 50int reiserfs_setxattr(struct dentry *dentry, const char *name,
@@ -123,7 +122,6 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
123#define reiserfs_setxattr NULL 122#define reiserfs_setxattr NULL
124#define reiserfs_listxattr NULL 123#define reiserfs_listxattr NULL
125#define reiserfs_removexattr NULL 124#define reiserfs_removexattr NULL
126#define reiserfs_check_acl NULL
127 125
128static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 126static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
129{ 127{
diff --git a/mm/shmem.c b/mm/shmem.c
index fcedf5464eb7..3e519798b522 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2715,10 +2715,6 @@ static const struct inode_operations shmem_inode_operations = {
2715 .listxattr = shmem_listxattr, 2715 .listxattr = shmem_listxattr,
2716 .removexattr = shmem_removexattr, 2716 .removexattr = shmem_removexattr,
2717#endif 2717#endif
2718#ifdef CONFIG_TMPFS_POSIX_ACL
2719 .check_acl = generic_check_acl,
2720#endif
2721
2722}; 2718};
2723 2719
2724static const struct inode_operations shmem_dir_inode_operations = { 2720static const struct inode_operations shmem_dir_inode_operations = {
@@ -2741,7 +2737,6 @@ static const struct inode_operations shmem_dir_inode_operations = {
2741#endif 2737#endif
2742#ifdef CONFIG_TMPFS_POSIX_ACL 2738#ifdef CONFIG_TMPFS_POSIX_ACL
2743 .setattr = shmem_setattr, 2739 .setattr = shmem_setattr,
2744 .check_acl = generic_check_acl,
2745#endif 2740#endif
2746}; 2741};
2747 2742
@@ -2754,7 +2749,6 @@ static const struct inode_operations shmem_special_inode_operations = {
2754#endif 2749#endif
2755#ifdef CONFIG_TMPFS_POSIX_ACL 2750#ifdef CONFIG_TMPFS_POSIX_ACL
2756 .setattr = shmem_setattr, 2751 .setattr = shmem_setattr,
2757 .check_acl = generic_check_acl,
2758#endif 2752#endif
2759}; 2753};
2760 2754