fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
Cc: "guaneryu@gmail.com" <guaneryu@gmail.com>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
	"guan@eryu.me" <guan@eryu.me>
Subject: Re: [PATCH 3/8] xfs/220: fix quotarm syscall test
Date: Fri, 14 Jan 2022 09:08:43 -0800	[thread overview]
Message-ID: <20220114170843.GA90398@magnolia> (raw)
In-Reply-To: <61E0ECFE.9080300@fujitsu.com>

On Fri, Jan 14, 2022 at 03:23:50AM +0000, xuyang2018.jy@fujitsu.com wrote:
> on 2022/1/12 9:14, xuyang2018.jy@fujitsu.com wrote:
> > on 2022/1/12 5:50, Darrick J. Wong wrote:
> >> From: Darrick J. Wong<djwong@kernel.org>
> >>
> >> In commit 6ba125c9, we tried to adjust this fstest to deal with the
> >> removal of the ability to turn off quota accounting via the Q_XQUOTAOFF
> >> system call.
> >>
> >> Unfortunately, the changes made to this test make it nonfunctional on
> >> those newer kernels, since the Q_XQUOTARM command returns EINVAL if
> >> quota accounting is turned on, and the changes filter out the EINVAL
> >> error string.
> >>
> >> Doing this wasn't /incorrect/, because, very narrowly speaking, the
> >> intent of this test is to guard against Q_XQUOTARM returning ENOSYS when
> >> quota has been enabled.  However, this also means that we no longer test
> >> Q_XQUOTARM's ability to truncate the quota files at all.
> >>
> >> So, fix this test to deal with the loss of quotaoff in the same way that
> >> the others do -- if accounting is still enabled after the 'off' command,
> >> cycle the mount so that Q_XQUOTARM actually truncates the files.
> >>
> >> While we're at it, enhance the test to check that XQUOTARM actually
> >> truncated the quota files.
> > Looks good to me,
> > Reviewed-by:Yang Xu<xuyang2018.jy@fujitsu.com>
> >
> > Best Regards
> > Yang Xu
> >
> >>
> >> Fixes: 6ba125c9 ("xfs/220: avoid failure when disabling quota accounting is not supported")
> >> Cc: xuyang2018.jy@fujitsu.com
> >> Signed-off-by: Darrick J. Wong<djwong@kernel.org>
> >> ---
> >>    tests/xfs/220 |   30 +++++++++++++++++++++++-------
> >>    1 file changed, 23 insertions(+), 7 deletions(-)
> >>
> >>
> >> diff --git a/tests/xfs/220 b/tests/xfs/220
> >> index 241a7abd..88eedf51 100755
> >> --- a/tests/xfs/220
> >> +++ b/tests/xfs/220
> >> @@ -52,14 +52,30 @@ _scratch_mkfs_xfs>/dev/null 2>&1
> >>    # mount  with quotas enabled
> >>    _scratch_mount -o uquota
> >>
> >> -# turn off quota and remove space allocated to the quota files
> >> +# 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...
> I used MS_REMOUNT flag with mount syscall in ltp quotactl07.c, so this 
> is the expected behaviour?

No, you have to unmount completely and mount again with '-o noquota'.
In other words, "mount -o remount,noquota" isn't sufficient to disable
accounting.

--D

> https://patchwork.ozlabs.org/project/ltp/patch/1641973691-22981-2-git-send-email-xuyang2018.jy@fujitsu.com/
> 
> Best Regards
> Yang Xu
> >> +if $XFS_QUOTA_PROG -x -c 'state -u' $SCRATCH_DEV | grep -q 'Accounting: ON'; then
> >> +	_scratch_unmount
> >> +	_scratch_mount -o noquota
> >> +fi
> >> +
> >> +before_freesp=$(_get_available_space $SCRATCH_MNT)
> >> +
> >> +# ...and remove space allocated to the quota files
> >>    # (this used to give wrong ENOSYS returns in 2.6.31)
> >> -#
> >> -# The sed expression below replaces a notrun to cater for kernels that have
> >> -# removed the ability to disable quota accounting at runtime.  On those
> >> -# kernel this test is rather useless, and in a few years we can drop it.
> >> -$XFS_QUOTA_PROG -x -c off -c remove $SCRATCH_DEV 2>&1 | \
> >> -	sed -e '/XFS_QUOTARM: Invalid argument/d'
> >> +$XFS_QUOTA_PROG -x -c remove $SCRATCH_DEV
> >> +
> >> +# Make sure we actually freed the space used by dquot 0
> >> +after_freesp=$(_get_available_space $SCRATCH_MNT)
> >> +delta=$((after_freesp - before_freesp))
> >> +
> >> +echo "freesp $before_freesp ->   $after_freesp ($delta)">>   $seqres.full
> >> +if [ $before_freesp -ge $after_freesp ]; then
> >> +	echo "expected Q_XQUOTARM to free space"
> >> +fi
> >>
> >>    # and unmount again
> >>    _scratch_unmount
> >>

  reply	other threads:[~2022-01-14 17:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 21:50 [PATCHSET 0/8] fstests: random fixes Darrick J. Wong
2022-01-11 21:50 ` [PATCH 1/8] common/rc: fix _check_xfs_scrub_does_unicode on newer versions of libc-bin Darrick J. Wong
2022-01-11 21:50 ` [PATCH 2/8] common/rc: fix unicode checker detection in xfs_scrub Darrick J. Wong
2022-01-11 21:50 ` [PATCH 3/8] xfs/220: fix quotarm syscall test Darrick J. Wong
2022-01-12  1:14   ` xuyang2018.jy
2022-01-14  3:23     ` xuyang2018.jy
2022-01-14 17:08       ` Darrick J. Wong [this message]
2022-01-17  1:06         ` xuyang2018.jy
2022-01-11 21:50 ` [PATCH 4/8] xfs: test fixes for new 5.17 behaviors Darrick J. Wong
2022-01-11 21:50 ` [PATCH 5/8] xfs: regression test for allocsp handing out stale disk contents Darrick J. Wong
2022-01-16  7:12   ` Eryu Guan
2022-01-18  3:37   ` Zorro Lang
2022-01-18 18:09     ` Darrick J. Wong
2022-01-19  4:07       ` Zorro Lang
2022-01-19  4:52         ` Darrick J. Wong
2022-01-11 21:50 ` [PATCH 6/8] fsx: add support for XFS_IOC_ALLOCSP Darrick J. Wong
2022-01-11 21:50 ` [PATCH 7/8] iogen: upgrade to fallocate Darrick J. Wong
2022-01-16  7:01   ` Eryu Guan
2022-01-17 17:15     ` Darrick J. Wong
2022-01-11 21:50 ` [PATCH 8/8] alloc: " Darrick J. Wong
2022-01-16  7:16 ` [PATCHSET 0/8] fstests: random fixes Eryu Guan

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=20220114170843.GA90398@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).