aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-31 12:54:47 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:06 -0500
commit0f235caeaed6bbde6d455e172a83fa693ca485a1 (patch)
tree90432fca4f845a698eea199c1f49ffc6936a3689 /fs/9p
parent7f165aaa7dc898472f3b3fbf2231bb3b5623a3df (diff)
9p: switch v9fs_set_acl() from dentry to fid
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/acl.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index c5d8cd638e6e..506d8af26a1f 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -23,6 +23,7 @@
23#include "acl.h" 23#include "acl.h"
24#include "v9fs.h" 24#include "v9fs.h"
25#include "v9fs_vfs.h" 25#include "v9fs_vfs.h"
26#include "fid.h"
26 27
27static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name) 28static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
28{ 29{
@@ -113,7 +114,7 @@ struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
113 114
114} 115}
115 116
116static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl) 117static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
117{ 118{
118 int retval; 119 int retval;
119 char *name; 120 char *name;
@@ -140,7 +141,7 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
140 default: 141 default:
141 BUG(); 142 BUG();
142 } 143 }
143 retval = v9fs_xattr_set(dentry, name, buffer, size, 0); 144 retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0);
144err_free_out: 145err_free_out:
145 kfree(buffer); 146 kfree(buffer);
146 return retval; 147 return retval;
@@ -151,16 +152,19 @@ int v9fs_acl_chmod(struct dentry *dentry)
151 int retval = 0; 152 int retval = 0;
152 struct posix_acl *acl; 153 struct posix_acl *acl;
153 struct inode *inode = dentry->d_inode; 154 struct inode *inode = dentry->d_inode;
155 struct p9_fid *fid = v9fs_fid_lookup(dentry);
154 156
155 if (S_ISLNK(inode->i_mode)) 157 if (S_ISLNK(inode->i_mode))
156 return -EOPNOTSUPP; 158 return -EOPNOTSUPP;
159 if (IS_ERR(fid))
160 return PTR_ERR(fid);
157 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS); 161 acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
158 if (acl) { 162 if (acl) {
159 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); 163 retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
160 if (retval) 164 if (retval)
161 return retval; 165 return retval;
162 set_cached_acl(inode, ACL_TYPE_ACCESS, acl); 166 set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
163 retval = v9fs_set_acl(dentry, ACL_TYPE_ACCESS, acl); 167 retval = v9fs_set_acl(fid, ACL_TYPE_ACCESS, acl);
164 posix_acl_release(acl); 168 posix_acl_release(acl);
165 } 169 }
166 return retval; 170 return retval;
@@ -170,10 +174,13 @@ int v9fs_set_create_acl(struct dentry *dentry,
170 struct posix_acl **dpacl, struct posix_acl **pacl) 174 struct posix_acl **dpacl, struct posix_acl **pacl)
171{ 175{
172 if (dentry) { 176 if (dentry) {
177 struct p9_fid *fid = v9fs_fid_lookup(dentry);
173 set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, *dpacl); 178 set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, *dpacl);
174 v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl);
175 set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, *pacl); 179 set_cached_acl(dentry->d_inode, ACL_TYPE_ACCESS, *pacl);
176 v9fs_set_acl(dentry, ACL_TYPE_ACCESS, *pacl); 180 if (!IS_ERR(fid)) {
181 v9fs_set_acl(fid, ACL_TYPE_DEFAULT, *dpacl);
182 v9fs_set_acl(fid, ACL_TYPE_ACCESS, *pacl);
183 }
177 } 184 }
178 posix_acl_release(*dpacl); 185 posix_acl_release(*dpacl);
179 posix_acl_release(*pacl); 186 posix_acl_release(*pacl);