Skip to content

Commit

Permalink
9p: switch v9fs_acl_chmod() from dentry to inode+fid
Browse files Browse the repository at this point in the history
caller has both, might as well pass them explicitly.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Feb 26, 2013
1 parent 0f235ca commit be308f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
6 changes: 1 addition & 5 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,13 @@ static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
return retval;
}

int v9fs_acl_chmod(struct dentry *dentry)
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
{
int retval = 0;
struct posix_acl *acl;
struct inode *inode = dentry->d_inode;
struct p9_fid *fid = v9fs_fid_lookup(dentry);

if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
if (IS_ERR(fid))
return PTR_ERR(fid);
acl = v9fs_get_cached_acl(inode, ACL_TYPE_ACCESS);
if (acl) {
retval = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
Expand Down
4 changes: 2 additions & 2 deletions fs/9p/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifdef CONFIG_9P_FS_POSIX_ACL
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
extern int v9fs_acl_chmod(struct dentry *);
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
extern int v9fs_set_create_acl(struct dentry *,
struct posix_acl **, struct posix_acl **);
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
Expand All @@ -28,7 +28,7 @@ static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
{
return 0;
}
static inline int v9fs_acl_chmod(struct dentry *dentry)
static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
{
return 0;
}
Expand Down
19 changes: 10 additions & 9 deletions fs/9p/vfs_inode_dotl.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,11 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
struct v9fs_session_info *v9ses;
struct p9_fid *fid;
struct p9_iattr_dotl p9attr;
struct inode *inode = dentry->d_inode;

p9_debug(P9_DEBUG_VFS, "\n");

retval = inode_change_ok(dentry->d_inode, iattr);
retval = inode_change_ok(inode, iattr);
if (retval)
return retval;

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

/* Write all dirty data */
if (S_ISREG(dentry->d_inode->i_mode))
filemap_write_and_wait(dentry->d_inode->i_mapping);
if (S_ISREG(inode->i_mode))
filemap_write_and_wait(inode->i_mapping);

retval = p9_client_setattr(fid, &p9attr);
if (retval < 0)
return retval;

if ((iattr->ia_valid & ATTR_SIZE) &&
iattr->ia_size != i_size_read(dentry->d_inode))
truncate_setsize(dentry->d_inode, iattr->ia_size);
iattr->ia_size != i_size_read(inode))
truncate_setsize(inode, iattr->ia_size);

v9fs_invalidate_inode_attr(dentry->d_inode);
setattr_copy(dentry->d_inode, iattr);
mark_inode_dirty(dentry->d_inode);
v9fs_invalidate_inode_attr(inode);
setattr_copy(inode, iattr);
mark_inode_dirty(inode);
if (iattr->ia_valid & ATTR_MODE) {
/* We also want to update ACL when we update mode bits */
retval = v9fs_acl_chmod(dentry);
retval = v9fs_acl_chmod(inode, fid);
if (retval < 0)
return retval;
}
Expand Down

0 comments on commit be308f0

Please sign in to comment.