public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: Xiaoli Feng <xifeng@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH v3] common/rc: add filter in _test_inode_flag
Date: Sat, 20 Feb 2021 00:54:38 +0800	[thread overview]
Message-ID: <20210219165438.GN14354@localhost.localdomain> (raw)
In-Reply-To: <1231198452.69045907.1613750418825.JavaMail.zimbra@redhat.com>

On Fri, Feb 19, 2021 at 11:00:18AM -0500, Xiaoli Feng wrote:
> Hi,
> 
> ----- Original Message -----
> > From: "Zorro Lang" <zlang@redhat.com>
> > To: "XiaoLi Feng" <xifeng@redhat.com>
> > Cc: fstests@vger.kernel.org
> > Sent: Thursday, February 18, 2021 9:41:35 PM
> > Subject: Re: [PATCH v3] common/rc: add filter in _test_inode_flag
> > 
> > On Thu, Feb 18, 2021 at 04:57:52PM +0800, XiaoLi Feng wrote:
> > > From: Xiaoli Feng <xifeng@redhat.com>
> > > 
> > > Add _filter_testdir_and_scratch to avoid _test_inode_flag failed when
> > > mount point contains flag string.
> > > 
> > > Signed-off-by: Xiaoli Feng <xifeng@redhat.com>
> > > ---
> > >  common/rc | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/common/rc b/common/rc
> > > index 649b1cfd..473188c1 100644
> > > --- a/common/rc
> > > +++ b/common/rc
> > > @@ -3112,7 +3112,7 @@ _test_inode_flag()
> > >  	local flag=$1
> > >  	local file=$2
> > >  
> > > -	if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | grep -q "$flag" ; then
> > > +	if $XFS_IO_PROG -r -c 'lsattr -v' "$file" | _filter_testdir_and_scratch |
> > > grep -q "$flag" ; then
> > 
> > I can't understand that. Could you give us an example about why we need this
> > filter before "quiet grep"? I think this line doesn't have any output
> > (except xfs_io fails), so why a filter is needed?
> 
> Yes. this line doesn't have any output. But the return value is different. I send
> this patch to fix the issue: If testdir or scratch_dir has "$flag". Then it will
> always return 0. Even if this file doesn't have this "$flag".
> 
> Example:
>  xfs_io -r -c 'lsattr -v' /daxmnt/fileB
> [] /daxmnt/fileB
> # xfs_io -r -c 'lsattr -v' /daxmnt/fileB | grep -q "dax"
> # echo $?
> 0
> 
> fileB doesn't have dax flag. But _test_inode_flag will always return 0(expect 1).

Oh, got it. So the 'grep -q "dax"' is a litte inaccurate. If the mountpoint or
file name, or any sub-string in the $file contains "dax", this function will
return 0.

If that's the issue you're fixing, I think only filter SCRATCH_MNT and TEST_MNT
isn't enough. If we only care about the "attr" part output, how about filter
out junk (path name), only keep the [attr]?

Due to looks like the output format of 'lsattr -v' is: "[$attr] $filename" (correct
me if I'm wrong). So if we only keep the attr part, that can avoid the 'grep' find
"dax" from $filename.

Thanks,
Zorro

> 
> Thanks.
> 
> > 
> > Thanks,
> > Zorro
> > 
> > >  		return 0
> > >  	fi
> > >  	return 1
> > > --
> > > 2.18.1
> > > 
> > 
> > 


      reply	other threads:[~2021-02-19 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18  8:57 [PATCH v3] common/rc: add filter in _test_inode_flag XiaoLi Feng
2021-02-18 13:41 ` Zorro Lang
2021-02-18 13:41   ` Zirong Lang
2021-02-19 16:00   ` Xiaoli Feng
2021-02-19 16:54     ` Zorro Lang [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=20210219165438.GN14354@localhost.localdomain \
    --to=zlang@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=xifeng@redhat.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