Skip to content

Commit 0f235ca

Browse files
author
Al Viro
committed
9p: switch v9fs_set_acl() from dentry to fid
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 7f165aa commit 0f235ca

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎fs/9p/acl.c‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "acl.h"
2424
#include "v9fs.h"
2525
#include "v9fs_vfs.h"
26+
#include "fid.h"
2627

2728
static struct posix_acl *__v9fs_get_acl(struct p9_fid *fid, char *name)
2829
{
@@ -113,7 +114,7 @@ struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
113114

114115
}
115116

116-
static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
117+
static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
117118
{
118119
int retval;
119120
char *name;
@@ -140,7 +141,7 @@ static int v9fs_set_acl(struct dentry *dentry, int type, struct posix_acl *acl)
140141
default:
141142
BUG();
142143
}
143-
retval = v9fs_xattr_set(dentry, name, buffer, size, 0);
144+
retval = v9fs_fid_xattr_set(fid, name, buffer, size, 0);
144145
err_free_out:
145146
kfree(buffer);
146147
return retval;
@@ -151,16 +152,19 @@ int v9fs_acl_chmod(struct dentry *dentry)
151152
int retval = 0;
152153
struct posix_acl *acl;
153154
struct inode *inode = dentry->d_inode;
155+
struct p9_fid *fid = v9fs_fid_lookup(dentry);
154156

155157
if (S_ISLNK(inode->i_mode))
156158
return -EOPNOTSUPP;
159+
if (IS_ERR(fid))
160+
return PTR_ERR(fid);
157161
acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
158162
if (acl) {
159163
retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
160164
if (retval)
161165
return retval;
162166
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);
164168
posix_acl_release(acl);
165169
}
166170
return retval;
@@ -170,10 +174,13 @@ int v9fs_set_create_acl(struct dentry *dentry,
170174
struct posix_acl **dpacl, struct posix_acl **pacl)
171175
{
172176
if (dentry) {
177+
struct p9_fid *fid = v9fs_fid_lookup(dentry);
173178
set_cached_acl(dentry->d_inode, ACL_TYPE_DEFAULT, *dpacl);
174-
v9fs_set_acl(dentry, ACL_TYPE_DEFAULT, *dpacl);
175179
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+
}
177184
}
178185
posix_acl_release(*dpacl);
179186
posix_acl_release(*pacl);

0 commit comments

Comments
 (0)