From: Jeff Layton <jlayton@kernel.org>
To: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>, calum.mackay@oracle.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] pynfs: add test for read with delegation stateid after close
Date: Mon, 21 Apr 2025 09:40:03 -0400 [thread overview]
Message-ID: <1b2c626c62b32568d5a722b50164a495ef10314c.camel@kernel.org> (raw)
In-Reply-To: <20250411111902.132591-1-tigran.mkrtchyan@desy.de>
On Fri, 2025-04-11 at 13:19 +0200, Tigran Mkrtchyan wrote:
> This test checks the independence of delegation stateid from open
> stateid.
>
> Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
> ---
> nfs4.1/server41tests/st_delegation.py | 50 ++++++++++++++++++++++++++-
> 1 file changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/nfs4.1/server41tests/st_delegation.py b/nfs4.1/server41tests/st_delegation.py
> index f27e852..ea4c073 100644
> --- a/nfs4.1/server41tests/st_delegation.py
> +++ b/nfs4.1/server41tests/st_delegation.py
> @@ -2,7 +2,7 @@ from .st_create_session import create_session
> from .st_open import open_claim4
> from xdrdef.nfs4_const import *
>
> -from .environment import check, fail, create_file, open_file, close_file, do_getattrdict
> +from .environment import check, fail, create_file, open_file, close_file, do_getattrdict, close_file, write_file, read_file
> from xdrdef.nfs4_type import *
> import nfs_ops
> op = nfs_ops.NFS4ops()
> @@ -390,3 +390,51 @@ def testCbGetattrWithChange(t, env):
> if FATTR4_TIME_DELEG_MODIFY in attrs2:
> if attrs1[FATTR4_TIME_MODIFY] == attrs2[FATTR4_TIME_DELEG_MODIFY]:
> fail("Bad modify time: ", attrs1[FATTR4_TIME_MODIFY], " == ", attrs2[FATTR4_TIME_DELEG_MODIFY])
> +
> +def testDelegReadAfterClose(t, env):
> + """Test read with delegation stateid after close
> +
> + Create file with some data. Open the file for read, get delegation, close the file.
> + Tesr that reads with delegation stateid still works.
> +
> + FLAGS: deleg all
> + CODE: DELEG26
> + """
> + sess1 = env.c1.new_client_session(b"%s_1" % env.testname(t))
> +
> + name = env.testname(t)
> + owner = b"owner_%s" % name
> +
> + # craete file with some data
nit: "create"
> + res = create_file(sess1, owner)
> + check(res)
> +
> + fh = res.resarray[-1].object
> + stateid = res.resarray[-2].stateid
> +
> + res = write_file(sess1, fh, b'data', 0, stateid)
> + check(res)
> +
> + res = close_file(sess1, fh, stateid=stateid)
> + check(res)
> +
> +
> + # open file, get delegation, close the file
> + access = OPEN4_SHARE_ACCESS_READ | OPEN4_SHARE_ACCESS_WANT_READ_DELEG;
> + res = open_file(sess1, owner, access = access)
> + check(res)
> +
> + fh = res.resarray[-1].object
> + stateid = res.resarray[-2].stateid
> + delegstateid = res.resarray[-2].delegation.read.stateid
> +
It might be good to check that you got a delegation here, though the
test will obviously fail either way.
*
> + res = close_file(sess1, fh, stateid=stateid)
> + check(res)
> +
> + # Issue READ with delegation sateid
nit: "delegation stateid"
> + res = read_file(sess1, fh, 0, 10, delegstateid)
> + check(res)
> +
> + # cleanup: return delegation
> + res = sess1.compound([op.putfh(fh), op.delegreturn(delegstateid)])
> + check(res)
Looks reasonable otherwise.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2025-04-21 13:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 11:19 [PATCH] pynfs: add test for read with delegation stateid after close Tigran Mkrtchyan
2025-04-21 13:40 ` Jeff Layton [this message]
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=1b2c626c62b32568d5a722b50164a495ef10314c.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=calum.mackay@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=tigran.mkrtchyan@desy.de \
/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