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>
This commit is contained in:
committed by
Theodore Ts'o
parent
5b9554dc5b
commit
079788d01e
@@ -308,6 +308,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
|
|||||||
kprojid_t kprojid;
|
kprojid_t kprojid;
|
||||||
struct ext4_iloc iloc;
|
struct ext4_iloc iloc;
|
||||||
struct ext4_inode *raw_inode;
|
struct ext4_inode *raw_inode;
|
||||||
|
struct dquot *transfer_to[MAXQUOTAS] = { };
|
||||||
|
|
||||||
if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
|
if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
|
||||||
EXT4_FEATURE_RO_COMPAT_PROJECT)) {
|
EXT4_FEATURE_RO_COMPAT_PROJECT)) {
|
||||||
@@ -361,17 +362,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid)
|
|||||||
if (err)
|
if (err)
|
||||||
goto out_stop;
|
goto out_stop;
|
||||||
|
|
||||||
if (sb_has_quota_limits_enabled(sb, PRJQUOTA)) {
|
transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
|
||||||
struct dquot *transfer_to[MAXQUOTAS] = { };
|
if (!IS_ERR(transfer_to[PRJQUOTA])) {
|
||||||
|
err = __dquot_transfer(inode, transfer_to);
|
||||||
transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid));
|
dqput(transfer_to[PRJQUOTA]);
|
||||||
if (!IS_ERR(transfer_to[PRJQUOTA])) {
|
if (err)
|
||||||
err = __dquot_transfer(inode, transfer_to);
|
goto out_dirty;
|
||||||
dqput(transfer_to[PRJQUOTA]);
|
|
||||||
if (err)
|
|
||||||
goto out_dirty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXT4_I(inode)->i_projid = kprojid;
|
EXT4_I(inode)->i_projid = kprojid;
|
||||||
inode->i_ctime = ext4_current_time(inode);
|
inode->i_ctime = ext4_current_time(inode);
|
||||||
out_dirty:
|
out_dirty:
|
||||||
|
|||||||
Reference in New Issue
Block a user