Files
Tim Menninger 9d84719d34 SUNRPC: add request-scoped disconnects when cancelling tasks
rpc_cancel_tasks() allows callers to cancel a selected set of RPC tasks,
but callers that also need to tear down the connection currently have to
disconnect at the rpc_clnt level.

That is broader than necessary for clients with multiple transports. A
cancelled request is associated with a specific rpc_xprt and records the
connection generation on which it was transmitted in rq_connect_cookie.

Add rpc_cancel_tasks_and_disconnect() to cancel matching tasks and mark
matching requests that remain on the transport transmit or receive queues
for conditional transport disconnect when the request is released.

Store the disconnect indication in struct rpc_rqst rather than struct
rpc_task. An RPC task can release one request and later acquire another,
so task-scoped state could otherwise be consumed by a successor request
and disconnect the wrong transport generation.

After cancelling matching tasks, walk the client's transports and mark
matching requests belonging to that client that remain on the transmit
or receive queues. An rpc_xprt may be shared by multiple rpc_clnt
instances, so requests belonging to other clients are not marked.

When a marked request is released, consume the marker under the existing
transport_lock critical section. If the request was transmitted, call
xprt_conditional_disconnect_locked() with its rq_connect_cookie. The
disconnect is skipped if that cookie no longer matches the transport's
current connection generation.

This adds no lock acquisition to the normal request-release path.
Requests that were never transmitted do not trigger this additional
disconnect.

Signed-off-by: Tim Menninger <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
2026-11-10 15:43:05 -05:00
..
…
…
…