Skip to content

Commit be308f0

Browse files
author
Al Viro
committed
9p: switch v9fs_acl_chmod() from dentry to inode+fid
caller has both, might as well pass them explicitly. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 0f235ca commit be308f0

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

‎fs/9p/acl.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,13 @@ static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
147147
return retval;
148148
}
149149

150-
int v9fs_acl_chmod(struct dentry *dentry)
150+
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
151151
{
152152
int retval = 0;
153153
struct posix_acl *acl;
154-
struct inode *inode = dentry->d_inode;
155-
struct p9_fid *fid = v9fs_fid_lookup(dentry);
156154

157155
if (S_ISLNK(inode->i_mode))
158156
return -EOPNOTSUPP;
159-
if (IS_ERR(fid))
160-
return PTR_ERR(fid);
161157
acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
162158
if (acl) {
163159
retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);

‎fs/9p/acl.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifdef CONFIG_9P_FS_POSIX_ACL
1818
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
1919
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
20-
extern int v9fs_acl_chmod(struct dentry *);
20+
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
2121
extern int v9fs_set_create_acl(struct dentry *,
2222
struct posix_acl **, struct posix_acl **);
2323
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
@@ -28,7 +28,7 @@ static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
2828
{
2929
return 0;
3030
}
31-
static inline int v9fs_acl_chmod(struct dentry *dentry)
31+
static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
3232
{
3333
return 0;
3434
}

‎fs/9p/vfs_inode_dotl.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
567567
struct v9fs_session_info *v9ses;
568568
struct p9_fid *fid;
569569
struct p9_iattr_dotl p9attr;
570+
struct inode *inode = dentry->d_inode;
570571

571572
p9_debug(P9_DEBUG_VFS, "\n");
572573

573-
retval = inode_change_ok(dentry->d_inode, iattr);
574+
retval = inode_change_ok(inode, iattr);
574575
if (retval)
575576
return retval;
576577

@@ -591,23 +592,23 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
591592
return PTR_ERR(fid);
592593

593594
/* Write all dirty data */
594-
if (S_ISREG(dentry->d_inode->i_mode))
595-
filemap_write_and_wait(dentry->d_inode->i_mapping);
595+
if (S_ISREG(inode->i_mode))
596+
filemap_write_and_wait(inode->i_mapping);
596597

597598
retval = p9_client_setattr(fid, &p9attr);
598599
if (retval < 0)
599600
return retval;
600601

601602
if ((iattr->ia_valid & ATTR_SIZE) &&
602-
iattr->ia_size != i_size_read(dentry->d_inode))
603-
truncate_setsize(dentry->d_inode, iattr->ia_size);
603+
iattr->ia_size != i_size_read(inode))
604+
truncate_setsize(inode, iattr->ia_size);
604605

605-
v9fs_invalidate_inode_attr(dentry->d_inode);
606-
setattr_copy(dentry->d_inode, iattr);
607-
mark_inode_dirty(dentry->d_inode);
606+
v9fs_invalidate_inode_attr(inode);
607+
setattr_copy(inode, iattr);
608+
mark_inode_dirty(inode);
608609
if (iattr->ia_valid & ATTR_MODE) {
609610
/* We also want to update ACL when we update mode bits */
610-
retval = v9fs_acl_chmod(dentry);
611+
retval = v9fs_acl_chmod(inode, fid);
611612
if (retval < 0)
612613
return retval;
613614
}

0 commit comments

Comments
 (0)