nfs: setattr can only change regular file sizes
authorChristoph Hellwig <hch@lst.de>
Sun, 7 Sep 2014 15:36:40 +0000 (08:36 -0700)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 10 Sep 2014 19:47:04 +0000 (12:47 -0700)
The VFS never calls setattr with ATTR_SIZE on anything but regular
files.  Remove the if check and turn it into an assert similar to
what some other file systems do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/inode.c

index 577a36f0a510b27cefe15429523750b6d21ca45a..141c9f4a40de31b3237f50a4e5bf8d02e49cce80 100644 (file)
@@ -505,7 +505,9 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
                attr->ia_valid &= ~ATTR_MODE;
 
        if (attr->ia_valid & ATTR_SIZE) {
-               if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode))
+               BUG_ON(!S_ISREG(inode->i_mode));
+
+               if (attr->ia_size == i_size_read(inode))
                        attr->ia_valid &= ~ATTR_SIZE;
        }