Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[cascardo/linux.git] / fs / ceph / inode.c
index e70b4f5..da00b11 100644 (file)
@@ -1899,13 +1899,6 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
        int inode_dirty_flags = 0;
        bool lock_snap_rwsem = false;
 
-       if (ceph_snap(inode) != CEPH_NOSNAP)
-               return -EROFS;
-
-       err = inode_change_ok(inode, attr);
-       if (err != 0)
-               return err;
-
        prealloc_cf = ceph_alloc_cap_flush();
        if (!prealloc_cf)
                return -ENOMEM;
@@ -2118,7 +2111,17 @@ out_put:
  */
 int ceph_setattr(struct dentry *dentry, struct iattr *attr)
 {
-       return __ceph_setattr(d_inode(dentry), attr);
+       struct inode *inode = d_inode(dentry);
+       int err;
+
+       if (ceph_snap(inode) != CEPH_NOSNAP)
+               return -EROFS;
+
+       err = setattr_prepare(dentry, attr);
+       if (err != 0)
+               return err;
+
+       return __ceph_setattr(inode, attr);
 }
 
 /*