public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	fstests@vger.kernel.org, sandeen@sandeen.net
Subject: Re: [PATCH] generic/386: check the correct field from df output
Date: Mon, 30 Dec 2019 00:05:37 +0800	[thread overview]
Message-ID: <20191229160534.GA893866@desktop> (raw)
In-Reply-To: <ae961477-f14a-60b3-9784-909470bc2bc8@cn.fujitsu.com>

On Mon, Dec 23, 2019 at 09:24:56AM +0800, Yang Xu wrote:
> 
> 
> on 2019/12/23 5:27, Theodore Ts'o wrote:
> > The generic/386 test was checking the "Available" field when it should
> > have been checking the "1k-blocks" field, which represents the project
> > quota's hard limit.  On xfs, an empty directory takes no space, so it
> > doesn't matter.  But for ext4, an empty directory still takes 4k (or
> > whatever the file system's block size happens to be):
> > 
> > Filesystem           1K-blocks       Used  Available  Use% Pathname
> > /dev/vdc                512000          4     511996    0% /vdc/test
> > 
> > This causes generic/386 to falsely fail.  There was a confusing
> > comment claiming that for a very long device name, the df output would
> > have a line break, and for that reason, the test would extract the
> > field using $(NF-2).  However, looking at xfsprogs's quota command, I
> > see no evidence that there is any line breaking logic.  Since we now
> > want to use the second field, even if there was some line breaking
> > going on, using $2 should be a better choice.
> > 
> > This fix is needed to fix generic/386 from failing on ext4:
> Hi Theodore
> 
> I have a same fix but I use $(NF-4) field of df command. Also I wrongly
> think project quota uses a block size.
> url:
> https://patchwork.kernel.org/patch/11296657/

Yes, $(NF-4) works, as Eric suggested as well. I applied Ted's patch
(with $2->$(NF-4) fix), as the commit log is explaining well what's the
problem and why taking "1k blocks" is correct. And thank you for the fix
all the same!

Thanks,
Eryu

> 
> Best Regards
> Yang Xu
> > 
> >      hard limit 524283904 bytes, expected 524288000
> > 
> > Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> > ---
> >   tests/generic/386 | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/tests/generic/386 b/tests/generic/386
> > index 0c44c80e..37e9b943 100755
> > --- a/tests/generic/386
> > +++ b/tests/generic/386
> > @@ -62,8 +62,6 @@ _require_scratch
> >   # both the "df" and the "report" output.  For "report", the line we're
> >   # interested in contains our project name in the first field.  For "df"
> >   # it contains our project directory in the last field.
> > -# But if the device name is too long, the "df" output is broke into two
> > -# lines, the fourth field is not correct, so take $(NF-2) of "df"
> >   _filter_quota_rpt() {
> >   	awk '
> >   	BEGIN {
> > @@ -89,7 +87,7 @@ _filter_quota_rpt() {
> >   			bsize = byte_size($4);
> >   		} else if ($NF ~ proj_dir) {
> >   			# this is the "df" output
> > -			bsize = byte_size($(NF-2));
> > +			bsize = byte_size($2));
> >   		} else {
> >   			next;
> >   		}
> > 
> 
> 

      reply	other threads:[~2019-12-29 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 21:27 [PATCH] generic/386: check the correct field from df output Theodore Ts'o
2019-12-22 21:30 ` Theodore Y. Ts'o
2019-12-24 18:02   ` Eric Sandeen
2019-12-23  1:24 ` Yang Xu
2019-12-29 16:05   ` Eryu Guan [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=20191229160534.GA893866@desktop \
    --to=guaneryu@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=tytso@mit.edu \
    --cc=xuyang2018.jy@cn.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