diff options
Diffstat (limited to 'fs/ufs/truncate.c')
-rw-r--r-- | fs/ufs/truncate.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 41dd431ce228..d3b6270cb377 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/buffer_head.h> | 44 | #include <linux/buffer_head.h> |
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/sched.h> | 46 | #include <linux/sched.h> |
47 | #include <linux/quotaops.h> | ||
47 | 48 | ||
48 | #include "ufs_fs.h" | 49 | #include "ufs_fs.h" |
49 | #include "ufs.h" | 50 | #include "ufs.h" |
@@ -517,9 +518,18 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
517 | if (error) | 518 | if (error) |
518 | return error; | 519 | return error; |
519 | 520 | ||
521 | if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || | ||
522 | (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { | ||
523 | error = dquot_transfer(inode, attr); | ||
524 | if (error) | ||
525 | return error; | ||
526 | } | ||
520 | if (ia_valid & ATTR_SIZE && | 527 | if (ia_valid & ATTR_SIZE && |
521 | attr->ia_size != i_size_read(inode)) { | 528 | attr->ia_size != i_size_read(inode)) { |
522 | loff_t old_i_size = inode->i_size; | 529 | loff_t old_i_size = inode->i_size; |
530 | |||
531 | dquot_initialize(inode); | ||
532 | |||
523 | error = vmtruncate(inode, attr->ia_size); | 533 | error = vmtruncate(inode, attr->ia_size); |
524 | if (error) | 534 | if (error) |
525 | return error; | 535 | return error; |