diff options
-rw-r--r-- | fs/ext2/inode.c | 2 | ||||
-rw-r--r-- | mm/shmem.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 19214435b752..3675088cb88c 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -1552,7 +1552,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) | |||
1552 | if (error) | 1552 | if (error) |
1553 | return error; | 1553 | return error; |
1554 | } | 1554 | } |
1555 | if (iattr->ia_valid & ATTR_SIZE) { | 1555 | if (iattr->ia_valid & ATTR_SIZE && iattr->ia_size != inode->i_size) { |
1556 | error = ext2_setsize(inode, iattr->ia_size); | 1556 | error = ext2_setsize(inode, iattr->ia_size); |
1557 | if (error) | 1557 | if (error) |
1558 | return error; | 1558 | return error; |
diff --git a/mm/shmem.c b/mm/shmem.c index 7e5030ae18ff..f65f84062db5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -764,10 +764,11 @@ done2: | |||
764 | static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) | 764 | static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) |
765 | { | 765 | { |
766 | struct inode *inode = dentry->d_inode; | 766 | struct inode *inode = dentry->d_inode; |
767 | loff_t newsize = attr->ia_size; | ||
767 | int error; | 768 | int error; |
768 | 769 | ||
769 | if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { | 770 | if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE) |
770 | loff_t newsize = attr->ia_size; | 771 | && newsize != inode->i_size) { |
771 | struct page *page = NULL; | 772 | struct page *page = NULL; |
772 | 773 | ||
773 | if (newsize < inode->i_size) { | 774 | if (newsize < inode->i_size) { |