aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-31 13:31:23 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:06 -0500
commit5fa6300ae0ccf76018775ea16bc3a061cadc39a6 (patch)
treec3f8ade583a33039a057a6257edc5c8b57d5411d /fs/9p
parentbe308f07964a597ea1806a0c02477a383b92f53a (diff)
9p: split dropping the acls from v9fs_set_create_acl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/acl.c26
-rw-r--r--fs/9p/acl.h11
-rw-r--r--fs/9p/vfs_inode_dotl.c12
3 files changed, 28 insertions, 21 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 81ae143ff3f7..5b91689ac0b1 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -167,23 +167,25 @@ int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
167} 167}
168 168
169int v9fs_set_create_acl(struct dentry *dentry, 169int 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)
171{ 171{
172 if (dentry) { 172 struct p9_fid *fid = v9fs_fid_lookup(dentry);
173 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_DEFAULT, *dpacl); 174 set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, acl);
175 set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, *pacl); 175 if (!IS_ERR(fid)) {
176 if (!IS_ERR(fid)) { 176 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
177 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, *dpacl); 177 v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
178 v9fs_set_acl(fid, ACL_TYPE_ACCESS, *pacl);
179 }
180 } 178 }
181 posix_acl_release(*dpacl);
182 posix_acl_release(*pacl);
183 *dpacl = *pacl = NULL;
184 return 0; 179 return 0;
185} 180}
186 181
182void 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
187int v9fs_acl_mode(struct inode *dir, umode_t *modep, 189int v9fs_acl_mode(struct inode *dir, umode_t *modep,
188 struct posix_acl **dpacl, struct posix_acl **pacl) 190 struct posix_acl **dpacl, struct posix_acl **pacl)
189{ 191{
diff --git a/fs/9p/acl.h b/fs/9p/acl.h
index 3a609c57b6ea..cb7fc54081f7 100644
--- a/fs/9p/acl.h
+++ b/fs/9p/acl.h
@@ -19,9 +19,10 @@ extern int v9fs_get_acl(struct inode *, struct p9_fid *);
19extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); 19extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
20extern int v9fs_acl_chmod(struct inode *, struct p9_fid *); 20extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
21extern int v9fs_set_create_acl(struct dentry *, 21extern int v9fs_set_create_acl(struct dentry *,
22 struct posix_acl **, struct posix_acl **); 22 struct posix_acl *, struct posix_acl *);
23extern int v9fs_acl_mode(struct inode *dir, umode_t *modep, 23extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
24 struct posix_acl **dpacl, struct posix_acl **pacl); 24 struct posix_acl **dpacl, struct posix_acl **pacl);
25extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
25#else 26#else
26#define v9fs_iop_get_acl NULL 27#define v9fs_iop_get_acl NULL
27static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) 28static 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)
33 return 0; 34 return 0;
34} 35}
35static inline int v9fs_set_create_acl(struct dentry *dentry, 36static inline int v9fs_set_create_acl(struct dentry *dentry,
36 struct posix_acl **dpacl, 37 struct posix_acl *dacl,
37 struct posix_acl **pacl) 38 struct posix_acl *acl)
38{ 39{
39 return 0; 40 return 0;
40} 41}
42static inline void v9fs_put_acl(struct posix_acl *dacl,
43 struct posix_acl *acl)
44{
45}
41static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep, 46static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep,
42 struct posix_acl **dpacl, 47 struct posix_acl **dpacl,
43 struct posix_acl **pacl) 48 struct posix_acl **pacl)
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 44485f353f19..dd6355721fc7 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -331,7 +331,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
331 d_instantiate(dentry, inode); 331 d_instantiate(dentry, inode);
332 332
333 /* Now set the ACL based on the default value */ 333 /* 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);
335 335
336 v9inode = V9FS_I(inode); 336 v9inode = V9FS_I(inode);
337 mutex_lock(&v9inode->v_mutex); 337 mutex_lock(&v9inode->v_mutex);
@@ -364,6 +364,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
364#endif 364#endif
365 *opened |= FILE_CREATED; 365 *opened |= FILE_CREATED;
366out: 366out:
367 v9fs_put_acl(dacl, pacl);
367 dput(res); 368 dput(res);
368 return err; 369 return err;
369 370
@@ -373,7 +374,6 @@ error:
373err_clunk_old_fid: 374err_clunk_old_fid:
374 if (ofid) 375 if (ofid)
375 p9_client_clunk(ofid); 376 p9_client_clunk(ofid);
376 v9fs_set_create_acl(NULL, &dacl, &pacl);
377 goto out; 377 goto out;
378} 378}
379 379
@@ -467,13 +467,13 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
467 d_instantiate(dentry, inode); 467 d_instantiate(dentry, inode);
468 } 468 }
469 /* Now set the ACL based on the default value */ 469 /* 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);
471 inc_nlink(dir); 471 inc_nlink(dir);
472 v9fs_invalidate_inode_attr(dir); 472 v9fs_invalidate_inode_attr(dir);
473error: 473error:
474 if (fid) 474 if (fid)
475 p9_client_clunk(fid); 475 p9_client_clunk(fid);
476 v9fs_set_create_acl(NULL, &dacl, &pacl); 476 v9fs_put_acl(dacl, pacl);
477 return err; 477 return err;
478} 478}
479 479
@@ -912,11 +912,11 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
912 d_instantiate(dentry, inode); 912 d_instantiate(dentry, inode);
913 } 913 }
914 /* Now set the ACL based on the default value */ 914 /* 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);
916error: 916error:
917 if (fid) 917 if (fid)
918 p9_client_clunk(fid); 918 p9_client_clunk(fid);
919 v9fs_set_create_acl(NULL, &dacl, &pacl); 919 v9fs_put_acl(dacl, pacl);
920 return err; 920 return err;
921} 921}
922 922