From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: NeilBrown <neilb@suse.de>, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH 5.15.y 1/2] SUNRPC: make various functions static, or not exported.
Date: Tue, 8 Sep 2026 21:31:20 -0400 [thread overview]
Message-ID: <20260909013121.888599-1-sashal@kernel.org> (raw)
In-Reply-To: <2026090350-lip-cognitive-6180@gregkh>
From: NeilBrown <neilb@suse.de>
For this 5.15 dependency backport, keep only the svc_rqst_alloc() and
svc_rqst_free() visibility changes. Move the existing svc_rqst_free()
before its first caller, make both helpers static, and remove their
public declarations and exports. No functions are added.
Drop the unrelated rpcbind, authentication, socket-buffer and svc_drop()
hunks. In particular, preserve this tree's transport release in
svc_drop(), int authentication API, and page-based request cleanup.
The follow-on c479bde671cbe2f9e152834a8b0eb7c3c295bbaf patch expects the
newer scratch-folio spelling beside the argument/reply frees. Provide
locally scoped spelling aliases to the existing rq_scratch_page member
and put_page() operation; the scratch allocation remains an order-0
page and cleanup behavior is unchanged. Undefine both aliases after the
allocator. Bracket the existing page-release loop to preserve the
follow-on patch's insertion context.
This lets the unmodified target apply without importing folio support
or adding compatibility functions. The RCU callback and deferred
argument/reply frees remain changes for the target commit.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
include/linux/sunrpc/svc.h | 3 ---
net/sunrpc/svc.c | 45 +++++++++++++++++++++-----------------
2 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 57e0d9b7553b4..6ac0c829f61a3 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -476,11 +476,8 @@ void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
int svc_bind(struct svc_serv *serv, struct net *net);
struct svc_serv *svc_create(struct svc_program *, unsigned int,
int (*threadfn)(void *data));
-struct svc_rqst *svc_rqst_alloc(struct svc_serv *serv,
- struct svc_pool *pool, int node);
void svc_rqst_replace_page(struct svc_rqst *rqstp,
struct page *page);
-void svc_rqst_free(struct svc_rqst *);
void svc_exit_thread(struct svc_rqst *);
struct svc_serv * svc_create_pooled(struct svc_program *prog,
struct svc_stat *stats,
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 92d88aac2adff..4fc4a7f426a17 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -611,6 +611,13 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size, int node)
return pages == 0;
}
+/*
+ * This tree uses an order-0 page for the scratch buffer. Keep the folio
+ * spelling used by follow-on request cleanup fixes local to these helpers.
+ */
+#define rq_scratch_folio rq_scratch_page
+#define folio_put put_page
+
/*
* Release an RPC server buffer
*/
@@ -619,12 +626,25 @@ svc_release_buffer(struct svc_rqst *rqstp)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++)
+ for (i = 0; i < ARRAY_SIZE(rqstp->rq_pages); i++) {
if (rqstp->rq_pages[i])
put_page(rqstp->rq_pages[i]);
+ }
+}
+
+static void
+svc_rqst_free(struct svc_rqst *rqstp)
+{
+ svc_release_buffer(rqstp);
+ if (rqstp->rq_scratch_folio)
+ folio_put(rqstp->rq_scratch_folio);
+ kfree(rqstp->rq_resp);
+ kfree(rqstp->rq_argp);
+ kfree(rqstp->rq_auth_data);
+ kfree_rcu(rqstp, rq_rcu_head);
}
-struct svc_rqst *
+static struct svc_rqst *
svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
{
struct svc_rqst *rqstp;
@@ -658,7 +678,9 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
svc_rqst_free(rqstp);
return NULL;
}
-EXPORT_SYMBOL_GPL(svc_rqst_alloc);
+
+#undef folio_put
+#undef rq_scratch_folio
static struct svc_rqst *
svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
@@ -841,23 +863,6 @@ void svc_rqst_replace_page(struct svc_rqst *rqstp, struct page *page)
}
EXPORT_SYMBOL_GPL(svc_rqst_replace_page);
-/*
- * Called from a server thread as it's exiting. Caller must hold the "service
- * mutex" for the service.
- */
-void
-svc_rqst_free(struct svc_rqst *rqstp)
-{
- svc_release_buffer(rqstp);
- if (rqstp->rq_scratch_page)
- put_page(rqstp->rq_scratch_page);
- kfree(rqstp->rq_resp);
- kfree(rqstp->rq_argp);
- kfree(rqstp->rq_auth_data);
- kfree_rcu(rqstp, rq_rcu_head);
-}
-EXPORT_SYMBOL_GPL(svc_rqst_free);
-
void
svc_exit_thread(struct svc_rqst *rqstp)
{
--
2.53.0
next prev parent reply other threads:[~2026-09-09 1:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 14:06 FAILED: patch "[PATCH] sunrpc: defer rq_argp and rq_resp free until after RCU grace" failed to apply to 5.15-stable tree gregkh
2026-09-09 1:31 ` Sasha Levin [this message]
2026-09-09 1:31 ` [PATCH 5.15.y 2/2] sunrpc: defer rq_argp and rq_resp free until after RCU grace period Sasha Levin
2026-09-09 1:47 ` [PATCH 5.15.y] " Sasha Levin
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=20260909013121.888599-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=neilb@suse.de \
--cc=stable@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