Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: chuck.lever@oracle.com, jlayton@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/1] NFSD: cancel CB_RECAL call when nfs4_client is about to be destroyed
Date: Tue, 26 Mar 2024 11:12:58 -0700	[thread overview]
Message-ID: <1711476778-26181-1-git-send-email-dai.ngo@oracle.com> (raw)

Currently when a nfs4_client is destroyed we wait for the cb_recall
callback to complete before proceed. This adds unnecessary delay to the
__destroy_client call if there is problem communicating with the client.

This patch addresses this issue by cancelling the CB_RECALL call from
the workqueue when the nfs4_client is about to be destroyed.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfsd/nfs4callback.c | 6 ++++++
 fs/nfsd/nfs4state.c    | 2 ++
 fs/nfsd/state.h        | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index e5b50c96be6a..da9211f6fbbb 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1578,3 +1578,9 @@ void nfsd41_cb_recall_any_cancel(struct nfs4_client *clp)
 		nfsd41_cb_inflight_end(clp);
 	}
 }
+
+void nfsd4_cb_recall_cancel(struct nfs4_client *clp, struct nfs4_delegation *dp)
+{
+	if (cancel_delayed_work(&dp->dl_recall.cb_work))
+		nfsd41_cb_inflight_end(clp);
+}
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 0e1db57c9a19..f889e3addd71 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2378,6 +2378,8 @@ __destroy_client(struct nfs4_client *clp)
 	while (!list_empty(&reaplist)) {
 		dp = list_entry(reaplist.next, struct nfs4_delegation, dl_recall_lru);
 		list_del_init(&dp->dl_recall_lru);
+		if (dp->dl_recalled)
+			nfsd4_cb_recall_cancel(clp, dp);
 		destroy_unhashed_deleg(dp);
 	}
 	while (!list_empty(&clp->cl_revoked)) {
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 259b4af7d226..8b29bd3bbf1d 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -736,6 +736,8 @@ extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
 		const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op);
 extern bool nfsd4_run_cb(struct nfsd4_callback *cb);
 extern void nfsd41_cb_recall_any_cancel(struct nfs4_client *clp);
+extern void nfsd4_cb_recall_cancel(struct nfs4_client *clp,
+		struct nfs4_delegation *dp);
 extern int nfsd4_create_callback_queue(void);
 extern void nfsd4_destroy_callback_queue(void);
 extern void nfsd4_shutdown_callback(struct nfs4_client *);
-- 
2.39.3


                 reply	other threads:[~2024-03-26 18:13 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=1711476778-26181-1-git-send-email-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).