Skip to contentSkip to conversation

DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

PATCH In review Dai Ngo 5 participants 10 messages Oct 1, 2025 – Aug 24

Subsystems (2)
lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH 1/1 DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

---
 test/nfstest_dio | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
test/nfstest_dio +14 -2
index 093e552..653a842 100755
@@ -617,6 +617,8 @@ class DioTest(TestUtil):
 
             if nfs_version < 4:
                 match_str = "NFS.argop == %d and NFS.fh == b'%s'" % (NFSPROC3_READ, self.pktt.escape(filehandle))
+            elif nfs_version >= 4.2:
+                match_str = "NFS.argop == %d and NFS.stateid.other == b'%s'" % (OP_READ_PLUS, self.pktt.escape(stateid))
             else:
                 match_str = "NFS.argop == %d and NFS.stateid.other == b'%s'" % (OP_READ, self.pktt.escape(stateid))
 
@@ -744,9 +746,13 @@ class DioTest(TestUtil):
             fd = None
             bfd = None
             ofd = None
-            io_str  = "WRITE" if write else "READ"
+            if self.nfs_version >= 4.2:
+                io_str  = "WRITE" if write else "READ_PLUS"
+                bio_str  = "WRITE" if buffered_write else "READ_PLUS"
+            else:
+                io_str  = "WRITE" if write else "READ"
+                bio_str  = "WRITE" if buffered_write else "READ"
             io_mode = posix.O_WRONLY|posix.O_CREAT if write else posix.O_RDONLY
-            bio_str  = "WRITE" if buffered_write else "READ"
             bio_mode = os.O_WRONLY|os.O_CREAT if buffered_write else os.O_RDONLY
 
             if not bsize:
@@ -861,6 +867,8 @@ class DioTest(TestUtil):
 
             if nfs_version < 4:
                 io_op  = NFSPROC3_WRITE if write else NFSPROC3_READ
+            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS
             else:
                 io_op  = OP_WRITE if write else OP_READ
 
@@ -985,6 +993,8 @@ class DioTest(TestUtil):
 
                 if nfs_version < 4:
                     bio_op = NFSPROC3_WRITE if buffered_write else NFSPROC3_READ
+                elif nfs_version >= 4.2:
+                    bio_op = OP_WRITE if buffered_write else OP_READ_PLUS
                 else:
                     bio_op = OP_WRITE if buffered_write else OP_READ
 
@@ -1270,6 +1280,8 @@ class DioTest(TestUtil):
 
             if nfs_version < 4:
                 io_op = NFSPROC3_WRITE if write else NFSPROC3_READ
+            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS
             else:
                 io_op = OP_WRITE if write else OP_READ
 
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 5 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.co m>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

Hrmm... READ_PLUS is (like all NFSv4.2 features) optional to implement. As such, you really should expect that a server implementation is perfectly within its rights to return NFS4ERR_NOTSUPP, in which case the client should fall back to using READ.

Quoted 70 lines

---
 test/nfstest_dio | 16 ++++++++++++++--

 1 file changed, 14 insertions(+), 2 deletions(-)
test/nfstest_dio +0 -0
index 093e552..653a842 100755
@@ -617,6 +617,8 @@ class DioTest(TestUtil):


             if nfs_version < 4:
                 match_str = "NFS.argop == %d and NFS.fh == b'%s'" % (NFSPROC3_READ, self.pktt.escape(filehandle))
+            elif nfs_version >= 4.2:
+                match_str = "NFS.argop == %d and NFS.stateid.other == b'%s'" % (OP_READ_PLUS, self.pktt.escape(stateid)) else:
                 match_str = "NFS.argop == %d and NFS.stateid.other == b'%s'" % (OP_READ, self.pktt.escape(stateid))

test/nfstest_dio +0 -0
@@ -744,9 +746,13 @@ class DioTest(TestUtil):

             fd = None
             bfd = None
             ofd = None
-            io_str  = "WRITE" if write else "READ"
+            if self.nfs_version >= 4.2:
+                io_str  = "WRITE" if write else "READ_PLUS" +                bio_str  = "WRITE" if buffered_write else "READ_PLUS"
+            else:
+                io_str  = "WRITE" if write else "READ"
+                bio_str  = "WRITE" if buffered_write else "READ" io_mode = posix.O_WRONLY|posix.O_CREAT if write else posix.O_RDONLY
-            bio_str  = "WRITE" if buffered_write else "READ" bio_mode = os.O_WRONLY|os.O_CREAT if buffered_write else os.O_RDONLY

             if not bsize:

test/nfstest_dio +0 -0
@@ -861,6 +867,8 @@ class DioTest(TestUtil):


             if nfs_version < 4:
                 io_op  = NFSPROC3_WRITE if write else NFSPROC3_READ +            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS else:
                 io_op  = OP_WRITE if write else OP_READ

test/nfstest_dio +0 -0
@@ -985,6 +993,8 @@ class DioTest(TestUtil):


                 if nfs_version < 4:
                     bio_op = NFSPROC3_WRITE if buffered_write else NFSPROC3_READ
+                elif nfs_version >= 4.2:
+                    bio_op = OP_WRITE if buffered_write else OP_READ_PLUS
                 else:
                     bio_op = OP_WRITE if buffered_write else OP_READ

test/nfstest_dio +0 -0
@@ -1270,6 +1280,8 @@ class DioTest(TestUtil):


             if nfs_version < 4:
                 io_op = NFSPROC3_WRITE if write else NFSPROC3_READ +            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS else:
                 io_op = OP_WRITE if write else OP_READ

author reviewer
#2 lore raw
Quoted 10 lines · Trond Myklebust
Quoted 5 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.co m>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

Hrmm... READ_PLUS is (like all NFSv4.2 features) optional to implement. As such, you really should expect that a server implementation is perfectly within its rights to return NFS4ERR_NOTSUPP, in which case the client should fall back to using READ.

Thank you for your comments Trond. I'll submit another patch, if Jorge has done it yet, that probes the server's support for 4.2 reads and use it appropriately in the test.

My initial patch was written with only the Linux NFSD in mind.

-Dai

Quoted 70 lines
Quoted 70 lines
---
  test/nfstest_dio | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
test/nfstest_dio +2 -0
index 093e552..653a842 100755
@@ -617,6 +617,8 @@ class DioTest(TestUtil):
 
              if nfs_version < 4:
                  match_str = "NFS.argop == %d and NFS.fh == b'%s'" %
 (NFSPROC3_READ, self.pktt.escape(filehandle))
+            elif nfs_version >= 4.2:
+                match_str = "NFS.argop == %d and NFS.stateid.other
 == b'%s'" % (OP_READ_PLUS, self.pktt.escape(stateid))
              else:

                 match_str = "NFS.argop == %d and NFS.stateid.other
== b'%s'" % (OP_READ, self.pktt.escape(stateid))

test/nfstest_dio +3 -1
@@ -744,9 +746,13 @@ class DioTest(TestUtil):
              fd = None
              bfd = None
              ofd = None
-            io_str  = "WRITE" if write else "READ"
+            if self.nfs_version >= 4.2:
+                io_str  = "WRITE" if write else "READ_PLUS"
+                bio_str  = "WRITE" if buffered_write else

"READ_PLUS"
+            else:
+                io_str  = "WRITE" if write else "READ"
+                bio_str  = "WRITE" if buffered_write else "READ"
             io_mode = posix.O_WRONLY|posix.O_CREAT if write else
posix.O_RDONLY
-            bio_str  = "WRITE" if buffered_write else "READ"
             bio_mode = os.O_WRONLY|os.O_CREAT if buffered_write else
os.O_RDONLY

             if not bsize:

test/nfstest_dio +2 -0
@@ -861,6 +867,8 @@ class DioTest(TestUtil):
 
              if nfs_version < 4:
                  io_op  = NFSPROC3_WRITE if write else NFSPROC3_READ
+            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS
              else:
                  io_op  = OP_WRITE if write else OP_READ
 
@@ -985,6 +993,8 @@ class DioTest(TestUtil):
 
                  if nfs_version < 4:
                      bio_op = NFSPROC3_WRITE if buffered_write else

NFSPROC3_READ
+                elif nfs_version >= 4.2:
+                    bio_op = OP_WRITE if buffered_write else OP_READ_PLUS
                 else:
                     bio_op = OP_WRITE if buffered_write else OP_READ

test/nfstest_dio +2 -0
@@ -1270,6 +1280,8 @@ class DioTest(TestUtil):
 
              if nfs_version < 4:
                  io_op = NFSPROC3_WRITE if write else NFSPROC3_READ
+            elif nfs_version >= 4.2:
+                io_op  = OP_WRITE if write else OP_READ_PLUS
              else:
                  io_op = OP_WRITE if write else OP_READ
 
#3 lore raw

pahtconf() api to test for sparse file support? Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

In reply to Trond Myklebust
Quoted 9 lines · Trond Myklebust
Quoted 5 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.co m>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

Hrmm... READ_PLUS is (like all NFSv4.2 features) optional to implement.

READ_PLUS is needed for sparse file support.

I am really starting to wonder whether there should be a pathconf() api to check whether sparse files are supported, i.e. NFSv4.2 SEEK and NFSv4.2 READ_PLUS are possible for a file.

Aurélien

Signature · 2 lines
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast
#4 lore raw

READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

In reply to Dai Ngo
Quoted 4 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Aurélien

Signature · 2 lines
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast
#5 lore raw

Re: READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

Quoted 11 lines · Aurélien Couderc
Quoted 4 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Is there any bug tracker where I can post this Linux NFS server bug?

Aurélien

Signature · 2 lines
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast
#6 lore raw

Re: READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

Quoted 7 lines · Aurélien Couderc
Quoted 5 lines · Aurélien Couderc
Quoted 3 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Is there any bug tracker where I can post this Linux NFS server bug?

https://bugzilla.kernel.org, Product "File Systems", Component "NFSD"

Signature · 1 line
Chuck Lever
#7 lore raw

Re: READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

In reply to Aurélien Couderc

Reminder: This is still broken in Linux 7.2.

Aurélien

Quoted 16 lines · Aurélien Couderc
Quoted 4 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Aurélien
--
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast

Signature · 2 lines
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast
maintainer
#8 lore raw

Re: READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

Quoted 17 lines · Aurélien Couderc

Reminder: This is still broken in Linux 7.2.

Aurélien

Quoted 11 lines · Aurélien Couderc
Quoted 4 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Aurélien, "broken" is not an actionable bug report. It's a complaint.

Do you mean that NFSD returns READ_PLUS responses that contain only data segments, never holes? That is perhaps not optimal, but it is 100% spec-compliant, as far as I am aware.

NFSD was changed to do this because there is no common race-free way to detect holes in files on Linux filesystems. If kernel VFS developers know of a way to do this, please reach out to me.

Signature · 1 line
Chuck Lever
#9 lore raw

Re: READ_PLUS broken in Linux 6.12, worked in Linux 5.10! Re: [PATCH 1/1] DIO: add NFSv4.2 READ_PLUS support for nfstest_dio

Quoted 24 lines · Chuck Lever
Quoted 17 lines · Aurélien Couderc

Reminder: This is still broken in Linux 7.2.

Aurélien

Quoted 11 lines · Aurélien Couderc
Quoted 4 lines · Dai Ngo

From: Oracle Public Cloud User <opc@dngo-nfstest-client.allregionaliads.osdevelopmeniad.oraclevcn.com>

Check for nfs_version >= 4.2 and use READ_PLUS instead of READ.

FYI READ_PLUS is **BROKEN** for sparse files. It was working in Linux 5.10, but as soon as we switched to Linux 6.12 it reported only data and no holes in sparse files. We're back to Linux 5.10 and cannot upgrade because of this.

Aurélien, "broken" is not an actionable bug report. It's a complaint.

Quoted 7 lines

Do you mean that NFSD returns READ_PLUS responses that contain only data segments, never holes? That is perhaps not optimal, but it is 100% spec-compliant, as far as I am aware.

NFSD was changed to do this because there is no common race-free way to detect holes in files on Linux filesystems. If kernel VFS developers know of a way to do this, please reach out to me.

Why is this a job of the VFS? On the NFS server side? If someone wants a race-free hole listing he has to lock (shared lock) that file on the NFS client side, NFS server handles THAT lock. Problem solved.

Aurélien

Signature · 2 lines
Aurélien Couderc <[email protected]>
Big Data/Data mining expert, chess enthusiast