From: Olga Kornievskaia <okorniev@redhat.com>
To: trondmy@kernel.org, anna@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v3 0/4] protect access to bc_serv
Date: Mon, 3 Nov 2025 17:13:35 -0500 [thread overview]
Message-ID: <20251103221339.45145-1-okorniev@redhat.com> (raw)
This patch series tries to address the problem that can arise when
the client is shutting down but gets a backchannel request. As it
stands now, In nfs4_shutdown_client() we call nfs4_destroy_callback()
which would destroy/free the bc_serv structure stored in an xprt
structure. But the xprt structure is still around for a bit until
it's destroyed. If we get backchannel request after svc_destroy()
is called, then in xprt_complete_bc_request() we are accessing freed
memory.
I propose to use bc_pa_lock lock to protect access to the bc_serv
structure and make sure we free/nullify bc_serv under the lock
and then access it under a lock in xs_complete_bs_request() and
rpcrdma_bc_receive_call().
-- v3 Addressing Anna'a comments. (1) created function for shared
code between tcp/rdma backchannel and (2) created
xprt_svc_destroy_nullify_bc() for both on/off CONFIG_SUNRPC_BACKCHANNEL
values.
-- v2 fixing kernel test bot reported compile error in usage of
xprt_svc_destroy_nullify_bc (CONFIG_SUNRPC_BACKCHANNEL toggle related)
Olga Kornievskaia (4):
NFSv4.1: pass transport for callback shutdown
SUNRPC: cleanup common code in backchannel request
SUNRPC: new helper function for stopping backchannel server
NFSv4.1: protect destroying and nullifying bc_serv structure
fs/nfs/callback.c | 7 +++++--
fs/nfs/callback.h | 3 ++-
fs/nfs/nfs4client.c | 9 ++++++--
include/linux/sunrpc/bc_xprt.h | 6 ++++++
net/sunrpc/backchannel_rqst.c | 35 ++++++++++++++++++++++++++++---
net/sunrpc/xprtrdma/backchannel.c | 8 ++-----
6 files changed, 54 insertions(+), 14 deletions(-)
--
2.47.1
next reply other threads:[~2025-11-03 22:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 22:13 Olga Kornievskaia [this message]
2025-11-03 22:13 ` [PATCH v3 1/4] NFSv4.1: pass transport for callback shutdown Olga Kornievskaia
2025-11-03 22:13 ` [PATCH v3 2/4] SUNRPC: cleanup common code in backchannel request Olga Kornievskaia
2025-11-03 22:13 ` [PATCH v3 3/4] SUNRPC: new helper function for stopping backchannel server Olga Kornievskaia
2025-11-04 16:52 ` kernel test robot
2025-11-04 20:17 ` Anna Schumaker
2025-11-03 22:13 ` [PATCH v3 4/4] NFSv4.1: protect destroying and nullifying bc_serv structure Olga Kornievskaia
2025-11-04 20:45 ` Anna Schumaker
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=20251103221339.45145-1-okorniev@redhat.com \
--to=okorniev@redhat.com \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).