From: Minxi Hou <houminxi@gmail.com>
To: calum.mackay@oracle.com
Cc: linux-nfs@vger.kernel.org, Minxi Hou <houminxi@gmail.com>
Subject: [PATCH] flex: add ffl_flags validation test
Date: Thu, 25 Jun 2026 16:37:56 +0800 [thread overview]
Message-ID: <20260625083756.1799608-1-houminxi@gmail.com> (raw)
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
reply other threads:[~2026-06-25 8:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625083756.1799608-1-houminxi@gmail.com \
--to=houminxi@gmail.com \
--cc=calum.mackay@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox