lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1525770043-36347-1-git-send-email-bo.liu@linux.alibaba.com>
Date:   Tue,  8 May 2018 17:00:43 +0800
From:   Liu Bo <bo.liu@...ux.alibaba.com>
To:     <linux-ext4@...r.kernel.org>
Subject: [PATCH] Ext4: df: fix df to report reserved bytes in quota

Without quota, df takes both on-disk allocated blocks and dirty reserved
blocks as used, while with quota, df only takes on-disk allocated blocks
by reading quota's information.

To avoid confusing users, this fixes df to read quota's reservd bytes
also.

Signed-off-by: Qixuan Wu <qixuan.wu@...ux.alibaba.com>
Signed-off-by: Liu Bo <bo.liu@...ux.alibaba.com>
---
 fs/ext4/super.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index eb104e8476f0..a49d3709c928 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5240,7 +5240,7 @@ static int ext4_statfs_project(struct super_block *sb,
 	struct kqid qid;
 	struct dquot *dquot;
 	u64 limit;
-	u64 curblock;
+	u64 curblock, rsvblock;
 
 	qid = make_kqid_projid(projid);
 	dquot = dqget(sb, qid);
@@ -5253,10 +5253,11 @@ static int ext4_statfs_project(struct super_block *sb,
 		 dquot->dq_dqb.dqb_bhardlimit) >> sb->s_blocksize_bits;
 	if (limit && buf->f_blocks > limit) {
 		curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;
+		rsvblock = dquot->dq_dqb.dqb_rsvspace >> sb->s_blocksize_bits;
 		buf->f_blocks = limit;
 		buf->f_bfree = buf->f_bavail =
-			(buf->f_blocks > curblock) ?
-			 (buf->f_blocks - curblock) : 0;
+			(buf->f_blocks > (curblock + rsvblock)) ?
+			 (buf->f_blocks - (curblock + rsvblock)) : 0;
 	}
 
 	limit = dquot->dq_dqb.dqb_isoftlimit ?
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ