diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-31 13:31:23 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-26 02:46:06 -0500 |
commit | 5fa6300ae0ccf76018775ea16bc3a061cadc39a6 (patch) | |
tree | c3f8ade583a33039a057a6257edc5c8b57d5411d /fs/9p | |
parent | be308f07964a597ea1806a0c02477a383b92f53a (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.c | 26 | ||||
-rw-r--r-- | fs/9p/acl.h | 11 | ||||
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 12 |
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 | ||
169 | int v9fs_set_create_acl(struct dentry *dentry, | 169 | 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) |
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 | ||
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 | |||
187 | int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 189 | int 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 *); | |||
19 | extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); | 19 | extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type); |
20 | extern int v9fs_acl_chmod(struct inode *, struct p9_fid *); | 20 | extern int v9fs_acl_chmod(struct inode *, struct p9_fid *); |
21 | extern int v9fs_set_create_acl(struct dentry *, | 21 | extern int v9fs_set_create_acl(struct dentry *, |
22 | struct posix_acl **, struct posix_acl **); | 22 | struct posix_acl *, struct posix_acl *); |
23 | extern int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 23 | extern 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); |
25 | extern 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 |
27 | static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) | 28 | 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) | |||
33 | return 0; | 34 | return 0; |
34 | } | 35 | } |
35 | static inline int v9fs_set_create_acl(struct dentry *dentry, | 36 | static 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 | } |
42 | static inline void v9fs_put_acl(struct posix_acl *dacl, | ||
43 | struct posix_acl *acl) | ||
44 | { | ||
45 | } | ||
41 | static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep, | 46 | static 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; |
366 | out: | 366 | out: |
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: | |||
373 | err_clunk_old_fid: | 374 | err_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); |
473 | error: | 473 | error: |
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); |
916 | error: | 916 | error: |
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 | ||