Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH 0/3] rpcrdma: Fix device removal races and endpoint cleanup
@ 2026-10-23 12:50 Li Xiasong
  2026-10-23 12:50 ` [PATCH 1/3] rpcrdma: Serialize notification registration with device removal Li Xiasong
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Li Xiasong @ 2026-10-23 12:50 UTC (permalink / raw)
  To: Chuck Lever, Jeff Layton, NeilBrown, Olga Kornievskaia, Dai Ngo,
	Tom Talpey, Trond Myklebust, Anna Schumaker
  Cc: linux-nfs, linux-rdma, stable, yuehaibing, zhangchangzhong,
	weiyongjun1

This series fixes races and endpoint cleanup issues in the RPC-over-RDMA
device removal paths.

Notification registration is not serialized with device removal. Removal
can free the per-device private data while registration is still using it,
or finish walking the notification array before a new registration is
published. In addition, the notification walk does not hold references to
the objects containing the notifications, allowing concurrent unregister
and teardown to free an object before its removal callback is invoked.

On the client side, the device removal callback only forces a transport
disconnect. A connect worker waiting for re_connect_status to change can
remain asleep, preventing endpoint cleanup. An established endpoint can
also retain its connection reference because CMA suppresses subsequent
DISCONNECTED callbacks after entering the device removal state.

Patch 1 serializes notification registration with the transition to device
removal and protects access to the per-device private data.

Patch 2 uses the same mutex to serialize notification reference acquisition
with unregister, and holds a reference across each removal callback.
Callbacks and reference release run outside the mutex to allow teardown
to unregister notifications.

Patch 3 records device removal in the endpoint connection status and wakes
a waiting connect worker. For an established connection, atomic state
transitions ensure that the first path to leave the established state
releases the connection reference exactly once. It also handles connection
establishment racing with removal and propagates final endpoint release
to CMA where needed.

The patches are ordered by dependency: patch 2 uses the serialization
introduced by patch 1, and patch 3 relies on the callback lifetime
protection added by patch 2.

Li Xiasong (3):
  rpcrdma: Serialize notification registration with device removal
  rpcrdma: Pin notifications during removal callbacks
  xprtrdma: Wake connect worker on device removal

 include/linux/sunrpc/rdma_rn.h           |  6 ++-
 net/sunrpc/xprtrdma/ib_client.c          | 56 +++++++++++++++++----
 net/sunrpc/xprtrdma/svc_rdma_transport.c | 19 +++++++-
 net/sunrpc/xprtrdma/verbs.c              | 62 +++++++++++++++++++-----
 4 files changed, 119 insertions(+), 24 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-23 19:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 12:50 [PATCH 0/3] rpcrdma: Fix device removal races and endpoint cleanup Li Xiasong
2026-10-23 12:50 ` [PATCH 1/3] rpcrdma: Serialize notification registration with device removal Li Xiasong
2026-10-23 12:38   ` sashiko-bot
2026-10-23 19:28   ` Chuck Lever
2026-10-23 12:50 ` [PATCH 2/3] rpcrdma: Pin notifications during removal callbacks Li Xiasong
2026-10-23 12:49   ` sashiko-bot
2026-10-23 19:31   ` Chuck Lever
2026-10-23 12:50 ` [PATCH 3/3] xprtrdma: Wake connect worker on device removal Li Xiasong
2026-10-23 12:49   ` sashiko-bot
2026-10-23 19:35   ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox