From b60f2e02db8dc79336d98f6ad6c74ca99582930b Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 5 Jul 2016 21:48:39 -0400 Subject: [PATCH] add patch fix-project-quota-accounting-without-limits-enabled --- ...project-quota-accounting-without-limits-enabled | 57 ++++++++++++++++++++++ series | 1 + timestamps | 7 +-- 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 fix-project-quota-accounting-without-limits-enabled diff --git a/fix-project-quota-accounting-without-limits-enabled b/fix-project-quota-accounting-without-limits-enabled new file mode 100644 index 00000000..d3ca1999 --- /dev/null +++ b/fix-project-quota-accounting-without-limits-enabled @@ -0,0 +1,57 @@ +ext4: fix project quota accounting without quota limits enabled + +From: Wang Shilong + +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 +Signed-off-by: Theodore Ts'o +--- + fs/ext4/ioctl.c | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c +index 28cc412..b5a39b0 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) + kprojid_t kprojid; + struct ext4_iloc iloc; + struct ext4_inode *raw_inode; ++ struct dquot *transfer_to[MAXQUOTAS] = { }; + + if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, + EXT4_FEATURE_RO_COMPAT_PROJECT)) { +@@ -361,17 +362,14 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) + if (err) + goto out_stop; + +- if (sb_has_quota_limits_enabled(sb, PRJQUOTA)) { +- struct dquot *transfer_to[MAXQUOTAS] = { }; +- +- transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); +- if (!IS_ERR(transfer_to[PRJQUOTA])) { +- err = __dquot_transfer(inode, transfer_to); +- dqput(transfer_to[PRJQUOTA]); +- if (err) +- goto out_dirty; +- } ++ transfer_to[PRJQUOTA] = dqget(sb, make_kqid_projid(kprojid)); ++ if (!IS_ERR(transfer_to[PRJQUOTA])) { ++ err = __dquot_transfer(inode, transfer_to); ++ dqput(transfer_to[PRJQUOTA]); ++ if (err) ++ goto out_dirty; + } ++ + EXT4_I(inode)->i_projid = kprojid; + inode->i_ctime = ext4_current_time(inode); + out_dirty: diff --git a/series b/series index 94208a9b..1faad939 100644 --- a/series +++ b/series @@ -18,6 +18,7 @@ fix-warn-on-once-in-ext4_commit_super dont-call-ext4_should_journal_data-on-journal-inode remove-unused-page_idx validate-reserved_gdt_blocks-on-mount +fix-project-quota-accounting-without-limits-enabled ########################################## # unstable patches diff --git a/timestamps b/timestamps index 4ce108fa..b5f9c1d0 100755 --- a/timestamps +++ b/timestamps @@ -47,6 +47,7 @@ touch -d @1467642292 fix-warn-on-once-in-ext4_commit_super touch -d @1467644580 dont-call-ext4_should_journal_data-on-journal-inode touch -d @1467750752 remove-unused-page_idx touch -d @1467763312 validate-reserved_gdt_blocks-on-mount -touch -d @1467763423 timestamps -touch -d @1467763524 series -touch -d @1467763527 status +touch -d @1467763528 timestamps +touch -d @1467768557 series +touch -d @1467768832 fix-project-quota-accounting-without-limits-enabled +touch -d @1467768832 status -- 2.11.4.GIT