summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig2014-09-07 17:36:40 +0200
committerTrond Myklebust2014-09-10 21:47:04 +0200
commit08a899d5d9532efb7dea99aad44dc9af39627a92 (patch)
tree8dd3f17b0b9fecbe9581084b33e826c05ada405a /fs/nfs/inode.c
parentpnfs/blocklayout: use the device id cache (diff)
downloadkernel-qcow2-linux-08a899d5d9532efb7dea99aad44dc9af39627a92.tar.gz
kernel-qcow2-linux-08a899d5d9532efb7dea99aad44dc9af39627a92.tar.xz
kernel-qcow2-linux-08a899d5d9532efb7dea99aad44dc9af39627a92.zip
nfs: setattr can only change regular file sizes
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>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 577a36f0a510..141c9f4a40de 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -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;
}