aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 3b58ad65d26c..0a43505eeaec 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -767,6 +767,10 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
767 loff_t newsize = attr->ia_size; 767 loff_t newsize = attr->ia_size;
768 int error; 768 int error;
769 769
770 error = inode_change_ok(inode, attr);
771 if (error)
772 return error;
773
770 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE) 774 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)
771 && newsize != inode->i_size) { 775 && newsize != inode->i_size) {
772 struct page *page = NULL; 776 struct page *page = NULL;
@@ -809,11 +813,9 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
809 shmem_truncate_range(inode, newsize, (loff_t)-1); 813 shmem_truncate_range(inode, newsize, (loff_t)-1);
810 } 814 }
811 815
812 error = inode_change_ok(inode, attr); 816 setattr_copy(inode, attr);
813 if (!error)
814 setattr_copy(inode, attr);
815#ifdef CONFIG_TMPFS_POSIX_ACL 817#ifdef CONFIG_TMPFS_POSIX_ACL
816 if (!error && (attr->ia_valid & ATTR_MODE)) 818 if (attr->ia_valid & ATTR_MODE)
817 error = generic_acl_chmod(inode); 819 error = generic_acl_chmod(inode);
818#endif 820#endif
819 return error; 821 return error;