diff options
author | Wang Shilong <wshilong@ddn.com> | 2016-07-05 21:33:52 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-07-05 21:33:52 -0400 |
commit | 079788d01e7ba9d7366d7bd2a0db9cab5944e85b (patch) | |
tree | edadef9bd88b7f49d8304bf23ce705feacd14409 /fs/ext4 | |
parent | 5b9554dc5bf008ae7f68a52e3d7e76c0920938a2 (diff) |
ext4: fix project quota accounting without quota limits enabled
We should always transfer quota accounting, regardless of whether
quota limits are enabled.
Steps to reproduce:
# mkfs.ext4 /dev/sda4 -O quota,project
# mount /dev/sda4 /mnt/test
# cp /bin/bash /mnt/test
# chattr -p 123 /mnt/test/bash
# quota -v -P 123
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ioctl.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 28cc412852af..b5a39b00265e 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -308,6 +308,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) | |||
308 | kprojid_t kprojid; | 308 | kprojid_t kprojid; |
309 | struct ext4_iloc iloc; | 309 | struct ext4_iloc iloc; |
310 | struct ext4_inode *raw_inode; | 310 | struct ext4_inode *raw_inode; |
311 | struct dquot *transfer_to[MAXQUOTAS] = { }; | ||
311 | 312 | ||
312 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, | 313 | if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, |
313 | EXT4_FEATURE_RO_COMPAT_PROJECT)) { | 314 | EXT4_FEATURE_RO_COMPAT_PROJECT)) { |
@@ -361,17 +362,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) | |||
361 | if (err) | 362 | if (err) |
362 | goto out_stop; | 363 | goto out_stop; |
363 | 364 | ||
364 | if (sb_has_quota_limits_enabled(sb, PRJQUOTA)) { | 365 | transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); |
365 | struct dquot *transfer_to[MAXQUOTAS] = { }; | 366 | if (!IS_ERR(transfer_to[PRJQUOTA])) { |
366 | 367 | err = __dquot_transfer(inode, transfer_to); | |
367 | transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); | 368 | dqput(transfer_to[PRJQUOTA]); |
368 | if (!IS_ERR(transfer_to[PRJQUOTA])) { | 369 | if (err) |
369 | err = __dquot_transfer(inode, transfer_to); | 370 | goto out_dirty; |
370 | dqput(transfer_to[PRJQUOTA]); | ||
371 | if (err) | ||
372 | goto out_dirty; | ||
373 | } | ||
374 | } | 371 | } |
372 | |||
375 | EXT4_I(inode)->i_projid = kprojid; | 373 | EXT4_I(inode)->i_projid = kprojid; |
376 | inode->i_ctime = ext4_current_time(inode); | 374 | inode->i_ctime = ext4_current_time(inode); |
377 | out_dirty: | 375 | out_dirty: |