Re: [PATCH v3] common/rc: add filter in _test_inode_flag

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Hi,

----- Original Message -----
> From: "Zorro Lang" <zlang@xxxxxxxxxx>
> To: "XiaoLi Feng" <xifeng@xxxxxxxxxx>
> Cc: fstests@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxx>
> > 
> > Add _filter_testdir_and_scratch to avoid _test_inode_flag failed when
> > mount point contains flag string.
> > 
> > Signed-off-by: Xiaoli Feng <xifeng@xxxxxxxxxx>
> > ---
> >  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).

Thanks.

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




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux