All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Coddington <bcodding@redhat.com>
To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com,
	zhangxiaoxu <zhangxiaoxu5@huawei.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] NFS4: Fix race to cl_confirm for v4.0 mount
Date: Thu,  7 Nov 2019 16:56:12 -0500	[thread overview]
Message-ID: <dfda8b5526136f03d108940f69256393dd4aa0a8.1573163645.git.bcodding@redhat.com> (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
order.

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 <bcodding@redhat.com>
Fixes: f02f3755dbd1 ("NFS4: Fix v4.0 client state corruption when mount")
Cc: stable@vger.kernel.org #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);
 	INIT_LIST_HEAD(&clp->cl_ds_clients);
 	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. */
 		nfs4_schedule_state_renewal(*result);
-
-		/* If the client state need to recover, do it. */
-		if (clp->cl_state)
-			nfs4_schedule_state_manager(clp);
 	}
 out:
 	return status;
-- 
2.20.1


                 reply	other threads:[~2019-11-07 14:45 UTC|newest]

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

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=dfda8b5526136f03d108940f69256393dd4aa0a8.1573163645.git.bcodding@redhat.com \
    --to=bcodding@redhat.com \
    --cc=anna.schumaker@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=zhangxiaoxu5@huawei.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.