pynfs: Fix OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS bitmask check
Subsystems (2)
PATCH 1/3 pynfs: Fix OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS bitmask check
From: Suhas Athani <[email protected]>
The CB_GETATTR test incorrectly used OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS as a mask when checking server capabilities.
Fix this by correctly testing the capability bit using (1 << OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS).
--- nfs4.1/server41tests/st_delegation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
nfs4.1/server41tests/st_delegation.py +1 -1
@@ -315,7 +315,7 @@ def _testCbGetattr(t, env, change=0, size=0): fail("FATTR4_OPEN_ARGUMENTS not supported") if caps[FATTR4_SUPPORTED_ATTRS] & FATTR4_OPEN_ARGUMENTS: - if caps[FATTR4_OPEN_ARGUMENTS].oa_share_access_want & OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS: + if caps[FATTR4_OPEN_ARGUMENTS].oa_share_access_want & (1<<OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS): openmask |= 1<<OPEN_ARGS_SHARE_ACCESS_WANT_DELEG_TIMESTAMPS fh, deleg = __create_file_with_deleg(sess1, env.testname(t), openmask)
Signature · 1 line
2.47.3
PATCH 2/3 pynfs: Retry GETATTR on NFS4ERR_DELAY in CB_GETATTR test
From: Suhas Athani <[email protected]>
The CB_GETATTR helper may receive NFS4ERR_DELAY when a delegation callback is still in progress.
Add a bounded retry loop for the GETATTR operation instead of failing immediately. This makes the test more robust against transient delays while still failing if progress does not occur.
--- nfs4.1/server41tests/st_delegation.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
nfs4.1/server41tests/st_delegation.py +15 -1
@@ -1,6 +1,7 @@ from .st_create_session import create_session from .st_open import open_claim4 from xdrdef.nfs4_const import * +import time from .environment import check, fail, create_file, open_file, close_file, do_getattrdict from xdrdef.nfs4_type import *
@@ -346,9 +347,22 @@ def _testCbGetattr(t, env, change=0, size=0): # wait for the CB_GETATTR completed = cb.wait(2) res = sess2.listen(slot) + + # Handle NFS4ERR_DELAY - retry until we get NFS4_OK + retry_count = 0 + max_retries = 5 + while res.status == NFS4ERR_DELAY and retry_count < max_retries: + time.sleep(0.1) + res = sess2.compound([op.putfh(fh), op.getattr(1<<FATTR4_CHANGE | 1<<FATTR4_SIZE | + 1<<FATTR4_TIME_ACCESS | 1<<FATTR4_TIME_MODIFY)]) + retry_count += 1 + + if res.status == NFS4ERR_DELAY: + fail(f"GETATTR still returning DELAY after {max_retries} retries") + attrs2 = res.resarray[-1].obj_attributes sess1.compound([op.putfh(fh), op.delegreturn(deleg.write.stateid)]) - check(res, [NFS4_OK, NFS4ERR_DELAY]) + check(res, [NFS4_OK]) if not completed: fail("CB_GETATTR not received") return attrs1, attrs2
Signature · 1 line
2.47.3
PATCH 3/3 pynfs: Fix CB_GETATTR completion verification
In reply to Suhas AthaniFrom: Suhas Athani <[email protected]>
The test previously tracked callback completion using a variable captured before retrying GETATTR, which could result in false failures if the callback arrived during a retry.
Update the verification to check cb.is_set() at the end of the test to ensure the callback was actually received.
--- nfs4.1/server41tests/st_delegation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
nfs4.1/server41tests/st_delegation.py +2 -2
@@ -345,7 +345,7 @@ def _testCbGetattr(t, env, change=0, size=0): 1<<FATTR4_TIME_ACCESS | 1<<FATTR4_TIME_MODIFY)]) # wait for the CB_GETATTR - completed = cb.wait(2) + cb.wait(2) res = sess2.listen(slot) # Handle NFS4ERR_DELAY - retry until we get NFS4_OK
@@ -363,7 +363,7 @@ def _testCbGetattr(t, env, change=0, size=0): attrs2 = res.resarray[-1].obj_attributes sess1.compound([op.putfh(fh), op.delegreturn(deleg.write.stateid)]) check(res, [NFS4_OK]) - if not completed: + if not cb.is_set(): fail("CB_GETATTR not received") return attrs1, attrs2
Signature · 1 line
2.47.3