Linux-NFS Archive on
 help / color / Atom feed
From: Benjamin Coddington <>
	zhangxiaoxu <>
Subject: [PATCH] NFS4: Fix race to cl_confirm for v4.0 mount
Date: Thu,  7 Nov 2019 16:56:12 -0500
Message-ID: <> (raw)

After commit f02f3755dbd1 ("NFS4: Fix v4.0 client state corruption when
mount") I have reports that sometimes all open() calls fail with -EPERM.
It appears that a race between the SETCLIENTID in trunking discovery and
another superflous SETCLIENTID triggered by immediately running the state
manager causes the nfs_client cl_confirm value to be stored in the wrong

It doesn't really make sense to invoke the state manager just to clear the
NFS4CLNT_LEASE_EXPIRED flag.  The flag has historically been used to signal
that a new client still needs to perform a SETCLIENTID before creating
state, but now that we have trunking discovery that flag is unnecessary.

Remove the flag, remove the call to schedule the state manager from
trunking discovery.

Signed-off-by: Benjamin Coddington <>
Fixes: f02f3755dbd1 ("NFS4: Fix v4.0 client state corruption when mount")
Cc: #v5.2
 fs/nfs/nfs4client.c | 1 -
 fs/nfs/nfs4state.c  | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index da6204025a2d..56cb3613082d 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -215,7 +215,6 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 	INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
 	rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
-	clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
 	clp->cl_minorversion = cl_init->minorversion;
 	clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
 	clp->cl_mig_gen = 1;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index cad4e064b328..e1d5dc4a31d7 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -180,10 +180,6 @@ int nfs40_discover_server_trunking(struct nfs_client *clp,
 		/* Sustain the lease, even if it's empty.  If the clientid4
 		 * goes stale it's of no use for trunking discovery. */
-		/* If the client state need to recover, do it. */
-		if (clp->cl_state)
-			nfs4_schedule_state_manager(clp);
 	return status;

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-NFS Archive on

Archives are clonable:
	git clone --mirror linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ \
	public-inbox-index linux-nfs

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone