From: "J. Bruce Fields" <bfields@fieldses.org>
To: Joe Perches <joe@perches.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
"David S. Miller" <davem@davemloft.net>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Tom Tucker <tom@ogc.us>,
steved@redhat.com, Tom Talpey <ttalpey@microsoft.com>
Subject: Re: [PATCH] sunrpc: verbs: Avoid 1kb stack
Date: Tue, 8 Jan 2013 09:46:04 -0500 [thread overview]
Message-ID: <20130108144604.GB16343@fieldses.org> (raw)
In-Reply-To: <1357587696.21481.48.camel@joe-AO722>
On Mon, Jan 07, 2013 at 11:41:36AM -0800, Joe Perches wrote:
> 16 * 64 is a bit much.
> Use kmalloc_array instead.
I thought there was some reason we didn't do this.
Grepping up through the callers.... It looks like the result is
xprt_rdma_send_request returns -EIO, and as far as I can tell that gets
passed up to the application on the client. That doesn't sound right.
--b.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> net/sunrpc/xprtrdma/verbs.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 745973b..9cfebb4 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -1736,8 +1736,13 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg,
> int mem_priv = (writing ? IB_ACCESS_REMOTE_WRITE :
> IB_ACCESS_REMOTE_READ);
> struct rpcrdma_mr_seg *seg1 = seg;
> - struct ib_phys_buf ipb[RPCRDMA_MAX_DATA_SEGS];
> int len, i, rc = 0;
> + struct ib_phys_buf *ipb = kmalloc_array(RPCRDMA_MAX_DATA_SEGS,
> + sizeof(*ipb),
> + GFP_KERNEL);
> +
> + if (!ipb)
> + return -ENOMEM;
>
> if (*nsegs > RPCRDMA_MAX_DATA_SEGS)
> *nsegs = RPCRDMA_MAX_DATA_SEGS;
> @@ -1770,6 +1775,9 @@ rpcrdma_register_default_external(struct rpcrdma_mr_seg *seg,
> seg1->mr_len = len;
> }
> *nsegs = i;
> +
> + kfree(ipb);
> +
> return rc;
> }
>
>
>
next prev parent reply other threads:[~2013-01-08 14:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 19:41 Joe Perches
2013-01-08 14:46 ` J. Bruce Fields [this message]
2013-01-08 18:09 ` Joe Perches
2013-01-08 22:52 ` Tom Talpey
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=20130108144604.GB16343@fieldses.org \
--to=bfields@fieldses.org \
--cc=Trond.Myklebust@netapp.com \
--cc=davem@davemloft.net \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=steved@redhat.com \
--cc=tom@ogc.us \
--cc=ttalpey@microsoft.com \
/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
all inboxes | Powered by JetHome®