Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christoph Hellwig and committed by
Al Viro
4e34e719 edde854e

+92 -294
+2 -2
Documentation/filesystems/Locking
··· 52 52 void (*put_link) (struct dentry *, struct nameidata *, void *); 53 53 void (*truncate) (struct inode *); 54 54 int (*permission) (struct inode *, int, unsigned int); 55 - int (*check_acl)(struct inode *, int); 55 + int (*get_acl)(struct inode *, int); 56 56 int (*setattr) (struct dentry *, struct iattr *); 57 57 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); 58 58 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); ··· 80 80 truncate: yes (see below) 81 81 setattr: yes 82 82 permission: no (may not block if called in rcu-walk mode) 83 - check_acl: no 83 + get_acl: no 84 84 getattr: no 85 85 setxattr: yes 86 86 getxattr: no
+4 -3
Documentation/filesystems/porting
··· 407 407 408 408 -- 409 409 [mandatory] 410 - ->permission(), generic_permission() and ->check_acl() have lost flags 410 + ->permission() and generic_permission()have lost flags 411 411 argument; 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 413 - non-NULL to be used for that inode, put it into ->i_op->check_acl. 412 + generic_permission() has also lost the check_acl argument; ACL checking 413 + has been taken to VFS and filesystems need to provide a non-NULL ->i_op->get_acl 414 + to read an ACL from disk. 414 415 415 416 -- 416 417 [mandatory]
+1 -1
Documentation/filesystems/vfs.txt
··· 356 356 void (*put_link) (struct dentry *, struct nameidata *, void *); 357 357 void (*truncate) (struct inode *); 358 358 int (*permission) (struct inode *, int); 359 - int (*check_acl)(struct inode *, int); 359 + int (*get_acl)(struct inode *, int); 360 360 int (*setattr) (struct dentry *, struct iattr *); 361 361 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 362 362 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
+3 -11
fs/9p/acl.c
··· 96 96 return acl; 97 97 } 98 98 99 - int v9fs_check_acl(struct inode *inode, int mask) 99 + struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type) 100 100 { 101 101 struct posix_acl *acl; 102 102 struct v9fs_session_info *v9ses; ··· 108 108 * On access = client and acl = on mode get the acl 109 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 125 117 static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
+2 -2
fs/9p/acl.h
··· 16 16 17 17 #ifdef CONFIG_9P_FS_POSIX_ACL 18 18 extern int v9fs_get_acl(struct inode *, struct p9_fid *); 19 - extern int v9fs_check_acl(struct inode *inode, int mask); 19 + extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); 20 20 extern int v9fs_acl_chmod(struct dentry *); 21 21 extern int v9fs_set_create_acl(struct dentry *, 22 22 struct posix_acl **, struct posix_acl **); 23 23 extern int v9fs_acl_mode(struct inode *dir, mode_t *modep, 24 24 struct posix_acl **dpacl, struct posix_acl **pacl); 25 25 #else 26 - #define v9fs_check_acl NULL 26 + #define v9fs_iop_get_acl NULL 27 27 static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) 28 28 { 29 29 return 0;
+2 -2
fs/9p/vfs_inode_dotl.c
··· 872 872 .getxattr = generic_getxattr, 873 873 .removexattr = generic_removexattr, 874 874 .listxattr = v9fs_listxattr, 875 - .check_acl = v9fs_check_acl, 875 + .get_acl = v9fs_iop_get_acl, 876 876 }; 877 877 878 878 const struct inode_operations v9fs_file_inode_operations_dotl = { ··· 882 882 .getxattr = generic_getxattr, 883 883 .removexattr = generic_removexattr, 884 884 .listxattr = v9fs_listxattr, 885 - .check_acl = v9fs_check_acl, 885 + .get_acl = v9fs_iop_get_acl, 886 886 }; 887 887 888 888 const struct inode_operations v9fs_symlink_inode_operations_dotl = {
+1 -17
fs/btrfs/acl.c
··· 30 30 31 31 #ifdef CONFIG_BTRFS_FS_POSIX_ACL 32 32 33 - static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) 33 + struct posix_acl *btrfs_get_acl(struct inode *inode, int type) 34 34 { 35 35 int size; 36 36 const char *name; ··· 193 193 posix_acl_release(acl); 194 194 195 195 return ret; 196 - } 197 - 198 - int 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 196 } 213 197 214 198 /*
+2 -2
fs/btrfs/ctree.h
··· 2645 2645 2646 2646 /* acl.c */ 2647 2647 #ifdef CONFIG_BTRFS_FS_POSIX_ACL 2648 - int btrfs_check_acl(struct inode *inode, int mask); 2648 + struct posix_acl *btrfs_get_acl(struct inode *inode, int type); 2649 2649 #else 2650 - #define btrfs_check_acl NULL 2650 + #define btrfs_get_acl NULL 2651 2651 #endif 2652 2652 int btrfs_init_acl(struct btrfs_trans_handle *trans, 2653 2653 struct inode *inode, struct inode *dir);
+5 -5
fs/btrfs/inode.c
··· 7351 7351 .listxattr = btrfs_listxattr, 7352 7352 .removexattr = btrfs_removexattr, 7353 7353 .permission = btrfs_permission, 7354 - .check_acl = btrfs_check_acl, 7354 + .get_acl = btrfs_get_acl, 7355 7355 }; 7356 7356 static const struct inode_operations btrfs_dir_ro_inode_operations = { 7357 7357 .lookup = btrfs_lookup, 7358 7358 .permission = btrfs_permission, 7359 - .check_acl = btrfs_check_acl, 7359 + .get_acl = btrfs_get_acl, 7360 7360 }; 7361 7361 7362 7362 static const struct file_operations btrfs_dir_file_operations = { ··· 7425 7425 .removexattr = btrfs_removexattr, 7426 7426 .permission = btrfs_permission, 7427 7427 .fiemap = btrfs_fiemap, 7428 - .check_acl = btrfs_check_acl, 7428 + .get_acl = btrfs_get_acl, 7429 7429 }; 7430 7430 static const struct inode_operations btrfs_special_inode_operations = { 7431 7431 .getattr = btrfs_getattr, ··· 7435 7435 .getxattr = btrfs_getxattr, 7436 7436 .listxattr = btrfs_listxattr, 7437 7437 .removexattr = btrfs_removexattr, 7438 - .check_acl = btrfs_check_acl, 7438 + .get_acl = btrfs_get_acl, 7439 7439 }; 7440 7440 static const struct inode_operations btrfs_symlink_inode_operations = { 7441 7441 .readlink = generic_readlink, ··· 7447 7447 .getxattr = btrfs_getxattr, 7448 7448 .listxattr = btrfs_listxattr, 7449 7449 .removexattr = btrfs_removexattr, 7450 - .check_acl = btrfs_check_acl, 7450 + .get_acl = btrfs_get_acl, 7451 7451 }; 7452 7452 7453 7453 const struct dentry_operations btrfs_dentry_operations = {
+1 -18
fs/ext2/acl.c
··· 128 128 /* 129 129 * inode->i_mutex: don't care 130 130 */ 131 - static struct posix_acl * 131 + struct posix_acl * 132 132 ext2_get_acl(struct inode *inode, int type) 133 133 { 134 134 int name_index; ··· 229 229 if (!error) 230 230 set_cached_acl(inode, type, acl); 231 231 return error; 232 - } 233 - 234 - int 235 - ext2_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 232 } 250 233 251 234 /*
+2 -2
fs/ext2/acl.h
··· 54 54 #ifdef CONFIG_EXT2_FS_POSIX_ACL 55 55 56 56 /* acl.c */ 57 - extern int ext2_check_acl (struct inode *, int); 57 + extern struct posix_acl *ext2_get_acl(struct inode *inode, int type); 58 58 extern int ext2_acl_chmod (struct inode *); 59 59 extern int ext2_init_acl (struct inode *, struct inode *); 60 60 61 61 #else 62 62 #include <linux/sched.h> 63 - #define ext2_check_acl NULL 63 + #define ext2_get_acl NULL 64 64 #define ext2_get_acl NULL 65 65 #define ext2_set_acl NULL 66 66
+1 -1
fs/ext2/file.c
··· 102 102 .removexattr = generic_removexattr, 103 103 #endif 104 104 .setattr = ext2_setattr, 105 - .check_acl = ext2_check_acl, 105 + .get_acl = ext2_get_acl, 106 106 .fiemap = ext2_fiemap, 107 107 };
+2 -2
fs/ext2/namei.c
··· 408 408 .removexattr = generic_removexattr, 409 409 #endif 410 410 .setattr = ext2_setattr, 411 - .check_acl = ext2_check_acl, 411 + .get_acl = ext2_get_acl, 412 412 }; 413 413 414 414 const struct inode_operations ext2_special_inode_operations = { ··· 419 419 .removexattr = generic_removexattr, 420 420 #endif 421 421 .setattr = ext2_setattr, 422 - .check_acl = ext2_check_acl, 422 + .get_acl = ext2_get_acl, 423 423 };
+1 -18
fs/ext3/acl.c
··· 131 131 * 132 132 * inode->i_mutex: don't care 133 133 */ 134 - static struct posix_acl * 134 + struct posix_acl * 135 135 ext3_get_acl(struct inode *inode, int type) 136 136 { 137 137 int name_index; ··· 237 237 set_cached_acl(inode, type, acl); 238 238 239 239 return error; 240 - } 241 - 242 - int 243 - ext3_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 240 } 258 241 259 242 /*
+2 -2
fs/ext3/acl.h
··· 54 54 #ifdef CONFIG_EXT3_FS_POSIX_ACL 55 55 56 56 /* acl.c */ 57 - extern int ext3_check_acl (struct inode *, int); 57 + extern struct posix_acl *ext3_get_acl(struct inode *inode, int type); 58 58 extern int ext3_acl_chmod (struct inode *); 59 59 extern int ext3_init_acl (handle_t *, struct inode *, struct inode *); 60 60 61 61 #else /* CONFIG_EXT3_FS_POSIX_ACL */ 62 62 #include <linux/sched.h> 63 - #define ext3_check_acl NULL 63 + #define ext3_get_acl NULL 64 64 65 65 static inline int 66 66 ext3_acl_chmod(struct inode *inode)
+1 -1
fs/ext3/file.c
··· 79 79 .listxattr = ext3_listxattr, 80 80 .removexattr = generic_removexattr, 81 81 #endif 82 - .check_acl = ext3_check_acl, 82 + .get_acl = ext3_get_acl, 83 83 .fiemap = ext3_fiemap, 84 84 }; 85 85
+2 -2
fs/ext3/namei.c
··· 2529 2529 .listxattr = ext3_listxattr, 2530 2530 .removexattr = generic_removexattr, 2531 2531 #endif 2532 - .check_acl = ext3_check_acl, 2532 + .get_acl = ext3_get_acl, 2533 2533 }; 2534 2534 2535 2535 const struct inode_operations ext3_special_inode_operations = { ··· 2540 2540 .listxattr = ext3_listxattr, 2541 2541 .removexattr = generic_removexattr, 2542 2542 #endif 2543 - .check_acl = ext3_check_acl, 2543 + .get_acl = ext3_get_acl, 2544 2544 };
+1 -18
fs/ext4/acl.c
··· 131 131 * 132 132 * inode->i_mutex: don't care 133 133 */ 134 - static struct posix_acl * 134 + struct posix_acl * 135 135 ext4_get_acl(struct inode *inode, int type) 136 136 { 137 137 int name_index; ··· 235 235 set_cached_acl(inode, type, acl); 236 236 237 237 return error; 238 - } 239 - 240 - int 241 - ext4_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 238 } 256 239 257 240 /*
+2 -2
fs/ext4/acl.h
··· 54 54 #ifdef CONFIG_EXT4_FS_POSIX_ACL 55 55 56 56 /* acl.c */ 57 - extern int ext4_check_acl(struct inode *, int); 57 + struct posix_acl *ext4_get_acl(struct inode *inode, int type); 58 58 extern int ext4_acl_chmod(struct inode *); 59 59 extern int ext4_init_acl(handle_t *, struct inode *, struct inode *); 60 60 61 61 #else /* CONFIG_EXT4_FS_POSIX_ACL */ 62 62 #include <linux/sched.h> 63 - #define ext4_check_acl NULL 63 + #define ext4_get_acl NULL 64 64 65 65 static inline int 66 66 ext4_acl_chmod(struct inode *inode)
+1 -1
fs/ext4/file.c
··· 301 301 .listxattr = ext4_listxattr, 302 302 .removexattr = generic_removexattr, 303 303 #endif 304 - .check_acl = ext4_check_acl, 304 + .get_acl = ext4_get_acl, 305 305 .fiemap = ext4_fiemap, 306 306 }; 307 307
+2 -2
fs/ext4/namei.c
··· 2590 2590 .listxattr = ext4_listxattr, 2591 2591 .removexattr = generic_removexattr, 2592 2592 #endif 2593 - .check_acl = ext4_check_acl, 2593 + .get_acl = ext4_get_acl, 2594 2594 .fiemap = ext4_fiemap, 2595 2595 }; 2596 2596 ··· 2602 2602 .listxattr = ext4_listxattr, 2603 2603 .removexattr = generic_removexattr, 2604 2604 #endif 2605 - .check_acl = ext4_check_acl, 2605 + .get_acl = ext4_get_acl, 2606 2606 };
-14
fs/generic_acl.c
··· 172 172 return error; 173 173 } 174 174 175 - int 176 - generic_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 - 189 175 const struct xattr_handler generic_acl_access_handler = { 190 176 .prefix = POSIX_ACL_XATTR_ACCESS, 191 177 .flags = ACL_TYPE_ACCESS,
+2 -23
fs/gfs2/acl.c
··· 67 67 return acl; 68 68 } 69 69 70 - /** 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 - 78 - int gfs2_check_acl(struct inode *inode, int mask) 70 + struct posix_acl *gfs2_get_acl(struct inode *inode, int type) 79 71 { 80 - struct posix_acl *acl; 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; 72 + return gfs2_acl_get(GFS2_I(inode), type); 94 73 } 95 74 96 75 static int gfs2_set_mode(struct inode *inode, mode_t mode)
+1 -1
fs/gfs2/acl.h
··· 16 16 #define GFS2_POSIX_ACL_DEFAULT "posix_acl_default" 17 17 #define GFS2_ACL_MAX_ENTRIES 25 18 18 19 - extern int gfs2_check_acl(struct inode *inode, int mask); 19 + extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type); 20 20 extern int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode); 21 21 extern int gfs2_acl_chmod(struct gfs2_inode *ip, struct iattr *attr); 22 22 extern const struct xattr_handler gfs2_xattr_system_handler;
+3 -3
fs/gfs2/inode.c
··· 1846 1846 .listxattr = gfs2_listxattr, 1847 1847 .removexattr = gfs2_removexattr, 1848 1848 .fiemap = gfs2_fiemap, 1849 - .check_acl = gfs2_check_acl, 1849 + .get_acl = gfs2_get_acl, 1850 1850 }; 1851 1851 1852 1852 const struct inode_operations gfs2_dir_iops = { ··· 1867 1867 .listxattr = gfs2_listxattr, 1868 1868 .removexattr = gfs2_removexattr, 1869 1869 .fiemap = gfs2_fiemap, 1870 - .check_acl = gfs2_check_acl, 1870 + .get_acl = gfs2_get_acl, 1871 1871 }; 1872 1872 1873 1873 const struct inode_operations gfs2_symlink_iops = { ··· 1882 1882 .listxattr = gfs2_listxattr, 1883 1883 .removexattr = gfs2_removexattr, 1884 1884 .fiemap = gfs2_fiemap, 1885 - .check_acl = gfs2_check_acl, 1885 + .get_acl = gfs2_get_acl, 1886 1886 }; 1887 1887
+1 -17
fs/jffs2/acl.c
··· 156 156 return ERR_PTR(-EINVAL); 157 157 } 158 158 159 - static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 159 + struct posix_acl *jffs2_get_acl(struct inode *inode, int type) 160 160 { 161 161 struct posix_acl *acl; 162 162 char *value = NULL; ··· 257 257 if (!rc) 258 258 set_cached_acl(inode, type, acl); 259 259 return rc; 260 - } 261 - 262 - int 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 260 } 277 261 278 262 int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode)
+2 -2
fs/jffs2/acl.h
··· 26 26 27 27 #ifdef CONFIG_JFFS2_FS_POSIX_ACL 28 28 29 - extern int jffs2_check_acl(struct inode *, int); 29 + struct posix_acl *jffs2_get_acl(struct inode *inode, int type); 30 30 extern int jffs2_acl_chmod(struct inode *); 31 31 extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *); 32 32 extern int jffs2_init_acl_post(struct inode *); ··· 36 36 37 37 #else 38 38 39 - #define jffs2_check_acl (NULL) 39 + #define jffs2_get_acl (NULL) 40 40 #define jffs2_acl_chmod(inode) (0) 41 41 #define jffs2_init_acl_pre(dir_i,inode,mode) (0) 42 42 #define jffs2_init_acl_post(inode) (0)
+1 -1
fs/jffs2/dir.c
··· 56 56 .rmdir = jffs2_rmdir, 57 57 .mknod = jffs2_mknod, 58 58 .rename = jffs2_rename, 59 - .check_acl = jffs2_check_acl, 59 + .get_acl = jffs2_get_acl, 60 60 .setattr = jffs2_setattr, 61 61 .setxattr = jffs2_setxattr, 62 62 .getxattr = jffs2_getxattr,
+1 -1
fs/jffs2/file.c
··· 63 63 64 64 const struct inode_operations jffs2_file_inode_operations = 65 65 { 66 - .check_acl = jffs2_check_acl, 66 + .get_acl = jffs2_get_acl, 67 67 .setattr = jffs2_setattr, 68 68 .setxattr = jffs2_setxattr, 69 69 .getxattr = jffs2_getxattr,
+1 -1
fs/jffs2/symlink.c
··· 20 20 { 21 21 .readlink = generic_readlink, 22 22 .follow_link = jffs2_follow_link, 23 - .check_acl = jffs2_check_acl, 23 + .get_acl = jffs2_get_acl, 24 24 .setattr = jffs2_setattr, 25 25 .setxattr = jffs2_setxattr, 26 26 .getxattr = jffs2_getxattr,
+1 -17
fs/jfs/acl.c
··· 27 27 #include "jfs_xattr.h" 28 28 #include "jfs_acl.h" 29 29 30 - static struct posix_acl *jfs_get_acl(struct inode *inode, int type) 30 + struct posix_acl *jfs_get_acl(struct inode *inode, int type) 31 31 { 32 32 struct posix_acl *acl; 33 33 char *ea_name; ··· 112 112 set_cached_acl(inode, type, acl); 113 113 114 114 return rc; 115 - } 116 - 117 - int 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 115 } 132 116 133 117 int jfs_init_acl(tid_t tid, struct inode *inode, struct inode *dir)
+1 -1
fs/jfs/file.c
··· 140 140 .removexattr = jfs_removexattr, 141 141 .setattr = jfs_setattr, 142 142 #ifdef CONFIG_JFS_POSIX_ACL 143 - .check_acl = jfs_check_acl, 143 + .get_acl = jfs_get_acl, 144 144 #endif 145 145 }; 146 146
+1 -1
fs/jfs/jfs_acl.h
··· 20 20 21 21 #ifdef CONFIG_JFS_POSIX_ACL 22 22 23 - int jfs_check_acl(struct inode *, int); 23 + struct posix_acl *jfs_get_acl(struct inode *inode, int type); 24 24 int jfs_init_acl(tid_t, struct inode *, struct inode *); 25 25 int jfs_acl_chmod(struct inode *inode); 26 26
+1 -1
fs/jfs/namei.c
··· 1537 1537 .removexattr = jfs_removexattr, 1538 1538 .setattr = jfs_setattr, 1539 1539 #ifdef CONFIG_JFS_POSIX_ACL 1540 - .check_acl = jfs_check_acl, 1540 + .get_acl = jfs_get_acl, 1541 1541 #endif 1542 1542 }; 1543 1543
+13 -11
fs/namei.c
··· 196 196 acl = get_cached_acl(inode, ACL_TYPE_ACCESS); 197 197 198 198 /* 199 - * A filesystem can force a ACL callback by just never 200 - * filling the ACL cache. But normally you'd fill the 201 - * cache either at inode instantiation time, or on the 202 - * first ->check_acl call. 199 + * A filesystem can force a ACL callback by just never filling the 200 + * ACL cache. But normally you'd fill the cache either at inode 201 + * instantiation time, or on the first ->get_acl call. 203 202 * 204 - * If the filesystem doesn't have a check_acl() function 205 - * at all, we'll just create the negative cache entry. 203 + * If the filesystem doesn't have a get_acl() function at all, we'll 204 + * just create the negative cache entry. 206 205 */ 207 206 if (acl == ACL_NOT_CACHED) { 208 - if (inode->i_op->check_acl) 209 - return inode->i_op->check_acl(inode, mask); 210 - 211 - set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); 212 - return -EAGAIN; 207 + if (inode->i_op->get_acl) { 208 + acl = inode->i_op->get_acl(inode, ACL_TYPE_ACCESS); 209 + if (IS_ERR(acl)) 210 + return PTR_ERR(acl); 211 + } else { 212 + set_cached_acl(inode, ACL_TYPE_ACCESS, NULL); 213 + return -EAGAIN; 214 + } 213 215 } 214 216 215 217 if (acl) {
+6 -18
fs/ocfs2/acl.c
··· 290 290 return ret; 291 291 } 292 292 293 - int ocfs2_check_acl(struct inode *inode, int mask) 293 + struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type) 294 294 { 295 295 struct ocfs2_super *osb; 296 296 struct buffer_head *di_bh = NULL; ··· 299 299 300 300 osb = OCFS2_SB(inode->i_sb); 301 301 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) 302 - return ret; 302 + return NULL; 303 303 304 304 ret = ocfs2_read_inode_block(inode, &di_bh); 305 - if (ret < 0) { 306 - mlog_errno(ret); 307 - return ret; 308 - } 305 + if (ret < 0) 306 + return ERR_PTR(ret); 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 310 brelse(di_bh); 313 311 314 - if (IS_ERR(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; 312 + return acl; 325 313 } 326 314 327 315 int ocfs2_acl_chmod(struct inode *inode)
+1 -1
fs/ocfs2/acl.h
··· 26 26 __le32 e_id; 27 27 }; 28 28 29 - extern int ocfs2_check_acl(struct inode *, int); 29 + struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type); 30 30 extern int ocfs2_acl_chmod(struct inode *); 31 31 extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, 32 32 struct buffer_head *, struct buffer_head *,
+2 -2
fs/ocfs2/file.c
··· 2600 2600 .listxattr = ocfs2_listxattr, 2601 2601 .removexattr = generic_removexattr, 2602 2602 .fiemap = ocfs2_fiemap, 2603 - .check_acl = ocfs2_check_acl, 2603 + .get_acl = ocfs2_iop_get_acl, 2604 2604 }; 2605 2605 2606 2606 const struct inode_operations ocfs2_special_file_iops = { 2607 2607 .setattr = ocfs2_setattr, 2608 2608 .getattr = ocfs2_getattr, 2609 2609 .permission = ocfs2_permission, 2610 - .check_acl = ocfs2_check_acl, 2610 + .get_acl = ocfs2_iop_get_acl, 2611 2611 }; 2612 2612 2613 2613 /*
+1 -1
fs/ocfs2/namei.c
··· 2498 2498 .listxattr = ocfs2_listxattr, 2499 2499 .removexattr = generic_removexattr, 2500 2500 .fiemap = ocfs2_fiemap, 2501 - .check_acl = ocfs2_check_acl, 2501 + .get_acl = ocfs2_iop_get_acl, 2502 2502 };
-1
fs/posix_acl.c
··· 27 27 EXPORT_SYMBOL(posix_acl_valid); 28 28 EXPORT_SYMBOL(posix_acl_equiv_mode); 29 29 EXPORT_SYMBOL(posix_acl_from_mode); 30 - EXPORT_SYMBOL(posix_acl_permission); 31 30 32 31 /* 33 32 * Init a fresh posix_acl
+1 -1
fs/reiserfs/file.c
··· 319 319 .listxattr = reiserfs_listxattr, 320 320 .removexattr = reiserfs_removexattr, 321 321 .permission = reiserfs_permission, 322 - .check_acl = reiserfs_check_acl, 322 + .get_acl = reiserfs_get_acl, 323 323 };
+3 -3
fs/reiserfs/namei.c
··· 1529 1529 .listxattr = reiserfs_listxattr, 1530 1530 .removexattr = reiserfs_removexattr, 1531 1531 .permission = reiserfs_permission, 1532 - .check_acl = reiserfs_check_acl, 1532 + .get_acl = reiserfs_get_acl, 1533 1533 }; 1534 1534 1535 1535 /* ··· 1546 1546 .listxattr = reiserfs_listxattr, 1547 1547 .removexattr = reiserfs_removexattr, 1548 1548 .permission = reiserfs_permission, 1549 - .check_acl = reiserfs_check_acl, 1549 + .get_acl = reiserfs_get_acl, 1550 1550 1551 1551 }; 1552 1552 ··· 1560 1560 .listxattr = reiserfs_listxattr, 1561 1561 .removexattr = reiserfs_removexattr, 1562 1562 .permission = reiserfs_permission, 1563 - .check_acl = reiserfs_check_acl, 1563 + .get_acl = reiserfs_get_acl, 1564 1564 };
-18
fs/reiserfs/xattr.c
··· 867 867 return err; 868 868 } 869 869 870 - int 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 - 888 870 static int create_privroot(struct dentry *dentry) 889 871 { 890 872 int err;
+2 -19
fs/xfs/linux-2.6/xfs_acl.c
··· 114 114 if (acl != ACL_NOT_CACHED) 115 115 return acl; 116 116 117 + trace_xfs_get_acl(ip); 118 + 117 119 switch (type) { 118 120 case ACL_TYPE_ACCESS: 119 121 ea_name = SGI_ACL_FILE; ··· 217 215 218 216 if (!error) 219 217 set_cached_acl(inode, type, acl); 220 - return error; 221 - } 222 - 223 - int 224 - xfs_check_acl(struct inode *inode, int mask) 225 - { 226 - struct posix_acl *acl; 227 - int error = -EAGAIN; 228 - 229 - trace_xfs_check_acl(XFS_I(inode)); 230 - 231 - acl = xfs_get_acl(inode, ACL_TYPE_ACCESS); 232 - if (IS_ERR(acl)) 233 - return PTR_ERR(acl); 234 - if (acl) { 235 - error = posix_acl_permission(inode, acl, mask); 236 - posix_acl_release(acl); 237 - } 238 - 239 218 return error; 240 219 } 241 220
+4 -4
fs/xfs/linux-2.6/xfs_iops.c
··· 1022 1022 } 1023 1023 1024 1024 static const struct inode_operations xfs_inode_operations = { 1025 - .check_acl = xfs_check_acl, 1025 + .get_acl = xfs_get_acl, 1026 1026 .getattr = xfs_vn_getattr, 1027 1027 .setattr = xfs_vn_setattr, 1028 1028 .setxattr = generic_setxattr, ··· 1048 1048 .rmdir = xfs_vn_unlink, 1049 1049 .mknod = xfs_vn_mknod, 1050 1050 .rename = xfs_vn_rename, 1051 - .check_acl = xfs_check_acl, 1051 + .get_acl = xfs_get_acl, 1052 1052 .getattr = xfs_vn_getattr, 1053 1053 .setattr = xfs_vn_setattr, 1054 1054 .setxattr = generic_setxattr, ··· 1073 1073 .rmdir = xfs_vn_unlink, 1074 1074 .mknod = xfs_vn_mknod, 1075 1075 .rename = xfs_vn_rename, 1076 - .check_acl = xfs_check_acl, 1076 + .get_acl = xfs_get_acl, 1077 1077 .getattr = xfs_vn_getattr, 1078 1078 .setattr = xfs_vn_setattr, 1079 1079 .setxattr = generic_setxattr, ··· 1086 1086 .readlink = generic_readlink, 1087 1087 .follow_link = xfs_vn_follow_link, 1088 1088 .put_link = xfs_vn_put_link, 1089 - .check_acl = xfs_check_acl, 1089 + .get_acl = xfs_get_acl, 1090 1090 .getattr = xfs_vn_getattr, 1091 1091 .setattr = xfs_vn_setattr, 1092 1092 .setxattr = generic_setxattr,
+1 -1
fs/xfs/linux-2.6/xfs_trace.h
··· 571 571 DEFINE_INODE_EVENT(xfs_free_file_space); 572 572 DEFINE_INODE_EVENT(xfs_readdir); 573 573 #ifdef CONFIG_XFS_POSIX_ACL 574 - DEFINE_INODE_EVENT(xfs_check_acl); 574 + DEFINE_INODE_EVENT(xfs_get_acl); 575 575 #endif 576 576 DEFINE_INODE_EVENT(xfs_vm_bmap); 577 577 DEFINE_INODE_EVENT(xfs_file_ioctl);
-2
fs/xfs/xfs_acl.h
··· 42 42 #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1) 43 43 44 44 #ifdef CONFIG_XFS_POSIX_ACL 45 - extern int xfs_check_acl(struct inode *inode, int mask); 46 45 extern struct posix_acl *xfs_get_acl(struct inode *inode, int type); 47 46 extern int xfs_inherit_acl(struct inode *inode, struct posix_acl *default_acl); 48 47 extern int xfs_acl_chmod(struct inode *inode); ··· 51 52 extern const struct xattr_handler xfs_xattr_acl_access_handler; 52 53 extern const struct xattr_handler xfs_xattr_acl_default_handler; 53 54 #else 54 - # define xfs_check_acl NULL 55 55 # define xfs_get_acl(inode, type) NULL 56 56 # define xfs_inherit_acl(inode, default_acl) 0 57 57 # define xfs_acl_chmod(inode) 0
+1 -1
include/linux/fs.h
··· 1586 1586 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1587 1587 void * (*follow_link) (struct dentry *, struct nameidata *); 1588 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 1591 int (*readlink) (struct dentry *, char __user *,int); 1592 1592 void (*put_link) (struct dentry *, struct nameidata *, void *);
-1
include/linux/generic_acl.h
··· 10 10 11 11 int generic_acl_init(struct inode *, struct inode *); 12 12 int generic_acl_chmod(struct inode *); 13 - int generic_check_acl(struct inode *inode, int mask); 14 13 15 14 #endif /* LINUX_GENERIC_ACL_H */
+1 -5
include/linux/reiserfs_acl.h
··· 59 59 #else 60 60 61 61 #define reiserfs_cache_default_acl(inode) 0 62 - 63 - static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) 64 - { 65 - return NULL; 66 - } 62 + #define reiserfs_get_acl NULL 67 63 68 64 static inline int reiserfs_acl_chmod(struct inode *inode) 69 65 {
-2
include/linux/reiserfs_xattr.h
··· 45 45 46 46 #ifdef CONFIG_REISERFS_FS_XATTR 47 47 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 48 - int reiserfs_check_acl(struct inode *inode, int mask); 49 48 ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 50 49 void *buffer, size_t size); 51 50 int reiserfs_setxattr(struct dentry *dentry, const char *name, ··· 122 123 #define reiserfs_setxattr NULL 123 124 #define reiserfs_listxattr NULL 124 125 #define reiserfs_removexattr NULL 125 - #define reiserfs_check_acl NULL 126 126 127 127 static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 128 128 {
-6
mm/shmem.c
··· 2715 2715 .listxattr = shmem_listxattr, 2716 2716 .removexattr = shmem_removexattr, 2717 2717 #endif 2718 - #ifdef CONFIG_TMPFS_POSIX_ACL 2719 - .check_acl = generic_check_acl, 2720 - #endif 2721 - 2722 2718 }; 2723 2719 2724 2720 static const struct inode_operations shmem_dir_inode_operations = { ··· 2737 2741 #endif 2738 2742 #ifdef CONFIG_TMPFS_POSIX_ACL 2739 2743 .setattr = shmem_setattr, 2740 - .check_acl = generic_check_acl, 2741 2744 #endif 2742 2745 }; 2743 2746 ··· 2749 2754 #endif 2750 2755 #ifdef CONFIG_TMPFS_POSIX_ACL 2751 2756 .setattr = shmem_setattr, 2752 - .check_acl = generic_check_acl, 2753 2757 #endif 2754 2758 }; 2755 2759