diff mbox series

[2/9] quota: Do not account space used by project quota file to quota

Message ID 20210616105735.5424-3-jack@suse.cz
State Superseded
Headers show
Series e2fsprogs: Support for orphan file feature | expand

Commit Message

Jan Kara June 16, 2021, 10:57 a.m. UTC
Project quota files have high inode numbers but are not accounted in
quota usage. Do not track them when computing quota usage.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 lib/support/mkquota.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Theodore Ts'o Aug. 3, 2021, 4:13 p.m. UTC | #1
On Wed, Jun 16, 2021 at 12:57:28PM +0200, Jan Kara wrote:
> Project quota files have high inode numbers but are not accounted in
> quota usage. Do not track them when computing quota usage.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, applied to the maint branch (since this is a bug fix unrelated
to the orhpan inode feature).

It looks like this was an issue that wasn't picked up by our
regression tests.  Do you have an sample image that you used while you
were developing this patch, that perhaps we should be adding to our
regression test suite?

					- Ted
Jan Kara Aug. 4, 2021, 12:15 p.m. UTC | #2
On Tue 03-08-21 12:13:13, Theodore Ts'o wrote:
> On Wed, Jun 16, 2021 at 12:57:28PM +0200, Jan Kara wrote:
> > Project quota files have high inode numbers but are not accounted in
> > quota usage. Do not track them when computing quota usage.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> 
> Thanks, applied to the maint branch (since this is a bug fix unrelated
> to the orhpan inode feature).
> 
> It looks like this was an issue that wasn't picked up by our
> regression tests.  Do you have an sample image that you used while you
> were developing this patch, that perhaps we should be adding to our
> regression test suite?

So I've uncovered this just by code inspection when adding orphan file
feature. Checking this problem is not as simple as using a fs image (the
problem manifests only if we add new quota type using tune2fs). I've
created a test for it. I'll post it separately.

								Honza
diff mbox series

Patch

diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index fbc3833aee98..21a5c34d6921 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -500,9 +500,11 @@  errcode_t quota_compute_usage(quota_ctx_t qctx)
 		}
 		if (ino == 0)
 			break;
-		if (inode->i_links_count &&
-		    (ino == EXT2_ROOT_INO ||
-		     ino >= EXT2_FIRST_INODE(fs->super))) {
+		if (!inode->i_links_count)
+			continue;
+		if (ino == EXT2_ROOT_INO ||
+		    (ino >= EXT2_FIRST_INODE(fs->super) &&
+		     ino != quota_type2inum(PRJQUOTA, fs->super))) {
 			space = ext2fs_get_stat_i_blocks(fs,
 						EXT2_INODE(inode)) << 9;
 			quota_data_add(qctx, inode, ino, space);