svc: Move kfree of deferral record to common code
authorTom Tucker <tom@opengridcomputing.com>
Mon, 5 Jan 2009 17:12:52 +0000 (11:12 -0600)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Wed, 7 Jan 2009 20:40:45 +0000 (15:40 -0500)
The rqstp structure has a pointer to a svc_deferred_req record
that is allocated when requests are deferred. This record is common
to all transports and can be freed in common code.

Move the kfree of the rq_deferred to the common svc_xprt_release
function.

This also fixes a memory leak in the RDMA transport which does not
kfree the dr structure in it's version of the xpo_release_rqst callback.

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
net/sunrpc/svc_xprt.c
net/sunrpc/svcsock.c

index 3fe4f10..2961961 100644 (file)
@@ -448,6 +448,9 @@ static void svc_xprt_release(struct svc_rqst *rqstp)
 
        rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
 
+       kfree(rqstp->rq_deferred);
+       rqstp->rq_deferred = NULL;
+
        svc_free_res_pages(rqstp);
        rqstp->rq_res.page_len = 0;
        rqstp->rq_res.page_base = 0;
index cccfa7d..3c10340 100644 (file)
@@ -103,7 +103,6 @@ static void svc_reclassify_socket(struct socket *sock)
 static void svc_release_skb(struct svc_rqst *rqstp)
 {
        struct sk_buff *skb = rqstp->rq_xprt_ctxt;
-       struct svc_deferred_req *dr = rqstp->rq_deferred;
 
        if (skb) {
                struct svc_sock *svsk =
@@ -113,10 +112,6 @@ static void svc_release_skb(struct svc_rqst *rqstp)
                dprintk("svc: service %p, releasing skb %p\n", rqstp, skb);
                skb_free_datagram(svsk->sk_sk, skb);
        }
-       if (dr) {
-               rqstp->rq_deferred = NULL;
-               kfree(dr);
-       }
 }
 
 union svc_pktinfo_u {