From: Christian Brauner <christian.brauner@ubuntu.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, hch@lst.de, dchinner@redhat.com
Subject: Re: [PATCH 1/3] xfs: fix quota accounting when a mount is idmapped
Date: Wed, 3 Mar 2021 19:09:57 +0000 [thread overview]
Message-ID: <20210303190957.7kabt57lvc432j6x@wittgenstein> (raw)
In-Reply-To: <20210303183352.GT7269@magnolia>
On Wed, Mar 03, 2021 at 10:33:52AM -0800, Darrick J. Wong wrote:
> On Wed, Mar 03, 2021 at 02:44:01PM +0000, Christian Brauner wrote:
> > On Tue, Mar 02, 2021 at 02:28:22PM -0800, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > >
> > > Nowadays, we indirectly use the idmap-aware helper functions in the VFS
> > > to set the initial uid and gid of a file being created. Unfortunately,
> > > we didn't convert the quota code, which means we attach the wrong dquots
> > > to files created on an idmapped mount.
> > >
> > > Fixes: f736d93d76d3 ("xfs: support idmapped mounts")
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> >
> > This looks good but it misses one change, I think. The
> > xfs_ioctl_setattr() needs to take the mapping into account as well:
> >
> > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> > index 99dfe89a8d08..067366bf9a59 100644
> > --- a/fs/xfs/xfs_ioctl.c
> > +++ b/fs/xfs/xfs_ioctl.c
> > @@ -1460,8 +1460,8 @@ xfs_ioctl_setattr(
> > * because the i_*dquot fields will get updated anyway.
> > */
> > if (XFS_IS_QUOTA_ON(mp)) {
> > - error = xfs_qm_vop_dqalloc(ip, VFS_I(ip)->i_uid,
> > - VFS_I(ip)->i_gid, fa->fsx_projid,
> > + error = xfs_qm_vop_dqalloc(ip, i_uid_into_mnt(mnt_userns, VFS_I(ip)),
> > + i_gid_into_mnt(mnt_userns, VFS_I(ip)), fa->fsx_projid,
> > XFS_QMOPT_PQUOTA, NULL, NULL, &pdqp);
>
> The uid/gid parameters here don't matter because the "XFS_QMOPT_PQUOTA"
> flag by itself here means that _dqalloc only looks at the project id
> argument.
Ah, thanks! (Maybe a comment would be good or just idmaped them anyway.)
Thanks!
Christian
next prev parent reply other threads:[~2021-03-04 0:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 22:28 [PATCHSET 0/3] xfs: small fixes for 5.12 Darrick J. Wong
2021-03-02 22:28 ` [PATCH 1/3] xfs: fix quota accounting when a mount is idmapped Darrick J. Wong
2021-03-03 6:43 ` Christoph Hellwig
2021-03-03 14:44 ` Christian Brauner
2021-03-03 18:33 ` Darrick J. Wong
2021-03-03 19:09 ` Christian Brauner [this message]
2021-03-02 22:28 ` [PATCH 2/3] xfs: avoid buffer deadlocks in inumbers/bulkstat Darrick J. Wong
2021-03-03 6:45 ` Christoph Hellwig
2021-03-03 18:57 ` Darrick J. Wong
2021-03-02 22:28 ` [PATCH 3/3] xfs: force log and push AIL to clear pinned inodes when aborting mount Darrick J. Wong
2021-03-03 6:48 ` Christoph Hellwig
2021-03-03 19:02 ` Darrick J. Wong
2021-03-02 23:07 ` [PATCHSET 0/3] xfs: small fixes for 5.12 Christian Brauner
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=20210303190957.7kabt57lvc432j6x@wittgenstein \
--to=christian.brauner@ubuntu.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).