Skip to content

Commit 5fa6300

Browse files
author
Al Viro
committed
9p: split dropping the acls from v9fs_set_create_acl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent be308f0 commit 5fa6300

3 files changed

Lines changed: 28 additions & 21 deletions

File tree

‎fs/9p/acl.c‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,23 +167,25 @@ int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
167167
}
168168

169169
int v9fs_set_create_acl(struct dentry *dentry,
170-
struct posix_acl **dpacl, struct posix_acl **pacl)
170+
struct posix_acl *dacl, struct posix_acl *acl)
171171
{
172-
if (dentry) {
173-
struct p9_fid *fid = v9fs_fid_lookup(dentry);
174-
set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, *dpacl);
175-
set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, *pacl);
176-
if (!IS_ERR(fid)) {
177-
v9fs_set_acl(fid, ACL_TYPE_DEFAULT, *dpacl);
178-
v9fs_set_acl(fid, ACL_TYPE_ACCESS, *pacl);
179-
}
172+
struct p9_fid *fid = v9fs_fid_lookup(dentry);
173+
set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, dacl);
174+
set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, acl);
175+
if (!IS_ERR(fid)) {
176+
v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
177+
v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
180178
}
181-
posix_acl_release(*dpacl);
182-
posix_acl_release(*pacl);
183-
*dpacl = *pacl = NULL;
184179
return 0;
185180
}
186181

182+
void v9fs_put_acl(struct posix_acl *dacl,
183+
struct posix_acl *acl)
184+
{
185+
posix_acl_release(dacl);
186+
posix_acl_release(acl);
187+
}
188+
187189
int v9fs_acl_mode(struct inode *dir, umode_t *modep,
188190
struct posix_acl **dpacl, struct posix_acl **pacl)
189191
{

‎fs/9p/acl.h‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ extern int v9fs_get_acl(struct inode *, struct p9_fid *);
1919
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
2020
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
2121
extern int v9fs_set_create_acl(struct dentry *,
22-
struct posix_acl **, struct posix_acl **);
22+
struct posix_acl *, struct posix_acl *);
2323
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
2424
struct posix_acl **dpacl, struct posix_acl **pacl);
25+
extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
2526
#else
2627
#define v9fs_iop_get_acl NULL
2728
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
@@ -33,11 +34,15 @@ static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
3334
return 0;
3435
}
3536
static inline int v9fs_set_create_acl(struct dentry *dentry,
36-
struct posix_acl **dpacl,
37-
struct posix_acl **pacl)
37+
struct posix_acl *dacl,
38+
struct posix_acl *acl)
3839
{
3940
return 0;
4041
}
42+
static inline void v9fs_put_acl(struct posix_acl *dacl,
43+
struct posix_acl *acl)
44+
{
45+
}
4146
static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep,
4247
struct posix_acl **dpacl,
4348
struct posix_acl **pacl)

‎fs/9p/vfs_inode_dotl.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
331331
d_instantiate(dentry, inode);
332332

333333
/* Now set the ACL based on the default value */
334-
v9fs_set_create_acl(dentry, &dacl, &pacl);
334+
v9fs_set_create_acl(dentry, dacl, pacl);
335335

336336
v9inode = V9FS_I(inode);
337337
mutex_lock(&v9inode->v_mutex);
@@ -364,6 +364,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
364364
#endif
365365
*opened |= FILE_CREATED;
366366
out:
367+
v9fs_put_acl(dacl, pacl);
367368
dput(res);
368369
return err;
369370

@@ -373,7 +374,6 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
373374
err_clunk_old_fid:
374375
if (ofid)
375376
p9_client_clunk(ofid);
376-
v9fs_set_create_acl(NULL, &dacl, &pacl);
377377
goto out;
378378
}
379379

@@ -467,13 +467,13 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
467467
d_instantiate(dentry, inode);
468468
}
469469
/* Now set the ACL based on the default value */
470-
v9fs_set_create_acl(dentry, &dacl, &pacl);
470+
v9fs_set_create_acl(dentry, dacl, pacl);
471471
inc_nlink(dir);
472472
v9fs_invalidate_inode_attr(dir);
473473
error:
474474
if (fid)
475475
p9_client_clunk(fid);
476-
v9fs_set_create_acl(NULL, &dacl, &pacl);
476+
v9fs_put_acl(dacl, pacl);
477477
return err;
478478
}
479479

@@ -912,11 +912,11 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
912912
d_instantiate(dentry, inode);
913913
}
914914
/* Now set the ACL based on the default value */
915-
v9fs_set_create_acl(dentry, &dacl, &pacl);
915+
v9fs_set_create_acl(dentry, dacl, pacl);
916916
error:
917917
if (fid)
918918
p9_client_clunk(fid);
919-
v9fs_set_create_acl(NULL, &dacl, &pacl);
919+
v9fs_put_acl(dacl, pacl);
920920
return err;
921921
}
922922

0 commit comments

Comments
 (0)