Skip to content

Commit 079788d

Browse files
Wang Shilongtytso
authored andcommitted
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>
1 parent 5b9554d commit 079788d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

‎fs/ext4/ioctl.c‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
308308
kprojid_t kprojid;
309309
struct ext4_iloc iloc;
310310
struct ext4_inode *raw_inode;
311+
struct dquot *transfer_to[MAXQUOTAS] = { };
311312

312313
if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
313314
EXT4_FEATURE_RO_COMPAT_PROJECT)) {
@@ -361,17 +362,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
361362
if (err)
362363
goto out_stop;
363364

364-
if (sb_has_quota_limits_enabled(sb, PRJQUOTA)) {
365-
struct dquot *transfer_to[MAXQUOTAS] = { };
366-
367-
transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
368-
if (!IS_ERR(transfer_to[PRJQUOTA])) {
369-
err = __dquot_transfer(inode, transfer_to);
370-
dqput(transfer_to[PRJQUOTA]);
371-
if (err)
372-
goto out_dirty;
373-
}
365+
transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
366+
if (!IS_ERR(transfer_to[PRJQUOTA])) {
367+
err = __dquot_transfer(inode, transfer_to);
368+
dqput(transfer_to[PRJQUOTA]);
369+
if (err)
370+
goto out_dirty;
374371
}
372+
375373
EXT4_I(inode)->i_projid = kprojid;
376374
inode->i_ctime = ext4_current_time(inode);
377375
out_dirty:

0 commit comments

Comments
 (0)