* [PATCH] flex: add ffl_flags validation test
@ 2026-06-25 8:37 Minxi Hou
0 siblings, 0 replies; only message in thread
From: Minxi Hou @ 2026-06-25 8:37 UTC (permalink / raw)
To: calum.mackay; +Cc: linux-nfs, Minxi Hou
Add FFFL1 which verifies that the ffl_flags field in the LAYOUTGET
response contains only bits defined in RFC 8435 Section 5.1:
NO_LAYOUTCOMMIT, NO_IO_THRU_MDS, and NO_READ_IO. The three flag
constants were already defined in nfs4_const.py but had no test
coverage.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
---
nfs4.1/server41tests/st_flex.py | 48 +++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 766b213..96195e5 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -1117,3 +1117,51 @@ def testFlexLayoutReturn100(t, env):
# Close file
res = close_file(sess, fh, stateid=open_stateid)
check(res)
+
+def testFlexFlags(t, env):
+ """Verify ffl_flags contains only valid RFC 8435 bits.
+
+ FLAGS: flex
+ CODE: FFFL1
+ """
+ sess = env.c1.new_pnfs_client_session(env.testname(t))
+
+ # Create file
+ res = create_file(sess, env.testname(t))
+ check(res)
+ fh = res.resarray[-1].object
+ open_stateid = res.resarray[-2].stateid
+
+ # LAYOUTGET
+ ops = [op.putfh(fh),
+ op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
+ 0, 8192, 8192, open_stateid, 0xffff)]
+ res = sess.compound(ops)
+ check(res)
+ lo_stateid = res.resarray[-1].logr_stateid
+
+ # Unpack ff_layout4 and check ffl_flags
+ layout = res.resarray[-1].logr_layout[-1]
+ p = FlexUnpacker(layout.loc_body)
+ opaque = p.unpack_ff_layout4()
+
+ valid_flags = (FF_FLAGS_NO_LAYOUTCOMMIT |
+ FF_FLAGS_NO_IO_THRU_MDS |
+ FF_FLAGS_NO_READ_IO)
+ if opaque.ffl_flags & ~valid_flags:
+ t.fail("ffl_flags 0x%x has undefined bits set (valid: 0x%x)"
+ % (opaque.ffl_flags, valid_flags))
+
+ # LAYOUTRETURN
+ ops = [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
+ lo_stateid,
+ empty_p.get_buffer())))]
+ res = sess.compound(ops)
+ check(res)
+
+ # Close file
+ res = close_file(sess, fh, stateid=open_stateid)
+ check(res)
--
2.54.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-25 8:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 8:37 [PATCH] flex: add ffl_flags validation test Minxi Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox