From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>,
xfs <linux-xfs@vger.kernel.org>
Subject: Re: The question of Q_XQUOTARM ioctl
Date: Tue, 4 Jan 2022 12:46:26 -0800 [thread overview]
Message-ID: <20220104204626.GF31583@magnolia> (raw)
In-Reply-To: <YdP1Y8FAeu871lr7@infradead.org>
On Mon, Jan 03, 2022 at 11:21:07PM -0800, Christoph Hellwig wrote:
> On Mon, Jan 03, 2022 at 06:34:56PM -0800, Darrick J. Wong wrote:
> > >
> > > I don't know the right intention for Q_XQUOTARM now. Can you give me
> > > some advise? Or, we should remove Q_XQUOTARM ioctl and
> > > xfs_qm_scall_trunc_qfile code.
> >
> > I think xfs_qm_scall_trunc_qfiles probably should be doing:
> >
> > if (xfs_has_quota(mp) || flags == 0 ||
> > (flags & ~XFS_QMOPT_QUOTALL)) {
> > xfs_debug(...);
> > return -EINVAL;
> > }
> >
> > Note the inversion in the has_quota test. That would make it so that
> > you can truncate the quota files if quota is not on.
NAK, that's wrong. xfs_has_quota tells us if the superblock feature bit
is set. The feature bit guards the sb_[ugp]uotino fields, so the above
code causes us to bail out with EINVAL if the filesystem doesn't have
quota inodes at all. Thus, inverting the check (to make it so that we
only try to truncate if the fields are garbage) is not correct.
> Yes, that sounds reasonable. Although I'd split the xfs_has_quota
> file into a separate check with a separate debug message.
So I think the fix here is to fix the testcases. xfs/220 becomes:
# turn off quota accounting...
$XFS_QUOTA_PROG -x -c off $SCRATCH_DEV
# ...but if the kernel doesn't support turning off accounting, remount with
# noquota option to turn it off...
if $XFS_QUOTA_PROG -x -c 'state -u' $SCRATCH_DEV | grep -q 'Accounting: ON'; then
_scratch_unmount
_scratch_mount -o noquota
fi
# ...and remove space allocated to the quota files
# (this used to give wrong ENOSYS returns in 2.6.31)
$XFS_QUOTA_PROG -x -c remove $SCRATCH_DEV
--D
prev parent reply other threads:[~2022-01-04 20:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <616F9367.3030801@fujitsu.com>
2022-01-04 2:34 ` The question of Q_XQUOTARM ioctl Darrick J. Wong
2022-01-04 7:21 ` Christoph Hellwig
2022-01-04 20:46 ` Darrick J. Wong [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=20220104204626.GF31583@magnolia \
--to=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=xuyang2018.jy@fujitsu.com \
/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