From: Jeff Layton <jlayton@kernel.org>
To: NeilBrown <neil@brown.name>, Chuck Lever <chuck.lever@oracle.com>
Cc: Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] nfsd: stop pretending that we cache the SEQUENCE reply.
Date: Tue, 14 Oct 2025 09:47:20 -0400 [thread overview]
Message-ID: <f935adaca9fc77a39eaa6e6ab164505d0e26488c.camel@kernel.org> (raw)
In-Reply-To: <20251014000544.1567520-3-neilb@ownmail.net>
On Tue, 2025-10-14 at 11:04 +1100, NeilBrown wrote:
> From: NeilBrown <neil@brown.name>
>
> nfsd does not cache the reply to a SEQUENCE. When replayed, the
> SEQUENCE op itself is replay.
>
> So removing the code and comments which seem to imply that we do, and
> detect the case of a SOLO sequence to avoid looking a the cache.
>
> Signed-off-by: NeilBrown <neil@brown.name>
> ---
> fs/nfsd/nfs4state.c | 7 ++-----
> fs/nfsd/xdr4.h | 20 ++++++--------------
> 2 files changed, 8 insertions(+), 19 deletions(-)
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 1c01836e8507..b51a37ad70aa 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3530,11 +3530,8 @@ nfsd4_enc_sequence_replay(struct nfsd4_compoundargs *args,
> return op->status;
> if (args->opcnt == 1) {
> /*
> - * The original operation wasn't a solo sequence--we
> - * always cache those--so this retry must not match the
> - * original:
> + * We will simply replay the SEQUENCE.
> */
> - op->status = nfserr_seq_false_retry;
> } else {
> op = &args->ops[resp->opcnt++];
> op->status = nfserr_retry_uncached_rep;
> @@ -3559,7 +3556,7 @@ nfsd4_replay_cache_entry(struct nfsd4_compoundres *resp,
> dprintk("--> %s slot %p\n", __func__, slot);
>
> status = nfsd4_enc_sequence_replay(resp->rqstp->rq_argp, resp);
> - if (status)
> + if (status || !slot->sl_datalen)
> return status;
>
> p = xdr_reserve_space(xdr, slot->sl_datalen);
> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
> index ee0570cbdd9e..390bfb0ba13f 100644
> --- a/fs/nfsd/xdr4.h
> +++ b/fs/nfsd/xdr4.h
> @@ -923,25 +923,17 @@ struct nfsd4_compoundres {
> struct nfsd4_compound_state cstate;
> };
>
> -static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
> -{
> - struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
> - return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
> -}
> -
> /*
> * The session reply cache only needs to cache replies that the client
> - * actually asked us to. But it's almost free for us to cache compounds
> - * consisting of only a SEQUENCE op, so we may as well cache those too.
> - * Also, the protocol doesn't give us a convenient response in the case
> - * of a replay of a solo SEQUENCE op that wasn't cached
> - * (RETRY_UNCACHED_REP can only be returned in the second op of a
> - * compound).
> + * actually asked us to.
> + * This doesn't apply to SEQUENCE. We must always record in the slot
> + * that we have received a SEQUENCE, and must always respond
> + * successfully to a replayed successful SEQUENCE - that is handled
> + * separately from the sl_data cache.
> */
> static inline bool nfsd4_cache_this(struct nfsd4_compoundres *resp)
> {
> - return (resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
> - || nfsd4_is_solo_sequence(resp);
> + return resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS;
> }
>
> static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
Again, this makes more sense to me.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-10-14 13:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 0:04 [PATCH 0/2] nfsd: fix up SEQUENCE replay NeilBrown
2025-10-14 0:04 ` [PATCH 1/2] nfsd: ensure SEQUENCE replay sends a valid reply NeilBrown
2025-10-14 13:44 ` Jeff Layton
2025-10-14 13:57 ` Chuck Lever
2025-10-14 14:57 ` Olga Kornievskaia
2025-10-14 22:49 ` NeilBrown
2025-10-14 0:04 ` [PATCH 2/2] nfsd: stop pretending that we cache the SEQUENCE reply NeilBrown
2025-10-14 13:47 ` Jeff Layton [this message]
2025-10-14 14:25 ` Chuck Lever
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=f935adaca9fc77a39eaa6e6ab164505d0e26488c.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox