From: Dave Chinner <david@fromorbit.com>
To: Chengguang Xu <cgxu519@mykernel.net>
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-xfs@vger.kernel.org, darrick.wong@oracle.com,
jaegeuk@kernel.org, chao@kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca
Subject: Re: [RFC PATCH 3/3] xfs: show prjquota info on statfs for a file
Date: Wed, 20 Nov 2019 07:43:40 +1100 [thread overview]
Message-ID: <20191119204340.GZ4614@dread.disaster.area> (raw)
In-Reply-To: <20191118050949.15629-3-cgxu519@mykernel.net>
On Mon, Nov 18, 2019 at 01:09:49PM +0800, Chengguang Xu wrote:
> 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/xfs/xfs_super.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 8d1df9f8be07..9f4d9e86572a 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1125,7 +1125,8 @@ xfs_fs_statfs(
> statp->f_ffree = max_t(int64_t, ffree, 0);
>
>
> - if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
> + if (((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) ||
> + !S_ISDIR(dentry->d_inode->i_mode)) &&
> ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) ==
> (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))
> xfs_qm_statvfs(ip, statp);
So this also changes statfs() for non-directory quota uses. It will
now *always* report project quota info for a file, whether directory
quotas are in use or not. This is going to confuse users who see the
full filesystem info when they statfs a directory, then see project
quota limits when they statfs a file.
i.e. all this patch does is move the inconsistency in reporting to
non-directory based project quota users.
So from that perspective, this is not a viable solution.
What is a viable solution is to add an explicit dirquota mount
option (which we've recently discussed) that explicitly presents all
directory quota specific behaviours to userspace without tying them
to the internal project quota-based on-disk implementation. This is
the only sane way to solve this problem as it tells the filesysetm
exactly what behaviour set it should be exposing to userspace.
IOWs, the statfs code should probably end up looking like this:
- if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
+ if ((mp->m_flags & XFS_MOUNT_DIRQUOTA) &&
((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))) ==
(XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD))
xfs_qm_statvfs(ip, statp);
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2019-11-19 20:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191119204340.GZ4614@dread.disaster.area \
--to=david@fromorbit.com \
--cc=adilger.kernel@dilger.ca \
--cc=cgxu519@mykernel.net \
--cc=chao@kernel.org \
--cc=darrick.wong@oracle.com \
--cc=jaegeuk@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox