linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10
@ 2020-12-02 16:07 ira.weiny
  2020-12-02 17:10 ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: ira.weiny @ 2020-12-02 16:07 UTC (permalink / raw)
  To: fstests
  Cc: Ira Weiny, linux-kernel, Darrick J. Wong, Dan Williams,
	Dave Chinner, Christoph Hellwig, Theodore Y. Ts'o, Jan Kara,
	Jeff Moyer, linux-ext4, linux-xfs, linux-fsdevel, Eric Sandeen,
	David Howells

From: Ira Weiny <ira.weiny@intel.com>

There is a conflict with the user visible statx bits 'mount root' and
'dax'.  The kernel is shifting the dax bit.[1]

Adjust _check_s_dax() to use the new bit.

[1] https://lore.kernel.org/lkml/3e28d2c7-fbe5-298a-13ba-dcd8fd504666@redhat.com/

Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---

I'm not seeing an easy way to check for kernel version.  It seems like that is
the right thing to do.  So do I need to do that by hand or is that something
xfstests does not worry about?

Ira

---
 common/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index b5a504e0dcb4..3d45e233954f 100644
--- a/common/rc
+++ b/common/rc
@@ -3222,9 +3222,9 @@ _check_s_dax()
 
 	local attributes=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
 	if [ $exp_s_dax -eq 0 ]; then
-		(( attributes & 0x2000 )) && echo "$target has unexpected S_DAX flag"
+		(( attributes & 0x00200000 )) && echo "$target has unexpected S_DAX flag"
 	else
-		(( attributes & 0x2000 )) || echo "$target doesn't have expected S_DAX flag"
+		(( attributes & 0x00200000 )) || echo "$target doesn't have expected S_DAX flag"
 	fi
 }
 
-- 
2.28.0.rc0.12.gb6a658bd00c9


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10
  2020-12-02 16:07 [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10 ira.weiny
@ 2020-12-02 17:10 ` Eric Sandeen
  2020-12-02 17:14   ` Christoph Hellwig
  2020-12-02 19:08   ` Ira Weiny
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2020-12-02 17:10 UTC (permalink / raw)
  To: ira.weiny, fstests
  Cc: linux-kernel, Darrick J. Wong, Dan Williams, Dave Chinner,
	Christoph Hellwig, Theodore Y. Ts'o, Jan Kara, Jeff Moyer,
	linux-ext4, linux-xfs, linux-fsdevel, Eric Sandeen,
	David Howells

On 12/2/20 10:07 AM, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
> 
> There is a conflict with the user visible statx bits 'mount root' and
> 'dax'.  The kernel is shifting the dax bit.[1]
> 
> Adjust _check_s_dax() to use the new bit.
> 
> [1] https://lore.kernel.org/lkml/3e28d2c7-fbe5-298a-13ba-dcd8fd504666@redhat.com/
> 
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 
> ---
> 
> I'm not seeing an easy way to check for kernel version.  It seems like that is
> the right thing to do.  So do I need to do that by hand or is that something
> xfstests does not worry about?

xfstests gets used on distro kernels too, so relying on kernel version isn't
really something we can use to make determinations like this, unfortunately.

Probably the best we can do is hope that the change makes it to stable and
distro kernels quickly, and the old flag fades into obscurity.

Maybe worth a comment in the test mentioning the SNAFU, though, for anyone
investigating it when it fails on older kernels?

> Ira
> 
> ---
>  common/rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index b5a504e0dcb4..3d45e233954f 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3222,9 +3222,9 @@ _check_s_dax()
>  
>  	local attributes=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
>  	if [ $exp_s_dax -eq 0 ]; then
> -		(( attributes & 0x2000 )) && echo "$target has unexpected S_DAX flag"
> +		(( attributes & 0x00200000 )) && echo "$target has unexpected S_DAX flag"
>  	else
> -		(( attributes & 0x2000 )) || echo "$target doesn't have expected S_DAX flag"
> +		(( attributes & 0x00200000 )) || echo "$target doesn't have expected S_DAX flag"

I suppose you could add a test for 0x2000 in this failure case, and echo "Is your kernel missing
commit xxxxxx?" as another hint.

-Eric

>  	fi
>  }
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10
  2020-12-02 17:10 ` Eric Sandeen
@ 2020-12-02 17:14   ` Christoph Hellwig
  2020-12-02 19:08   ` Ira Weiny
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-12-02 17:14 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: ira.weiny, fstests, linux-kernel, Darrick J. Wong, Dan Williams,
	Dave Chinner, Christoph Hellwig, Theodore Y. Ts'o, Jan Kara,
	Jeff Moyer, linux-ext4, linux-xfs, linux-fsdevel, Eric Sandeen,
	David Howells

On Wed, Dec 02, 2020 at 11:10:50AM -0600, Eric Sandeen wrote:
> xfstests gets used on distro kernels too, so relying on kernel version isn't
> really something we can use to make determinations like this, unfortunately.
> 
> Probably the best we can do is hope that the change makes it to stable and
> distro kernels quickly, and the old flag fades into obscurity.
> 
> Maybe worth a comment in the test mentioning the SNAFU, though, for anyone
> investigating it when it fails on older kernels?

I think we should explicitly check for the "old" or mixed up flag and
error out.  Given that the other meaning of the bit value should only
be set on mount points it should be easy to test.  That means we will
reliably fail on old and distro kernels, but I think that is the right
thing to do in this case.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10
  2020-12-02 17:10 ` Eric Sandeen
  2020-12-02 17:14   ` Christoph Hellwig
@ 2020-12-02 19:08   ` Ira Weiny
  1 sibling, 0 replies; 4+ messages in thread
From: Ira Weiny @ 2020-12-02 19:08 UTC (permalink / raw)
  To: Eric Sandeen
  Cc: fstests, linux-kernel, Darrick J. Wong, Dan Williams,
	Dave Chinner, Christoph Hellwig, Theodore Y. Ts'o, Jan Kara,
	Jeff Moyer, linux-ext4, linux-xfs, linux-fsdevel, Eric Sandeen,
	David Howells

On Wed, Dec 02, 2020 at 11:10:50AM -0600, Eric Sandeen wrote:
> On 12/2/20 10:07 AM, ira.weiny@intel.com wrote:
> > From: Ira Weiny <ira.weiny@intel.com>
> > 
> > There is a conflict with the user visible statx bits 'mount root' and
> > 'dax'.  The kernel is shifting the dax bit.[1]
> > 
> > Adjust _check_s_dax() to use the new bit.
> > 
> > [1] https://lore.kernel.org/lkml/3e28d2c7-fbe5-298a-13ba-dcd8fd504666@redhat.com/
> > 
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> > 
> > ---
> > 
> > I'm not seeing an easy way to check for kernel version.  It seems like that is
> > the right thing to do.  So do I need to do that by hand or is that something
> > xfstests does not worry about?
> 
> xfstests gets used on distro kernels too, so relying on kernel version isn't
> really something we can use to make determinations like this, unfortunately.
> 
> Probably the best we can do is hope that the change makes it to stable and
> distro kernels quickly, and the old flag fades into obscurity.
> 
> Maybe worth a comment in the test mentioning the SNAFU, though, for anyone
> investigating it when it fails on older kernels?

Good idea.

> 
> > Ira
> > 
> > ---
> >  common/rc | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/rc b/common/rc
> > index b5a504e0dcb4..3d45e233954f 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -3222,9 +3222,9 @@ _check_s_dax()
> >  
> >  	local attributes=$($XFS_IO_PROG -c 'statx -r' $target | awk '/stat.attributes / { print $3 }')
> >  	if [ $exp_s_dax -eq 0 ]; then
> > -		(( attributes & 0x2000 )) && echo "$target has unexpected S_DAX flag"
> > +		(( attributes & 0x00200000 )) && echo "$target has unexpected S_DAX flag"
> >  	else
> > -		(( attributes & 0x2000 )) || echo "$target doesn't have expected S_DAX flag"
> > +		(( attributes & 0x00200000 )) || echo "$target doesn't have expected S_DAX flag"
> 
> I suppose you could add a test for 0x2000 in this failure case, and echo "Is your kernel missing
> commit xxxxxx?" as another hint.

Yea, I think that is ok since the test should not be running on any root mount
points.

V2 will come after the patch is merged.

Ira

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-02 19:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 16:07 [RFC PATCH] common/rc: Fix _check_s_dax() for kernel 5.10 ira.weiny
2020-12-02 17:10 ` Eric Sandeen
2020-12-02 17:14   ` Christoph Hellwig
2020-12-02 19:08   ` Ira Weiny

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).