diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 69254a365ce2..c806dfb24e08 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -559,9 +559,19 @@ static int proc_setattr(struct dentry *dentry, struct iattr *attr) | |||
559 | return -EPERM; | 559 | return -EPERM; |
560 | 560 | ||
561 | error = inode_change_ok(inode, attr); | 561 | error = inode_change_ok(inode, attr); |
562 | if (!error) | 562 | if (error) |
563 | error = inode_setattr(inode, attr); | 563 | return error; |
564 | return error; | 564 | |
565 | if ((attr->ia_valid & ATTR_SIZE) && | ||
566 | attr->ia_size != i_size_read(inode)) { | ||
567 | error = vmtruncate(inode, attr->ia_size); | ||
568 | if (error) | ||
569 | return error; | ||
570 | } | ||
571 | |||
572 | setattr_copy(inode, attr); | ||
573 | mark_inode_dirty(inode); | ||
574 | return 0; | ||
565 | } | 575 | } |
566 | 576 | ||
567 | static const struct inode_operations proc_def_inode_operations = { | 577 | static const struct inode_operations proc_def_inode_operations = { |