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

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
...@@ -287,8 +287,8 @@ implementing on-disk size changes. Start with a copy of the old inode_setattr ...@@ -287,8 +287,8 @@ implementing on-disk size changes. Start with a copy of the old inode_setattr
and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to
be in order of zeroing blocks using block_truncate_page or similar helpers, be in order of zeroing blocks using block_truncate_page or similar helpers,
size update and on finally on-disk truncation which should not fail. size update and on finally on-disk truncation which should not fail.
inode_change_ok now includes the size checks for ATTR_SIZE and must be called setattr_prepare (which used to be inode_change_ok) now includes the size checks
in the beginning of ->setattr unconditionally. for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally.
[mandatory] [mandatory]
......
...@@ -1192,7 +1192,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) ...@@ -1192,7 +1192,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
attr->ia_valid |= ATTR_MTIME | ATTR_CTIME; attr->ia_valid |= ATTR_MTIME | ATTR_CTIME;
} }
/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */ /* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */
if (attr->ia_valid & TIMES_SET_FLAGS) { if (attr->ia_valid & TIMES_SET_FLAGS) {
if ((!uid_eq(current_fsuid(), inode->i_uid)) && if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
!capable(CFS_CAP_FOWNER)) !capable(CFS_CAP_FOWNER))
......
...@@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
struct p9_wstat wstat; struct p9_wstat wstat;
p9_debug(P9_DEBUG_VFS, "\n"); p9_debug(P9_DEBUG_VFS, "\n");
retval = inode_change_ok(d_inode(dentry), iattr); retval = setattr_prepare(dentry, iattr);
if (retval) if (retval)
return retval; return retval;
......
...@@ -558,7 +558,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) ...@@ -558,7 +558,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
p9_debug(P9_DEBUG_VFS, "\n"); p9_debug(P9_DEBUG_VFS, "\n");
retval = inode_change_ok(inode, iattr); retval = setattr_prepare(dentry, iattr);
if (retval) if (retval)
return retval; return retval;
......
...@@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr)
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
/* /*
* we can't change the UID or GID of any file - * we can't change the UID or GID of any file -
......
...@@ -219,7 +219,7 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -219,7 +219,7 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid); pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);
error = inode_change_ok(inode,attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
goto out; goto out;
......
...@@ -17,19 +17,22 @@ ...@@ -17,19 +17,22 @@
#include <linux/ima.h> #include <linux/ima.h>
/** /**
* inode_change_ok - check if attribute changes to an inode are allowed * setattr_prepare - check if attribute changes to a dentry are allowed
* @inode: inode to check * @dentry: dentry to check
* @attr: attributes to change * @attr: attributes to change
* *
* Check if we are allowed to change the attributes contained in @attr * Check if we are allowed to change the attributes contained in @attr
* in the given inode. This includes the normal unix access permission * in the given dentry. This includes the normal unix access permission
* checks, as well as checks for rlimits and others. * checks, as well as checks for rlimits and others. The function also clears
* SGID bit from mode if user is not allowed to set it. Also file capabilities
* and IMA extended attributes are cleared if ATTR_KILL_PRIV is set.
* *
* Should be called as the first thing in ->setattr implementations, * Should be called as the first thing in ->setattr implementations,
* possibly after taking additional locks. * possibly after taking additional locks.
*/ */
int inode_change_ok(const struct inode *inode, struct iattr *attr) int setattr_prepare(struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = d_inode(dentry);
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
/* /*
...@@ -79,7 +82,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr) ...@@ -79,7 +82,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
return 0; return 0;
} }
EXPORT_SYMBOL(inode_change_ok); EXPORT_SYMBOL(setattr_prepare);
/** /**
* inode_newsize_ok - may this inode be truncated to a given size * inode_newsize_ok - may this inode be truncated to a given size
......
...@@ -5042,7 +5042,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -5042,7 +5042,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
if (btrfs_root_readonly(root)) if (btrfs_root_readonly(root))
return -EROFS; return -EROFS;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -2123,7 +2123,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -2123,7 +2123,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
if (ceph_snap(inode) != CEPH_NOSNAP) if (ceph_snap(inode) != CEPH_NOSNAP)
return -EROFS; return -EROFS;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err != 0) if (err != 0)
return err; return err;
......
...@@ -2154,7 +2154,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) ...@@ -2154,7 +2154,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
attrs->ia_valid |= ATTR_FORCE; attrs->ia_valid |= ATTR_FORCE;
rc = inode_change_ok(inode, attrs); rc = setattr_prepare(direntry, attrs);
if (rc < 0) if (rc < 0)
goto out; goto out;
...@@ -2294,7 +2294,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) ...@@ -2294,7 +2294,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
attrs->ia_valid |= ATTR_FORCE; attrs->ia_valid |= ATTR_FORCE;
rc = inode_change_ok(inode, attrs); rc = setattr_prepare(direntry, attrs);
if (rc < 0) { if (rc < 0) {
free_xid(xid); free_xid(xid);
return rc; return rc;
......
...@@ -927,7 +927,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) ...@@ -927,7 +927,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
} }
mutex_unlock(&crypt_stat->cs_mutex); mutex_unlock(&crypt_stat->cs_mutex);
rc = inode_change_ok(inode, ia); rc = setattr_prepare(dentry, ia);
if (rc) if (rc)
goto out; goto out;
if (ia->ia_valid & ATTR_SIZE) { if (ia->ia_valid & ATTR_SIZE) {
......
...@@ -1034,7 +1034,7 @@ int exofs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -1034,7 +1034,7 @@ int exofs_setattr(struct dentry *dentry, struct iattr *iattr)
if (unlikely(error)) if (unlikely(error))
return error; return error;
error = inode_change_ok(inode, iattr); error = setattr_prepare(dentry, iattr);
if (unlikely(error)) if (unlikely(error))
return error; return error;
......
...@@ -1580,7 +1580,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -1580,7 +1580,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, iattr); error = setattr_prepare(dentry, iattr);
if (error) if (error)
return error; return error;
......
...@@ -5073,7 +5073,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -5073,7 +5073,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
int orphan = 0; int orphan = 0;
const unsigned int ia_valid = attr->ia_valid; const unsigned int ia_valid = attr->ia_valid;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -680,7 +680,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -680,7 +680,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int err; int err;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -450,7 +450,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -450,7 +450,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
attr->ia_valid &= ~TIMES_SET_FLAGS; attr->ia_valid &= ~TIMES_SET_FLAGS;
} }
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
attr->ia_valid = ia_valid; attr->ia_valid = ia_valid;
if (error) { if (error) {
if (sbi->options.quiet) if (sbi->options.quiet)
......
...@@ -1609,7 +1609,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, ...@@ -1609,7 +1609,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS)) if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
attr->ia_valid |= ATTR_FORCE; attr->ia_valid |= ATTR_FORCE;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -1932,7 +1932,7 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -1932,7 +1932,7 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out; goto out;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
goto out; goto out;
......
...@@ -605,7 +605,7 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr) ...@@ -605,7 +605,7 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
int error; int error;
error = inode_change_ok(inode, attr); /* basic permission checks */ error = setattr_prepare(dentry, attr); /* basic permission checks */
if (error) if (error)
return error; return error;
......
...@@ -245,7 +245,7 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -245,7 +245,7 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -812,7 +812,7 @@ static int hostfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -812,7 +812,7 @@ static int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
int fd = HOSTFS_I(inode)->fd; int fd = HOSTFS_I(inode)->fd;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -273,7 +273,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -273,7 +273,7 @@ int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
goto out_unlock; goto out_unlock;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
goto out_unlock; goto out_unlock;
......
...@@ -672,7 +672,7 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -672,7 +672,7 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
BUG_ON(!inode); BUG_ON(!inode);
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -193,7 +193,7 @@ int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -193,7 +193,7 @@ int jffs2_setattr(struct dentry *dentry, struct iattr *iattr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int rc; int rc;
rc = inode_change_ok(inode, iattr); rc = setattr_prepare(dentry, iattr);
if (rc) if (rc)
return rc; return rc;
......
...@@ -103,7 +103,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -103,7 +103,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int rc; int rc;
rc = inode_change_ok(inode, iattr); rc = setattr_prepare(dentry, iattr);
if (rc) if (rc)
return rc; return rc;
......
...@@ -122,7 +122,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -122,7 +122,7 @@ int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr)
return -EINVAL; return -EINVAL;
mutex_lock(&kernfs_mutex); mutex_lock(&kernfs_mutex);
error = inode_change_ok(inode, iattr); error = setattr_prepare(dentry, iattr);
if (error) if (error)
goto out; goto out;
......
...@@ -394,7 +394,7 @@ int simple_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -394,7 +394,7 @@ int simple_setattr(struct dentry *dentry, struct iattr *iattr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, iattr); error = setattr_prepare(dentry, iattr);
if (error) if (error)
return error; return error;
......
...@@ -244,7 +244,7 @@ static int logfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -244,7 +244,7 @@ static int logfs_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int err = 0; int err = 0;
err = inode_change_ok(inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -26,7 +26,7 @@ static int minix_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -26,7 +26,7 @@ static int minix_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -884,7 +884,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -884,7 +884,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
/* ageing the dentry to force validation */ /* ageing the dentry to force validation */
ncp_age_dentry(server, dentry); ncp_age_dentry(server, dentry);
result = inode_change_ok(inode, attr); result = setattr_prepare(dentry, attr);
if (result < 0) if (result < 0)
goto out; goto out;
......
...@@ -74,10 +74,10 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, ...@@ -74,10 +74,10 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
* which only requires access, and "set-[ac]time-to-X" which * which only requires access, and "set-[ac]time-to-X" which
* requires ownership. * requires ownership.
* So if it looks like it might be "set both to the same time which * So if it looks like it might be "set both to the same time which
* is close to now", and if inode_change_ok fails, then we * is close to now", and if setattr_prepare fails, then we
* convert to "set to now" instead of "set to explicit time" * convert to "set to now" instead of "set to explicit time"
* *
* We only call inode_change_ok as the last test as technically * We only call setattr_prepare as the last test as technically
* it is not an interface that we should be using. * it is not an interface that we should be using.
*/ */
#define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET) #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
...@@ -92,17 +92,15 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, ...@@ -92,17 +92,15 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp,
* request is. We require it be within 30 minutes of now. * request is. We require it be within 30 minutes of now.
*/ */
time_t delta = iap->ia_atime.tv_sec - get_seconds(); time_t delta = iap->ia_atime.tv_sec - get_seconds();
struct inode *inode;
nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); nfserr = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP);
if (nfserr) if (nfserr)
goto done; goto done;
inode = d_inode(fhp->fh_dentry);
if (delta < 0) if (delta < 0)
delta = -delta; delta = -delta;
if (delta < MAX_TOUCH_TIME_ERROR && if (delta < MAX_TOUCH_TIME_ERROR &&
inode_change_ok(inode, iap) != 0) { setattr_prepare(fhp->fh_dentry, iap) != 0) {
/* /*
* Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME.
* This will cause notify_change to set these times * This will cause notify_change to set these times
......
...@@ -829,7 +829,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -829,7 +829,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
int err; int err;
err = inode_change_ok(inode, iattr); err = setattr_prepare(dentry, iattr);
if (err) if (err)
return err; return err;
......
...@@ -2893,7 +2893,7 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -2893,7 +2893,7 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
int err; int err;
unsigned int ia_valid = attr->ia_valid; unsigned int ia_valid = attr->ia_valid;
err = inode_change_ok(vi, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
goto out; goto out;
/* We do not support NTFS ACLs yet. */ /* We do not support NTFS ACLs yet. */
......
...@@ -211,7 +211,7 @@ static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -211,7 +211,7 @@ static int dlmfs_file_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
attr->ia_valid &= ~ATTR_SIZE; attr->ia_valid &= ~ATTR_SIZE;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -1155,7 +1155,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -1155,7 +1155,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) if (!(attr->ia_valid & OCFS2_VALID_ATTRS))
return 0; return 0;
status = inode_change_ok(inode, attr); status = setattr_prepare(dentry, attr);
if (status) if (status)
return status; return status;
......
...@@ -349,7 +349,7 @@ static int omfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -349,7 +349,7 @@ static int omfs_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -219,7 +219,7 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr) ...@@ -219,7 +219,7 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr)
"orangefs_setattr: called on %s\n", "orangefs_setattr: called on %s\n",
dentry->d_name.name); dentry->d_name.name);
ret = inode_change_ok(inode, iattr); ret = setattr_prepare(dentry, iattr);
if (ret) if (ret)
goto out; goto out;
......
...@@ -52,7 +52,7 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -52,7 +52,7 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr)
* inode_newsize_ok() will always check against MAX_LFS_FILESIZE and not * inode_newsize_ok() will always check against MAX_LFS_FILESIZE and not
* check for a swapfile (which this won't be anyway). * check for a swapfile (which this won't be anyway).
*/ */
err = inode_change_ok(dentry->d_inode, attr); err = setattr_prepare(dentry, attr);
if (err) if (err)
return err; return err;
......
...@@ -709,7 +709,7 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -709,7 +709,7 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
if (attr->ia_valid & ATTR_MODE) if (attr->ia_valid & ATTR_MODE)
return -EPERM; return -EPERM;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -105,7 +105,7 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) ...@@ -105,7 +105,7 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
struct proc_dir_entry *de = PDE(inode); struct proc_dir_entry *de = PDE(inode);
int error; int error;
error = inode_change_ok(inode, iattr); error = setattr_prepare(dentry, iattr);
if (error) if (error)
return error; return error;
......
...@@ -754,7 +754,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -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)) if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
return -EPERM; return -EPERM;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -169,7 +169,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) ...@@ -169,7 +169,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
int ret = 0; int ret = 0;
/* POSIX UID/GID verification for setting inode attributes */ /* POSIX UID/GID verification for setting inode attributes */
ret = inode_change_ok(inode, ia); ret = setattr_prepare(dentry, ia);
if (ret) if (ret)
return ret; return ret;
......
...@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
unsigned int ia_valid; unsigned int ia_valid;
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -33,7 +33,7 @@ static int sysv_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -33,7 +33,7 @@ static int sysv_setattr(struct dentry *dentry, struct iattr *attr)
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
int error; int error;
error = inode_change_ok(inode, attr); error = setattr_prepare(dentry, attr);
if (error) if (error)
return error; return error;
......
...@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr)