Commit 1d5ccd1c422d7d292a9e45248aa36771900c6331
1 parent
6d848a488a
Exists in
master
and in
7 other branches
ext[234]: move over to 'check_acl' permission model
Don't implement per-filesystem 'extX_permission()' functions that have to be called for every path component operation, and instead just expose the actual ACL checking so that the VFS layer can now do it for us. Reviewed-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 12 changed files with 18 additions and 36 deletions Side-by-side Diff
fs/ext2/acl.c
... | ... | @@ -230,7 +230,7 @@ |
230 | 230 | return error; |
231 | 231 | } |
232 | 232 | |
233 | -static int | |
233 | +int | |
234 | 234 | ext2_check_acl(struct inode *inode, int mask) |
235 | 235 | { |
236 | 236 | struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); |
... | ... | @@ -244,12 +244,6 @@ |
244 | 244 | } |
245 | 245 | |
246 | 246 | return -EAGAIN; |
247 | -} | |
248 | - | |
249 | -int | |
250 | -ext2_permission(struct inode *inode, int mask) | |
251 | -{ | |
252 | - return generic_permission(inode, mask, ext2_check_acl); | |
253 | 247 | } |
254 | 248 | |
255 | 249 | /* |
fs/ext2/acl.h
... | ... | @@ -54,13 +54,13 @@ |
54 | 54 | #ifdef CONFIG_EXT2_FS_POSIX_ACL |
55 | 55 | |
56 | 56 | /* acl.c */ |
57 | -extern int ext2_permission (struct inode *, int); | |
57 | +extern int ext2_check_acl (struct inode *, int); | |
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_permission NULL | |
63 | +#define ext2_check_acl NULL | |
64 | 64 | #define ext2_get_acl NULL |
65 | 65 | #define ext2_set_acl NULL |
66 | 66 |
fs/ext2/file.c
fs/ext2/namei.c
... | ... | @@ -400,7 +400,7 @@ |
400 | 400 | .removexattr = generic_removexattr, |
401 | 401 | #endif |
402 | 402 | .setattr = ext2_setattr, |
403 | - .permission = ext2_permission, | |
403 | + .check_acl = ext2_check_acl, | |
404 | 404 | }; |
405 | 405 | |
406 | 406 | const struct inode_operations ext2_special_inode_operations = { |
... | ... | @@ -411,6 +411,6 @@ |
411 | 411 | .removexattr = generic_removexattr, |
412 | 412 | #endif |
413 | 413 | .setattr = ext2_setattr, |
414 | - .permission = ext2_permission, | |
414 | + .check_acl = ext2_check_acl, | |
415 | 415 | }; |
fs/ext3/acl.c
... | ... | @@ -238,7 +238,7 @@ |
238 | 238 | return error; |
239 | 239 | } |
240 | 240 | |
241 | -static int | |
241 | +int | |
242 | 242 | ext3_check_acl(struct inode *inode, int mask) |
243 | 243 | { |
244 | 244 | struct posix_acl *acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); |
... | ... | @@ -252,12 +252,6 @@ |
252 | 252 | } |
253 | 253 | |
254 | 254 | return -EAGAIN; |
255 | -} | |
256 | - | |
257 | -int | |
258 | -ext3_permission(struct inode *inode, int mask) | |
259 | -{ | |
260 | - return generic_permission(inode, mask, ext3_check_acl); | |
261 | 255 | } |
262 | 256 | |
263 | 257 | /* |
fs/ext3/acl.h
... | ... | @@ -54,13 +54,13 @@ |
54 | 54 | #ifdef CONFIG_EXT3_FS_POSIX_ACL |
55 | 55 | |
56 | 56 | /* acl.c */ |
57 | -extern int ext3_permission (struct inode *, int); | |
57 | +extern int ext3_check_acl (struct inode *, int); | |
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_permission NULL | |
63 | +#define ext3_check_acl NULL | |
64 | 64 | |
65 | 65 | static inline int |
66 | 66 | ext3_acl_chmod(struct inode *inode) |
fs/ext3/file.c
fs/ext3/namei.c
... | ... | @@ -2445,7 +2445,7 @@ |
2445 | 2445 | .listxattr = ext3_listxattr, |
2446 | 2446 | .removexattr = generic_removexattr, |
2447 | 2447 | #endif |
2448 | - .permission = ext3_permission, | |
2448 | + .check_acl = ext3_check_acl, | |
2449 | 2449 | }; |
2450 | 2450 | |
2451 | 2451 | const struct inode_operations ext3_special_inode_operations = { |
... | ... | @@ -2456,6 +2456,6 @@ |
2456 | 2456 | .listxattr = ext3_listxattr, |
2457 | 2457 | .removexattr = generic_removexattr, |
2458 | 2458 | #endif |
2459 | - .permission = ext3_permission, | |
2459 | + .check_acl = ext3_check_acl, | |
2460 | 2460 | }; |
fs/ext4/acl.c
... | ... | @@ -236,7 +236,7 @@ |
236 | 236 | return error; |
237 | 237 | } |
238 | 238 | |
239 | -static int | |
239 | +int | |
240 | 240 | ext4_check_acl(struct inode *inode, int mask) |
241 | 241 | { |
242 | 242 | struct posix_acl *acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); |
... | ... | @@ -250,12 +250,6 @@ |
250 | 250 | } |
251 | 251 | |
252 | 252 | return -EAGAIN; |
253 | -} | |
254 | - | |
255 | -int | |
256 | -ext4_permission(struct inode *inode, int mask) | |
257 | -{ | |
258 | - return generic_permission(inode, mask, ext4_check_acl); | |
259 | 253 | } |
260 | 254 | |
261 | 255 | /* |
fs/ext4/acl.h
... | ... | @@ -54,13 +54,13 @@ |
54 | 54 | #ifdef CONFIG_EXT4_FS_POSIX_ACL |
55 | 55 | |
56 | 56 | /* acl.c */ |
57 | -extern int ext4_permission(struct inode *, int); | |
57 | +extern int ext4_check_acl(struct inode *, int); | |
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_permission NULL | |
63 | +#define ext4_check_acl NULL | |
64 | 64 | |
65 | 65 | static inline int |
66 | 66 | ext4_acl_chmod(struct inode *inode) |
fs/ext4/file.c
fs/ext4/namei.c
... | ... | @@ -2536,7 +2536,7 @@ |
2536 | 2536 | .listxattr = ext4_listxattr, |
2537 | 2537 | .removexattr = generic_removexattr, |
2538 | 2538 | #endif |
2539 | - .permission = ext4_permission, | |
2539 | + .check_acl = ext4_check_acl, | |
2540 | 2540 | .fiemap = ext4_fiemap, |
2541 | 2541 | }; |
2542 | 2542 | |
... | ... | @@ -2548,6 +2548,6 @@ |
2548 | 2548 | .listxattr = ext4_listxattr, |
2549 | 2549 | .removexattr = generic_removexattr, |
2550 | 2550 | #endif |
2551 | - .permission = ext4_permission, | |
2551 | + .check_acl = ext4_check_acl, | |
2552 | 2552 | }; |