Skip to contentSkip to conversation

common/rc: Fix _check_s_dax() for kernel 5.10

RFC PATCH In review [email protected] 3 participants 4 messages Dec 2, 2020 VFS

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 common/rc: Fix _check_s_dax() for kernel 5.10

From: Ira Weiny <[email protected]>

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/[email protected]/

---

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(-)
common/rc +2 -2
index b5a504e0dcb4..3d45e233954f 100644
@@ -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
 }
 
Signature · 1 line
2.28.0.rc0.12.gb6a658bd00c9
#1 lore raw
Quoted 9 lines · On 12/2/20 10:07 AM, [email protected] wrote:

From: Ira Weiny <[email protected]>

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/[email protected]/

Quoted 7 lines

---

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?

Quoted 11 lines

Ira

---
 common/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/rc +0 -0
index b5a504e0dcb4..3d45e233954f 100644

common/rc _check_s_dax() · line 3227

Quoted 8 lines
common/rc +2 -2
@@ -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

Quoted 4 lines
common/rc +0 -0
 	fi
 }
 
#2 lore raw
Quoted 8 lines · Eric Sandeen

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.

author
#3 lore raw
In reply to Eric Sandeen
Quoted 18 lines · Eric Sandeen
Quoted 9 lines · On 12/2/20 10:07 AM, [email protected] wrote:

From: Ira Weiny <[email protected]>

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/[email protected]/

Quoted 7 lines

---

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?

Quoted 8 lines

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.

Quoted 13 lines
Quoted 13 lines

Ira

---
 common/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/rc +0 -0
index b5a504e0dcb4..3d45e233954f 100644
@@ -3222,9 +3222,9 @@ _check_s_dax()
 
Quoted 10 lines

common/rc _check_s_dax() · line 3227

Quoted 7 lines
common/rc +2 -2
 	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