From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>,
Dai Ngo <dai.ngo@oracle.com>,
neilb@suse.de, okorniev@redhat.com, tom@talpey.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/1] NFSD: detect mismatch of file handle and delegation stateid in OPEN op
Date: Tue, 10 Jun 2025 09:55:26 -0400 [thread overview]
Message-ID: <f73852d9bb7df41637e8b7263d30018db4ba08df.camel@kernel.org> (raw)
In-Reply-To: <0489c595-7acf-4ede-b50a-8c4e57f0b03c@oracle.com>
On Tue, 2025-06-10 at 09:50 -0400, Chuck Lever wrote:
> On 6/10/25 9:41 AM, Dai Ngo wrote:
> > When the client sends an OPEN with claim type CLAIM_DELEG_CUR_FH or
> > CLAIM_DELEGATION_CUR, the delegation stateid and the file handle
> > must belongs to the same file, otherwise return NFS4ERR_BAD_STATEID.
> >
> > Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
> > ---
> > fs/nfsd/nfs4state.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index 59a693f22452..be2ee641a22d 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -6318,6 +6318,11 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
> > status = nfs4_check_deleg(cl, open, &dp);
> > if (status)
> > goto out;
> > + if (dp && nfsd4_is_deleg_cur(open) &&
> > + (dp->dl_stid.sc_file != fp)) {
> > + status = nfserr_bad_stateid;
>
> How does the client react to NFS4ERR_BAD_STATEID ? Does it retry the
> same request or does it reflect the failure to the application?
>
I imagine this triggers the client to go into state recovery, which
won't be terribly helpful. Another reason to consider a different error
code. I suggest:
15.1.1.4. NFS4ERR_INVAL (Error Code 22)
The arguments for this operation are not valid for some reason, even though they do match those specified in the XDR definition for the request.
This might bubble up as an application error and get noticed that way.
>
> > + goto out;
> > + }
> > stp = nfsd4_find_and_lock_existing_open(fp, open);
> > } else {
> > open->op_file = NULL;
>
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-06-10 13:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 13:41 [PATCH 1/1] NFSD: detect mismatch of file handle and delegation stateid in OPEN op Dai Ngo
2025-06-10 13:50 ` Chuck Lever
2025-06-10 13:55 ` Jeff Layton [this message]
2025-06-10 13:50 ` Jeff Layton
2025-06-10 13:52 ` Chuck Lever
2025-06-10 13:59 ` Jeff Layton
2025-06-10 14:01 ` Chuck Lever
2025-06-10 14:12 ` Dai Ngo
2025-06-10 14:14 ` Chuck Lever
2025-06-10 14:53 ` Frank Filz
2025-06-10 15:05 ` Dai Ngo
2025-06-10 22:03 ` Calum Mackay
2025-06-11 0:35 ` Dai Ngo
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=f73852d9bb7df41637e8b7263d30018db4ba08df.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.