All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nfs: setattr can only change regular file sizes
@ 2014-09-07 15:36 Christoph Hellwig
  2014-09-07 15:36 ` [PATCH 2/2] nfs: update time staps on truncate Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2014-09-07 15:36 UTC (permalink / raw)
  To: linux-nfs

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>
---
 fs/nfs/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 577a36f..141c9f4 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;
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-07 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07 15:36 [PATCH 1/2] nfs: setattr can only change regular file sizes Christoph Hellwig
2014-09-07 15:36 ` [PATCH 2/2] nfs: update time staps on truncate Christoph Hellwig
2014-09-07 16:41   ` Trond Myklebust
2014-09-07 16:57     ` Christoph Hellwig
2014-09-07 20:59       ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.