aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-31 13:45:39 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:07 -0500
commit3592ac444017996f5a8ecf85856af0a8938e8fd1 (patch)
tree41a4d47c7181075c22b7cf0825d7587bebfeee0e /fs/9p
parent5fa6300ae0ccf76018775ea16bc3a061cadc39a6 (diff)
9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/acl.c13
-rw-r--r--fs/9p/acl.h5
-rw-r--r--fs/9p/vfs_inode_dotl.c50
3 files changed, 33 insertions, 35 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 5b91689ac0b1..7af425f53bee 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -166,16 +166,13 @@ int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
166 return retval; 166 return retval;
167} 167}
168 168
169int v9fs_set_create_acl(struct dentry *dentry, 169int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
170 struct posix_acl *dacl, struct posix_acl *acl) 170 struct posix_acl *dacl, struct posix_acl *acl)
171{ 171{
172 struct p9_fid *fid = v9fs_fid_lookup(dentry); 172 set_cached_acl(inode, ACL_TYPE_DEFAULT, dacl);
173 set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, dacl); 173 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
174 set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, acl); 174 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
175 if (!IS_ERR(fid)) { 175 v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
176 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, dacl);
177 v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
178 }
179 return 0; 176 return 0;
180} 177}
181 178
diff --git a/fs/9p/acl.h b/fs/9p/acl.h
index cb7fc54081f7..e4f7e882272b 100644
--- a/fs/9p/acl.h
+++ b/fs/9p/acl.h
@@ -18,7 +18,7 @@
18extern int v9fs_get_acl(struct inode *, struct p9_fid *); 18extern 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 inode *, struct p9_fid *,
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);
@@ -33,7 +33,8 @@ static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
33{ 33{
34 return 0; 34 return 0;
35} 35}
36static inline int v9fs_set_create_acl(struct dentry *dentry, 36static inline int v9fs_set_create_acl(struct inode *inode,
37 struct p9_fid *fid,
37 struct posix_acl *dacl, 38 struct posix_acl *dacl,
38 struct posix_acl *acl) 39 struct posix_acl *acl)
39{ 40{
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index dd6355721fc7..7c295588150c 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -325,14 +325,14 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
325 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); 325 p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
326 goto error; 326 goto error;
327 } 327 }
328 /* Now set the ACL based on the default value */
329 v9fs_set_create_acl(inode, fid, dacl, pacl);
330
328 err = v9fs_fid_add(dentry, fid); 331 err = v9fs_fid_add(dentry, fid);
329 if (err < 0) 332 if (err < 0)
330 goto error; 333 goto error;
331 d_instantiate(dentry, inode); 334 d_instantiate(dentry, inode);
332 335
333 /* Now set the ACL based on the default value */
334 v9fs_set_create_acl(dentry, dacl, pacl);
335
336 v9inode = V9FS_I(inode); 336 v9inode = V9FS_I(inode);
337 mutex_lock(&v9inode->v_mutex); 337 mutex_lock(&v9inode->v_mutex);
338 if (v9ses->cache && !v9inode->writeback_fid && 338 if (v9ses->cache && !v9inode->writeback_fid &&
@@ -430,17 +430,17 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
430 if (err < 0) 430 if (err < 0)
431 goto error; 431 goto error;
432 432
433 fid = p9_client_walk(dfid, 1, &name, 1);
434 if (IS_ERR(fid)) {
435 err = PTR_ERR(fid);
436 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
437 err);
438 fid = NULL;
439 goto error;
440 }
441
433 /* instantiate inode and assign the unopened fid to the dentry */ 442 /* instantiate inode and assign the unopened fid to the dentry */
434 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 443 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
435 fid = p9_client_walk(dfid, 1, &name, 1);
436 if (IS_ERR(fid)) {
437 err = PTR_ERR(fid);
438 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
439 err);
440 fid = NULL;
441 goto error;
442 }
443
444 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 444 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
445 if (IS_ERR(inode)) { 445 if (IS_ERR(inode)) {
446 err = PTR_ERR(inode); 446 err = PTR_ERR(inode);
@@ -451,6 +451,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
451 err = v9fs_fid_add(dentry, fid); 451 err = v9fs_fid_add(dentry, fid);
452 if (err < 0) 452 if (err < 0)
453 goto error; 453 goto error;
454 v9fs_set_create_acl(inode, fid, dacl, pacl);
454 d_instantiate(dentry, inode); 455 d_instantiate(dentry, inode);
455 fid = NULL; 456 fid = NULL;
456 } else { 457 } else {
@@ -464,10 +465,9 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
464 err = PTR_ERR(inode); 465 err = PTR_ERR(inode);
465 goto error; 466 goto error;
466 } 467 }
468 v9fs_set_create_acl(inode, fid, dacl, pacl);
467 d_instantiate(dentry, inode); 469 d_instantiate(dentry, inode);
468 } 470 }
469 /* Now set the ACL based on the default value */
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:
@@ -876,17 +876,17 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
876 goto error; 876 goto error;
877 877
878 v9fs_invalidate_inode_attr(dir); 878 v9fs_invalidate_inode_attr(dir);
879 fid = p9_client_walk(dfid, 1, &name, 1);
880 if (IS_ERR(fid)) {
881 err = PTR_ERR(fid);
882 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
883 err);
884 fid = NULL;
885 goto error;
886 }
887
879 /* instantiate inode and assign the unopened fid to the dentry */ 888 /* instantiate inode and assign the unopened fid to the dentry */
880 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 889 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
881 fid = p9_client_walk(dfid, 1, &name, 1);
882 if (IS_ERR(fid)) {
883 err = PTR_ERR(fid);
884 p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
885 err);
886 fid = NULL;
887 goto error;
888 }
889
890 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); 890 inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
891 if (IS_ERR(inode)) { 891 if (IS_ERR(inode)) {
892 err = PTR_ERR(inode); 892 err = PTR_ERR(inode);
@@ -894,6 +894,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
894 err); 894 err);
895 goto error; 895 goto error;
896 } 896 }
897 v9fs_set_create_acl(inode, fid, dacl, pacl);
897 err = v9fs_fid_add(dentry, fid); 898 err = v9fs_fid_add(dentry, fid);
898 if (err < 0) 899 if (err < 0)
899 goto error; 900 goto error;
@@ -909,10 +910,9 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode,
909 err = PTR_ERR(inode); 910 err = PTR_ERR(inode);
910 goto error; 911 goto error;
911 } 912 }
913 v9fs_set_create_acl(inode, fid, dacl, pacl);
912 d_instantiate(dentry, inode); 914 d_instantiate(dentry, inode);
913 } 915 }
914 /* Now set the ACL based on the default value */
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);