From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
Benjamin Coddington <bcodding@redhat.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH RFC 1/9] sunrpc: transplant shutdown_client() to sunrpc module
Date: Mon, 17 Mar 2025 16:59:53 -0400 [thread overview]
Message-ID: <20250317-rpc-shutdown-v1-1-85ba8e20b75d@kernel.org> (raw)
In-Reply-To: <20250317-rpc-shutdown-v1-0-85ba8e20b75d@kernel.org>
This is really a sunrpc-level function, and in later patches we'll need
to call this routine from lockd as well. Move it to the sunrpc module,
rename and export it.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfs/sysfs.c | 19 ++++---------------
include/linux/sunrpc/sched.h | 1 +
net/sunrpc/clnt.c | 12 ++++++++++++
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/fs/nfs/sysfs.c b/fs/nfs/sysfs.c
index 7b59a40d40c061a41b0fbde91aa006314f02c1fb..c29c5fd639554461bdcd9ff612726194910d85b5 100644
--- a/fs/nfs/sysfs.c
+++ b/fs/nfs/sysfs.c
@@ -217,17 +217,6 @@ void nfs_netns_sysfs_destroy(struct nfs_net *netns)
}
}
-static bool shutdown_match_client(const struct rpc_task *task, const void *data)
-{
- return true;
-}
-
-static void shutdown_client(struct rpc_clnt *clnt)
-{
- clnt->cl_shutdown = 1;
- rpc_cancel_tasks(clnt, -EIO, shutdown_match_client, NULL);
-}
-
static ssize_t
shutdown_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
@@ -258,14 +247,14 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr,
goto out;
server->flags |= NFS_MOUNT_SHUTDOWN;
- shutdown_client(server->client);
- shutdown_client(server->nfs_client->cl_rpcclient);
+ rpc_clnt_shutdown(server->client);
+ rpc_clnt_shutdown(server->nfs_client->cl_rpcclient);
if (!IS_ERR(server->client_acl))
- shutdown_client(server->client_acl);
+ rpc_clnt_shutdown(server->client_acl);
if (server->nlm_host)
- shutdown_client(server->nlm_host->h_rpcclnt);
+ rpc_clnt_shutdown(server->nlm_host->h_rpcclnt);
out:
return count;
}
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index eac57914dcf3200c1a6ed39ab030e3fe8b4da3e1..fe7c39a17ce44ec68c0cf057133d0f8e7f0ae797 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -232,6 +232,7 @@ unsigned long rpc_cancel_tasks(struct rpc_clnt *clnt, int error,
bool (*fnmatch)(const struct rpc_task *,
const void *),
const void *data);
+void rpc_clnt_shutdown(struct rpc_clnt *clnt);
void rpc_execute(struct rpc_task *);
void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 2fe88ea79a70c134e58abfb03fca230883eddf1f..0028858b12d97e7b45f4c24cfbd761ba2a734b32 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -934,6 +934,18 @@ unsigned long rpc_cancel_tasks(struct rpc_clnt *clnt, int error,
}
EXPORT_SYMBOL_GPL(rpc_cancel_tasks);
+static bool shutdown_match_client(const struct rpc_task *task, const void *data)
+{
+ return true;
+}
+
+void rpc_clnt_shutdown(struct rpc_clnt *clnt)
+{
+ clnt->cl_shutdown = 1;
+ rpc_cancel_tasks(clnt, -EIO, shutdown_match_client, NULL);
+}
+EXPORT_SYMBOL_GPL(rpc_clnt_shutdown);
+
static int rpc_clnt_disconnect_xprt(struct rpc_clnt *clnt,
struct rpc_xprt *xprt, void *dummy)
{
--
2.48.1
next prev parent reply other threads:[~2025-03-17 21:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 20:59 [PATCH RFC 0/9] nfs/sunrpc: stop holding netns references in client-side NFS and RPC objects Jeff Layton
2025-03-17 20:59 ` Jeff Layton [this message]
2025-03-17 20:59 ` [PATCH RFC 2/9] lockd: add a helper to shut down rpc_clnt in nlm_host Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 3/9] lockd: don't #include debug.h from lockd.h Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 4/9] nfs: transplant nfs_server shutdown into a helper function Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 5/9] nfs: don't hold a reference to struct net in struct nfs_client Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 6/9] auth_gss: shut down gssproxy rpc_clnt in net pre_exit Jeff Layton
2025-03-17 20:59 ` [PATCH RFC 7/9] auth_gss: don't hold a net reference in gss_auth Jeff Layton
2025-03-17 21:00 ` [PATCH RFC 8/9] sunrpc: don't hold a struct net reference in rpc_xprt Jeff Layton
2025-03-17 21:00 ` [PATCH RFC 9/9] sunrpc: don't upgrade passive net reference in xs_create_sock Jeff Layton
2025-03-17 21:28 ` Trond Myklebust
2025-03-17 21:36 ` Jeff Layton
2025-03-17 21:37 ` Trond Myklebust
2025-03-17 21:41 ` Jeff Layton
2025-03-17 21:35 ` [PATCH RFC 0/9] nfs/sunrpc: stop holding netns references in client-side NFS and RPC objects Trond Myklebust
2025-03-17 21:57 ` Jeff Layton
2025-03-17 22:11 ` Trond Myklebust
2025-03-18 11:30 ` Jeff Layton
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=20250317-rpc-shutdown-v1-1-85ba8e20b75d@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=bcodding@redhat.com \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=okorniev@redhat.com \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--cc=trondmy@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