linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: bfields@fieldses.org, jlayton@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] nfsd: CB_RECALL can race with FREE_STATEID
Date: Thu, 18 Apr 2019 09:24:00 -0400	[thread overview]
Message-ID: <20190418132400.24161-1-smayhew@redhat.com> (raw)

While trying to track down some issues involving large numbers of
delegations being recalled/revoked, I caught the server setting
SEQ4_STATUS_CB_PATH_DOWN while the client was actively responding to
CB_RECALLs.  It turns out that the client had already done a
TEST_STATEID and FREE_STATEID for a delegation being recalled by the
time it received the CB_RECALL.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 fs/nfsd/nfs4state.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6a45fb00c5fc..e88e429133a8 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3958,6 +3958,14 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
 			rpc_delay(task, 2 * HZ);
 			return 0;
 		}
+		/*
+		 * Race: client may have done a FREE_STATEID before
+		 * receiving the CB_RECALL.
+		 */
+		if (dp->dl_stid.sc_type == NFS4_REVOKED_DELEG_STID &&
+				refcount_read(&dp->dl_stid.sc_count) == 1 &&
+				list_empty(&dp->dl_recall_lru))
+			return 1;
 		/*FALLTHRU*/
 	default:
 		return -1;
-- 
2.17.2


             reply	other threads:[~2019-04-18 13:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 13:24 Scott Mayhew [this message]
2019-04-18 15:13 ` [PATCH] nfsd: CB_RECALL can race with FREE_STATEID J. Bruce Fields
2019-04-18 20:50   ` Scott Mayhew
2019-04-18 21:37     ` J. Bruce Fields
2019-04-30 18:58       ` Scott Mayhew
2019-04-30 19:03         ` Trond Myklebust
2019-05-02 11:35           ` Scott Mayhew
2019-05-02 11:49             ` Trond Myklebust
2019-04-18 22:03     ` Trond Myklebust
2019-04-18 23:42       ` bfields
2019-04-30 18:46       ` Scott Mayhew

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=20190418132400.24161-1-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).