Linux NFS development
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"jlayton@kernel.org" <jlayton@kernel.org>
Cc: "josef@toxicpanda.com" <josef@toxicpanda.com>
Subject: Re: [PATCH v2 3/4] NFSv4: clp->cl_cons_state < 0 signifies an invalid nfs_client
Date: Tue, 25 Mar 2025 18:48:50 +0000	[thread overview]
Message-ID: <bbfa25ef22c7b7b826d91d8cad71b5de2590ec92.camel@hammerspace.com> (raw)
In-Reply-To: <202d8ae85ba2b1cfb454356a2781ef5b31ff37be.camel@kernel.org>

On Tue, 2025-03-25 at 13:59 -0400, Jeff Layton wrote:
> On Tue, 2025-03-25 at 12:17 -0400, trondmy@kernel.org wrote:
> > From: Trond Myklebust <trond.myklebust@hammerspace.com>
> > 
> > If someone calls nfs_mark_client_ready(clp, status) with a negative
> > value for status, then that should signal that the nfs_client is no
> > longer valid.
> > 
> > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > ---
> >  fs/nfs/nfs4state.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> > index 542cdf71229f..738eb2789266 100644
> > --- a/fs/nfs/nfs4state.c
> > +++ b/fs/nfs/nfs4state.c
> > @@ -1198,7 +1198,7 @@ void nfs4_schedule_state_manager(struct
> > nfs_client *clp)
> >  	struct rpc_clnt *clnt = clp->cl_rpcclient;
> >  	bool swapon = false;
> >  
> > -	if (clnt->cl_shutdown)
> > +	if (clnt->cl_shutdown || clp->cl_cons_state < 0)
> 
> Would it be simpler to just set cl_shutdown when this occurs instead
> of
> having to check cl_cons_state as well?

Do we need the check for clnt->cl_shutdown at all here? I'd expect any
caller of this function to already hold a reference to the client,
which means that the RPC client should still be up.

I'm a little suspicious of the check in nfs41_sequence_call_done() too.

> 
> >  		return;
> >  
> >  	set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
> > @@ -1403,7 +1403,7 @@ int nfs4_schedule_stateid_recovery(const
> > struct nfs_server *server, struct nfs4_
> >  	dprintk("%s: scheduling stateid recovery for server %s\n",
> > __func__,
> >  			clp->cl_hostname);
> >  	nfs4_schedule_state_manager(clp);
> > -	return 0;
> > +	return clp->cl_cons_state < 0 ? clp->cl_cons_state : 0;
> >  }
> >  EXPORT_SYMBOL_GPL(nfs4_schedule_stateid_recovery);
> >  
> 

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2025-03-25 18:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 16:17 [PATCH v2 0/4] Ensure that ENETUNREACH terminates state recovery trondmy
2025-03-25 16:17 ` [PATCH v2 1/4] SUNRPC: rpcbind should never reset the port to the value '0' trondmy
2025-03-25 17:56   ` Jeff Layton
2025-03-25 16:17 ` [PATCH v2 2/4] SUNRPC: rpc_clnt_set_transport() must not change the autobind setting trondmy
2025-03-25 17:55   ` Jeff Layton
2025-03-25 16:17 ` [PATCH v2 3/4] NFSv4: clp->cl_cons_state < 0 signifies an invalid nfs_client trondmy
2025-03-25 17:59   ` Jeff Layton
2025-03-25 18:48     ` Trond Myklebust [this message]
2025-03-25 19:44       ` Jeff Layton
2025-03-25 20:30         ` Trond Myklebust
2025-03-25 16:17 ` [PATCH v2 4/4] NFSv4: Treat ENETUNREACH errors as fatal for state recovery trondmy
2025-03-25 18:04   ` Jeff Layton
2025-03-25 18:50     ` Trond Myklebust
2025-03-25 19:26       ` Jeff Layton
2025-03-25 19:40 ` Concerns about ENETUNREACH patch series Re: [PATCH v2 0/4] Ensure that ENETUNREACH terminates " Lionel Cons
2025-03-25 20:42   ` Trond Myklebust

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=bbfa25ef22c7b7b826d91d8cad71b5de2590ec92.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=jlayton@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-nfs@vger.kernel.org \
    /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