From cfa7ae7cabf15cb62cca2017ad55a9b89c53d665 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Fri, 12 Nov 2010 18:15:05 -0500 Subject: [PATCH] Wrapfs: handle maxbytes properly Signed-off-by: Erez Zadok --- fs/wrapfs/inode.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/wrapfs/inode.c b/fs/wrapfs/inode.c index e39869831b67..eba0883c0462 100644 --- a/fs/wrapfs/inode.c +++ b/fs/wrapfs/inode.c @@ -423,7 +423,6 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) struct dentry *lower_dentry; struct inode *inode; struct inode *lower_inode; - loff_t size; struct path lower_path; inode = dentry->d_inode; @@ -453,14 +452,10 @@ static int wrapfs_setattr(struct dentry *dentry, struct iattr *ia) * the lower level. */ if (ia->ia_valid & ATTR_SIZE) { - size = i_size_read(inode); - if (ia->ia_size < size || - (ia->ia_size > size && - inode->i_sb->s_maxbytes < lower_inode->i_sb->s_maxbytes)) { - err = vmtruncate(inode, ia->ia_size); - if (err) - goto out; - } + err = inode_newsize_ok(inode, ia->ia_size); + if (err) + goto out; + truncate_setsize(inode, ia->ia_size); } /* notify the (possibly copied-up) lower inode */ -- 2.43.0