Skip to content

Commit 06b16e9

Browse files
author
Al Viro
committed
switch shmem to inode->i_acl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 281eede commit 06b16e9

3 files changed

Lines changed: 10 additions & 36 deletions

File tree

‎include/linux/shmem_fs.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ struct shmem_inode_info {
1919
swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */
2020
struct list_head swaplist; /* chain of maybes on swap */
2121
struct inode vfs_inode;
22-
#ifdef CONFIG_TMPFS_POSIX_ACL
23-
struct posix_acl *i_acl;
24-
struct posix_acl *i_default_acl;
25-
#endif
2622
};
2723

2824
struct shmem_sb_info {
@@ -45,7 +41,6 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
4541
#ifdef CONFIG_TMPFS_POSIX_ACL
4642
int shmem_permission(struct inode *, int);
4743
int shmem_acl_init(struct inode *, struct inode *);
48-
void shmem_acl_destroy_inode(struct inode *);
4944

5045
extern struct xattr_handler shmem_xattr_acl_access_handler;
5146
extern struct xattr_handler shmem_xattr_acl_default_handler;
@@ -57,9 +52,6 @@ static inline int shmem_acl_init(struct inode *inode, struct inode *dir)
5752
{
5853
return 0;
5954
}
60-
static inline void shmem_acl_destroy_inode(struct inode *inode)
61-
{
62-
}
6355
#endif /* CONFIG_TMPFS_POSIX_ACL */
6456

6557
#endif

‎mm/shmem.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,6 +2379,10 @@ static struct inode *shmem_alloc_inode(struct super_block *sb)
23792379
p = (struct shmem_inode_info *)kmem_cache_alloc(shmem_inode_cachep, GFP_KERNEL);
23802380
if (!p)
23812381
return NULL;
2382+
#ifdef CONFIG_TMPFS_POSIX_ACL
2383+
p->vfs_inode.i_acl = NULL;
2384+
p->vfs_inode.i_default_acl = NULL;
2385+
#endif
23822386
return &p->vfs_inode;
23832387
}
23842388

@@ -2388,7 +2392,6 @@ static void shmem_destroy_inode(struct inode *inode)
23882392
/* only struct inode is valid if it's an inline symlink */
23892393
mpol_free_shared_policy(&SHMEM_I(inode)->policy);
23902394
}
2391-
shmem_acl_destroy_inode(inode);
23922395
kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
23932396
}
23942397

@@ -2397,10 +2400,6 @@ static void init_once(void *foo)
23972400
struct shmem_inode_info *p = (struct shmem_inode_info *) foo;
23982401

23992402
inode_init_once(&p->vfs_inode);
2400-
#ifdef CONFIG_TMPFS_POSIX_ACL
2401-
p->i_acl = NULL;
2402-
p->i_default_acl = NULL;
2403-
#endif
24042403
}
24052404

24062405
static int init_inodecache(void)

‎mm/shmem_acl.c‎

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ shmem_get_acl(struct inode *inode, int type)
2222
spin_lock(&inode->i_lock);
2323
switch(type) {
2424
case ACL_TYPE_ACCESS:
25-
acl = posix_acl_dup(SHMEM_I(inode)->i_acl);
25+
acl = posix_acl_dup(inode->i_acl);
2626
break;
2727

2828
case ACL_TYPE_DEFAULT:
29-
acl = posix_acl_dup(SHMEM_I(inode)->i_default_acl);
29+
acl = posix_acl_dup(inode->i_default_acl);
3030
break;
3131
}
3232
spin_unlock(&inode->i_lock);
@@ -45,13 +45,13 @@ shmem_set_acl(struct inode *inode, int type, struct posix_acl *acl)
4545
spin_lock(&inode->i_lock);
4646
switch(type) {
4747
case ACL_TYPE_ACCESS:
48-
free = SHMEM_I(inode)->i_acl;
49-
SHMEM_I(inode)->i_acl = posix_acl_dup(acl);
48+
free = inode->i_acl;
49+
inode->i_acl = posix_acl_dup(acl);
5050
break;
5151

5252
case ACL_TYPE_DEFAULT:
53-
free = SHMEM_I(inode)->i_default_acl;
54-
SHMEM_I(inode)->i_default_acl = posix_acl_dup(acl);
53+
free = inode->i_default_acl;
54+
inode->i_default_acl = posix_acl_dup(acl);
5555
break;
5656
}
5757
spin_unlock(&inode->i_lock);
@@ -154,23 +154,6 @@ shmem_acl_init(struct inode *inode, struct inode *dir)
154154
return generic_acl_init(inode, dir, &shmem_acl_ops);
155155
}
156156

157-
/**
158-
* shmem_acl_destroy_inode - destroy acls hanging off the in-memory inode
159-
*
160-
* This is done before destroying the actual inode.
161-
*/
162-
163-
void
164-
shmem_acl_destroy_inode(struct inode *inode)
165-
{
166-
if (SHMEM_I(inode)->i_acl)
167-
posix_acl_release(SHMEM_I(inode)->i_acl);
168-
SHMEM_I(inode)->i_acl = NULL;
169-
if (SHMEM_I(inode)->i_default_acl)
170-
posix_acl_release(SHMEM_I(inode)->i_default_acl);
171-
SHMEM_I(inode)->i_default_acl = NULL;
172-
}
173-
174157
/**
175158
* shmem_check_acl - check_acl() callback for generic_permission()
176159
*/

0 commit comments

Comments
 (0)