Commit 31051c85 authored by Jan Kara's avatar Jan Kara
Browse files

fs: Give dentry to inode_change_ok() instead of inode



inode_change_ok() will be resposible for clearing capabilities and IMA
extended attributes and as such will need dentry. Give it as an argument
to inode_change_ok() instead of an inode. Also rename inode_change_ok()
to setattr_prepare() to better relect that it does also some
modifications in addition to checks.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 62490330
......@@ -754,7 +754,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
return -EPERM;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
......@@ -169,7 +169,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
int ret = 0;
/* POSIX UID/GID verification for setting inode attributes */
ret = inode_change_ok(inode, ia);
ret = setattr_prepare(dentry, ia);
if (ret)
return ret;
......
......@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
unsigned int ia_valid;
int error;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
......@@ -33,7 +33,7 @@ static int sysv_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry);
int error;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
......@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr)
dbg_gen("ino %lu, mode %#x, ia_valid %#x",
inode->i_ino, inode->i_mode, attr->ia_valid);
err = inode_change_ok(inode, attr);
err = setattr_prepare(dentry, attr);
if (err)
return err;
......
......@@ -261,7 +261,7 @@ static int udf_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry);
int error;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
......@@ -1208,7 +1208,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr)
unsigned int ia_valid = attr->ia_valid;
int error;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
......@@ -81,7 +81,7 @@ static int utimes_common(struct path *path, struct timespec *times)
newattrs.ia_valid |= ATTR_MTIME_SET;
}
/*
* Tell inode_change_ok(), that this is an explicit time
* Tell setattr_prepare(), that this is an explicit time
* update, even if neither ATTR_ATIME_SET nor ATTR_MTIME_SET
* were used.
*/
......@@ -90,7 +90,7 @@ static int utimes_common(struct path *path, struct timespec *times)
/*
* If times is NULL (or both times are UTIME_NOW),
* then we need to check permissions, because
* inode_change_ok() won't do it.
* setattr_prepare() won't do it.
*/
error = -EPERM;
if (IS_IMMUTABLE(inode))
......
......@@ -547,9 +547,7 @@ xfs_vn_change_ok(
struct dentry *dentry,
struct iattr *iattr)
{
struct inode *inode = d_inode(dentry);
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;
struct xfs_mount *mp = XFS_I(d_inode(dentry))->i_mount;
if (mp->m_flags & XFS_MOUNT_RDONLY)
return -EROFS;
......@@ -557,14 +555,14 @@ xfs_vn_change_ok(
if (XFS_FORCED_SHUTDOWN(mp))
return -EIO;
return inode_change_ok(inode, iattr);
return setattr_prepare(dentry, iattr);
}
/*
* Set non-size attributes of an inode.
*
* Caution: The caller of this function is responsible for calling
* inode_change_ok() or otherwise verifying the change is fine.
* setattr_prepare() or otherwise verifying the change is fine.
*/
int
xfs_setattr_nonsize(
......@@ -772,7 +770,7 @@ xfs_vn_setattr_nonsize(
* Truncate file. Must have write permission and not be a directory.
*
* Caution: The caller of this function is responsible for calling
* inode_change_ok() or otherwise verifying the change is fine.
* setattr_prepare() or otherwise verifying the change is fine.
*/
int
xfs_setattr_size(
......
......@@ -2994,7 +2994,7 @@ extern int buffer_migrate_page(struct address_space *,
#define buffer_migrate_page NULL
#endif
extern int inode_change_ok(const struct inode *, struct iattr *);
extern int setattr_prepare(struct dentry *, struct iattr *);
extern int inode_newsize_ok(const struct inode *, loff_t offset);
extern void setattr_copy(struct inode *inode, const struct iattr *attr);
......
......@@ -959,7 +959,7 @@ static int shmem_setattr(struct dentry *dentry, struct iattr *attr)
struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
int error;
error = inode_change_ok(inode, attr);
error = setattr_prepare(dentry, attr);
if (error)
return error;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment