[PATCH pynfs v3 09/26] server41tests: test link triggers dir delegation recall
Jeff Layton <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
Get a dir delegation with no notification mask, create a file, then hard-link it to a new name from a second client. Verify that the server issues a CB_RECALL. Signed-off-by: Jeff Layton <[email protected]> --- nfs4.1/server41tests/st_dir_deleg.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/nfs4.1/server41tests/st_dir_deleg.py b/nfs4.1/server41tests/st_dir_deleg.py index b27e68eea5f6..008e45d4cf64 100644 --- a/nfs4.1/server41tests/st_dir_deleg.py +++ b/nfs4.1/server41tests/st_dir_deleg.py @@ -242,3 +242,39 @@ def testDirDelegMkdirRecall(t, env): ops = [ op.putfh(fh), op.delegreturn(deleg) ] res = sess1.compound(ops) check(res) + +def testDirDelegLinkRecall(t, env): + """Verify link triggers dir delegation recall + + FLAGS: dirdeleg all + CODE: DIRDELEG6 + """ + c = env.c1 + recall = threading.Event() + sess1, fh, deleg = _getDirDeleg(t, env, [], recall) + + # Create a file from sess1 + claim = open_claim4(CLAIM_NULL, env.testname(t)) + owner = open_owner4(0, b"owner") + how = openflag4(OPEN4_CREATE, createhow4(GUARDED4, {FATTR4_SIZE:0})) + open_op = [ op.putfh(fh), op.open(0, + OPEN4_SHARE_ACCESS_WRITE | OPEN4_SHARE_ACCESS_WANT_NO_DELEG, + OPEN4_SHARE_DENY_NONE, owner, how, claim), op.getfh() ] + res = sess1.compound(open_op) + check(res) + open_stateid = res.resarray[-2].stateid + file_fh = res.resarray[-1].object + close_file(sess1, file_fh, stateid=open_stateid) + + # Link the file to a new name from sess2 -- should trigger recall + sess2 = c.new_client_session(b"%s_2" % env.testname(t)) + link_op = [ op.putfh(file_fh), op.savefh(), + op.putfh(fh), + op.link(b"%s_link" % env.testname(t)) ] + slot = sess2.compound_async(link_op) + completed = recall.wait(2) + env.sleep(.1) + + ops = [ op.putfh(fh), op.delegreturn(deleg) ] + res = sess1.compound(ops) + check(res) -- 2.54.0