Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Tom Tucker <tom@opengridcomputing.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] svc: Move kfree of deferral record to common code
Date: Mon, 5 Jan 2009 13:34:52 -0500	[thread overview]
Message-ID: <20090105183452.GA19151@fieldses.org> (raw)
In-Reply-To: <49623F94.6000202@opengridcomputing.com>

On Mon, Jan 05, 2009 at 11:12:52AM -0600, Tom Tucker wrote:
>
> 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>

Looks good, thanks--applied.  (But, minor whine: your mailer seems to
have changed all the tabs in the messages to spaces, so I had to apply
the patch by hand.)

--b.

>
> ---
>  net/sunrpc/svc_xprt.c |    3 +++
>  net/sunrpc/svcsock.c  |    5 -----
>  2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
> index 375a695..de16a97 100644
> --- a/net/sunrpc/svc_xprt.c
> +++ b/net/sunrpc/svc_xprt.c
> @@ -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;
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index ef3238d..e59a88e 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -102,7 +102,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 =
> @@ -112,10 +111,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 {

      reply	other threads:[~2009-01-05 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 17:12 [PATCH] svc: Move kfree of deferral record to common code Tom Tucker
2009-01-05 18:34 ` J. Bruce Fields [this message]

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=20090105183452.GA19151@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tom@opengridcomputing.com \
    --cc=trond.myklebust@fys.uio.no \
    /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