mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-22 20:30:58 +02:00
svcrdma: Fix leak of svc_rdma_recv_ctxt objects
Utilize the xpo_release_rqst transport method to ensure that each
rqstp's svc_rdma_recv_ctxt object is released even when the server
cannot return a Reply for that rqstp.
Without this fix, each RPC whose Reply cannot be sent leaks one
svc_rdma_recv_ctxt. This is a 2.5KB structure, a 4KB DMA-mapped
Receive buffer, and any pages that might be part of the Reply
message.
The leak is infrequent unless the network fabric is unreliable or
Kerberos is in use, as GSS sequence window overruns, which result
in connection loss, are more common on fast transports.
Fixes: 3a88092ee3
("svcrdma: Preserve Receive buffer until svc_rdma_sendto")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
@@ -223,6 +223,26 @@ void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma,
|
||||
svc_rdma_recv_ctxt_destroy(rdma, ctxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* svc_rdma_release_rqst - Release transport-specific per-rqst resources
|
||||
* @rqstp: svc_rqst being released
|
||||
*
|
||||
* Ensure that the recv_ctxt is released whether or not a Reply
|
||||
* was sent. For example, the client could close the connection,
|
||||
* or svc_process could drop an RPC, before the Reply is sent.
|
||||
*/
|
||||
void svc_rdma_release_rqst(struct svc_rqst *rqstp)
|
||||
{
|
||||
struct svc_rdma_recv_ctxt *ctxt = rqstp->rq_xprt_ctxt;
|
||||
struct svc_xprt *xprt = rqstp->rq_xprt;
|
||||
struct svcxprt_rdma *rdma =
|
||||
container_of(xprt, struct svcxprt_rdma, sc_xprt);
|
||||
|
||||
rqstp->rq_xprt_ctxt = NULL;
|
||||
if (ctxt)
|
||||
svc_rdma_recv_ctxt_put(rdma, ctxt);
|
||||
}
|
||||
|
||||
static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
|
||||
struct svc_rdma_recv_ctxt *ctxt)
|
||||
{
|
||||
@@ -820,6 +840,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
|
||||
__be32 *p;
|
||||
int ret;
|
||||
|
||||
rqstp->rq_xprt_ctxt = NULL;
|
||||
|
||||
spin_lock(&rdma_xprt->sc_rq_dto_lock);
|
||||
ctxt = svc_rdma_next_recv_ctxt(&rdma_xprt->sc_read_complete_q);
|
||||
if (ctxt) {
|
||||
|
Reference in New Issue
Block a user