linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 1/3] ext4: show prjquota info on statfs for a file
@ 2019-11-18  5:09 Chengguang Xu
  2019-11-18  5:09 ` [RFC PATCH 2/3] f2fs: " Chengguang Xu
  2019-11-18  5:09 ` [RFC PATCH 3/3] xfs: " Chengguang Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Chengguang Xu @ 2019-11-18  5:09 UTC (permalink / raw)
  To: linux-ext4, linux-kernel, linux-f2fs-devel, linux-xfs
  Cc: darrick.wong, jaegeuk, chao, tytso, adilger.kernel, Chengguang Xu

Currently we replace filesystem statistics using prjquota info
on statfs when specified directory has project id inherit flag.
However, statfs on a file(accurately non-dir) which is under the
project quota dir(with inherit flag) still shows whole filesystem
statistics. In container use case, it will give container user
inconsistent experience and cause confusion about available free
space.

Detail info like below:
We use project quota to limit disk space usage for a container
and run df command inside container.

Run df on a directory:

[root /]# df -h /etc/
Filesystem      Size  Used Avail Use% Mounted on
kataShared      1.0G   13M 1012M   2% /

Run df on a file:

[root /]# df -h /etc/exports
Filesystem      Size  Used Avail Use% Mounted on
kataShared      1.5T  778M  1.5T   1% /

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/ext4/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index dd654e53ba3d..3fba22b54f5c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5607,7 +5607,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
 
 #ifdef CONFIG_QUOTA
-	if (ext4_test_inode_flag(dentry->d_inode, EXT4_INODE_PROJINHERIT) &&
+	if ((ext4_test_inode_flag(dentry->d_inode, EXT4_INODE_PROJINHERIT) ||
+	     !S_ISDIR(dentry->d_inode->i_mode)) &&
 	    sb_has_quota_limits_enabled(sb, PRJQUOTA))
 		ext4_statfs_project(sb, EXT4_I(dentry->d_inode)->i_projid, buf);
 #endif
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-19 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18  5:09 [RFC PATCH 1/3] ext4: show prjquota info on statfs for a file Chengguang Xu
2019-11-18  5:09 ` [RFC PATCH 2/3] f2fs: " Chengguang Xu
2019-11-18  5:09 ` [RFC PATCH 3/3] xfs: " Chengguang Xu
2019-11-19 20:43   ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).