Skip to content

Commit 1d5ccd1

Browse files
committed
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>
1 parent 6d848a4 commit 1d5ccd1

12 files changed

Lines changed: 18 additions & 36 deletions

File tree

‎fs/ext2/acl.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
230230
return error;
231231
}
232232

233-
static int
233+
int
234234
ext2_check_acl(struct inode *inode, int mask)
235235
{
236236
struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
@@ -246,12 +246,6 @@ ext2_check_acl(struct inode *inode, int mask)
246246
return -EAGAIN;
247247
}
248248

249-
int
250-
ext2_permission(struct inode *inode, int mask)
251-
{
252-
return generic_permission(inode, mask, ext2_check_acl);
253-
}
254-
255249
/*
256250
* Initialize the ACLs of a new inode. Called from ext2_new_inode.
257251
*

‎fs/ext2/acl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size)
5454
#ifdef CONFIG_EXT2_FS_POSIX_ACL
5555

5656
/* acl.c */
57-
extern int ext2_permission (struct inode *, int);
57+
extern int ext2_check_acl (struct inode *, int);
5858
extern int ext2_acl_chmod (struct inode *);
5959
extern int ext2_init_acl (struct inode *, struct inode *);
6060

6161
#else
6262
#include <linux/sched.h>
63-
#define ext2_permission NULL
63+
#define ext2_check_acl NULL
6464
#define ext2_get_acl NULL
6565
#define ext2_set_acl NULL
6666

‎fs/ext2/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ const struct inode_operations ext2_file_inode_operations = {
8585
.removexattr = generic_removexattr,
8686
#endif
8787
.setattr = ext2_setattr,
88-
.permission = ext2_permission,
88+
.check_acl = ext2_check_acl,
8989
.fiemap = ext2_fiemap,
9090
};

‎fs/ext2/namei.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ const struct inode_operations ext2_dir_inode_operations = {
400400
.removexattr = generic_removexattr,
401401
#endif
402402
.setattr = ext2_setattr,
403-
.permission = ext2_permission,
403+
.check_acl = ext2_check_acl,
404404
};
405405

406406
const struct inode_operations ext2_special_inode_operations = {
@@ -411,5 +411,5 @@ const struct inode_operations ext2_special_inode_operations = {
411411
.removexattr = generic_removexattr,
412412
#endif
413413
.setattr = ext2_setattr,
414-
.permission = ext2_permission,
414+
.check_acl = ext2_check_acl,
415415
};

‎fs/ext3/acl.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
238238
return error;
239239
}
240240

241-
static int
241+
int
242242
ext3_check_acl(struct inode *inode, int mask)
243243
{
244244
struct posix_acl *acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
@@ -254,12 +254,6 @@ ext3_check_acl(struct inode *inode, int mask)
254254
return -EAGAIN;
255255
}
256256

257-
int
258-
ext3_permission(struct inode *inode, int mask)
259-
{
260-
return generic_permission(inode, mask, ext3_check_acl);
261-
}
262-
263257
/*
264258
* Initialize the ACLs of a new inode. Called from ext3_new_inode.
265259
*

‎fs/ext3/acl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size)
5454
#ifdef CONFIG_EXT3_FS_POSIX_ACL
5555

5656
/* acl.c */
57-
extern int ext3_permission (struct inode *, int);
57+
extern int ext3_check_acl (struct inode *, int);
5858
extern int ext3_acl_chmod (struct inode *);
5959
extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
6060

6161
#else /* CONFIG_EXT3_FS_POSIX_ACL */
6262
#include <linux/sched.h>
63-
#define ext3_permission NULL
63+
#define ext3_check_acl NULL
6464

6565
static inline int
6666
ext3_acl_chmod(struct inode *inode)

‎fs/ext3/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const struct inode_operations ext3_file_inode_operations = {
137137
.listxattr = ext3_listxattr,
138138
.removexattr = generic_removexattr,
139139
#endif
140-
.permission = ext3_permission,
140+
.check_acl = ext3_check_acl,
141141
.fiemap = ext3_fiemap,
142142
};
143143

‎fs/ext3/namei.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,7 @@ const struct inode_operations ext3_dir_inode_operations = {
24452445
.listxattr = ext3_listxattr,
24462446
.removexattr = generic_removexattr,
24472447
#endif
2448-
.permission = ext3_permission,
2448+
.check_acl = ext3_check_acl,
24492449
};
24502450

24512451
const struct inode_operations ext3_special_inode_operations = {
@@ -2456,5 +2456,5 @@ const struct inode_operations ext3_special_inode_operations = {
24562456
.listxattr = ext3_listxattr,
24572457
.removexattr = generic_removexattr,
24582458
#endif
2459-
.permission = ext3_permission,
2459+
.check_acl = ext3_check_acl,
24602460
};

‎fs/ext4/acl.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
236236
return error;
237237
}
238238

239-
static int
239+
int
240240
ext4_check_acl(struct inode *inode, int mask)
241241
{
242242
struct posix_acl *acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
@@ -252,12 +252,6 @@ ext4_check_acl(struct inode *inode, int mask)
252252
return -EAGAIN;
253253
}
254254

255-
int
256-
ext4_permission(struct inode *inode, int mask)
257-
{
258-
return generic_permission(inode, mask, ext4_check_acl);
259-
}
260-
261255
/*
262256
* Initialize the ACLs of a new inode. Called from ext4_new_inode.
263257
*

‎fs/ext4/acl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size)
5454
#ifdef CONFIG_EXT4_FS_POSIX_ACL
5555

5656
/* acl.c */
57-
extern int ext4_permission(struct inode *, int);
57+
extern int ext4_check_acl(struct inode *, int);
5858
extern int ext4_acl_chmod(struct inode *);
5959
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
6060

6161
#else /* CONFIG_EXT4_FS_POSIX_ACL */
6262
#include <linux/sched.h>
63-
#define ext4_permission NULL
63+
#define ext4_check_acl NULL
6464

6565
static inline int
6666
ext4_acl_chmod(struct inode *inode)

0 commit comments

Comments
 (0)