All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2 02/14] NFSD: Convert the callback workqueue to use delayed_work
Date: Fri, 26 Jan 2024 12:45:23 -0500	[thread overview]
Message-ID: <170629112325.20612.15691160218281370004.stgit@manet.1015granger.net> (raw)
In-Reply-To: <170629091560.20612.563908774748586696.stgit@manet.1015granger.net>

From: Chuck Lever <chuck.lever@oracle.com>

Normally, NFSv4 callback operations are supposed to be sent to the
client as soon as they are queued up.

In a moment, I will introduce a recovery path where the server has
to wait for the client to reconnect. We don't want a hard busy wait
here -- the callback should be requeued to try again in several
milliseconds.

For now, convert nfsd4_callback from struct work_struct to struct
delayed_work, and queue with a zero delay argument. This should
avoid behavior changes for current operation.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4callback.c |    6 +++---
 fs/nfsd/state.h        |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 43b0a34a5d5b..1ed2512b3648 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -887,7 +887,7 @@ static struct workqueue_struct *callback_wq;
 
 static bool nfsd4_queue_cb(struct nfsd4_callback *cb)
 {
-	return queue_work(callback_wq, &cb->cb_work);
+	return queue_delayed_work(callback_wq, &cb->cb_work, 0);
 }
 
 static void nfsd41_cb_inflight_begin(struct nfs4_client *clp)
@@ -1370,7 +1370,7 @@ static void
 nfsd4_run_cb_work(struct work_struct *work)
 {
 	struct nfsd4_callback *cb =
-		container_of(work, struct nfsd4_callback, cb_work);
+		container_of(work, struct nfsd4_callback, cb_work.work);
 	struct nfs4_client *clp = cb->cb_clp;
 	struct rpc_clnt *clnt;
 	int flags;
@@ -1415,7 +1415,7 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
 	cb->cb_msg.rpc_argp = cb;
 	cb->cb_msg.rpc_resp = cb;
 	cb->cb_ops = ops;
-	INIT_WORK(&cb->cb_work, nfsd4_run_cb_work);
+	INIT_DELAYED_WORK(&cb->cb_work, nfsd4_run_cb_work);
 	cb->cb_seq_status = 1;
 	cb->cb_status = 0;
 	cb->cb_need_restart = false;
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 41bdc913fa71..87c4372ba36a 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -68,7 +68,7 @@ struct nfsd4_callback {
 	struct nfs4_client *cb_clp;
 	struct rpc_message cb_msg;
 	const struct nfsd4_callback_ops *cb_ops;
-	struct work_struct cb_work;
+	struct delayed_work cb_work;
 	int cb_seq_status;
 	int cb_status;
 	bool cb_need_restart;



  parent reply	other threads:[~2024-01-26 17:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 17:45 [PATCH 2 00/14] NFSD backchannel fixes Chuck Lever
2024-01-26 17:45 ` [PATCH 2 01/14] NFSD: Reset cb_seq_status after NFS4ERR_DELAY Chuck Lever
2024-01-26 17:45 ` Chuck Lever [this message]
2024-01-26 19:09   ` [PATCH 2 02/14] NFSD: Convert the callback workqueue to use delayed_work Jeff Layton
2024-01-26 17:45 ` [PATCH 2 03/14] NFSD: Reschedule CB operations when backchannel rpc_clnt is shut down Chuck Lever
2024-01-26 19:10   ` Jeff Layton
2024-01-26 17:45 ` [PATCH 2 04/14] NFSD: Retransmit callbacks after client reconnects Chuck Lever
2024-01-26 17:45 ` [PATCH 2 05/14] NFSD: Add nfsd_seq4_status trace event Chuck Lever
2024-01-26 17:45 ` [PATCH 2 06/14] NFSD: Replace dprintks in nfsd4_cb_sequence_done() Chuck Lever
2024-01-26 17:45 ` [PATCH 2 07/14] NFSD: Rename nfsd_cb_state trace point Chuck Lever
2024-01-26 17:46 ` [PATCH 2 08/14] NFSD: Add callback operation lifetime trace points Chuck Lever
2024-01-26 17:46 ` [PATCH 2 09/14] SUNRPC: Remove EXPORT_SYMBOL_GPL for svc_process_bc() Chuck Lever
2024-01-26 17:46 ` [PATCH 2 10/14] NFSD: Remove unused @reason argument Chuck Lever
2024-01-26 17:46 ` [PATCH 2 11/14] NFSD: Replace comment with lockdep assertion Chuck Lever
2024-01-26 17:46 ` [PATCH 2 12/14] NFSD: Remove BUG_ON in nfsd4_process_cb_update() Chuck Lever
2024-01-26 17:46 ` [PATCH 2 13/14] SUNRPC: Remove stale comments Chuck Lever
2024-01-26 17:46 ` [PATCH 2 14/14] NFSD: Remove redundant cb_seq_status initialization Chuck Lever
2024-01-26 20:10 ` [PATCH 2 00/14] NFSD backchannel fixes Benjamin Coddington

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=170629112325.20612.15691160218281370004.stgit@manet.1015granger.net \
    --to=cel@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 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.