public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xen.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] xen-blkback: check the number of iovecs before allocating a bios
Date: Mon, 24 Jun 2013 09:28:41 -0400	[thread overview]
Message-ID: <20130624132841.GA21144@phenom.dumpdata.com> (raw)
In-Reply-To: <1371887957-18301-1-git-send-email-roger.pau@citrix.com>

On Sat, Jun 22, 2013 at 09:59:17AM +0200, Roger Pau Monne wrote:
> With the introduction of indirect segments we can receive requests
> with a number of segments bigger than the maximum number of allowed
> iovecs in a bios, so make sure that blkback doesn't try to allocate a
> bios with more iovecs than BIO_MAX_PAGES

Shouldn't we just gate the feature-indirect-descriptor value to
take this into account?

What happens if the nseg is > BIO_MAX_PAGES? Do we "lose" the request
for the remaining segments?

> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  drivers/block/xen-blkback/blkback.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index d622d86..b3897f5d 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -1236,7 +1236,8 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
>  				     seg[i].nsec << 9,
>  				     seg[i].offset) == 0)) {
>  
> -			bio = bio_alloc(GFP_KERNEL, nseg-i);
> +			int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES);
> +			bio = bio_alloc(GFP_KERNEL, nr_iovecs);
>  			if (unlikely(bio == NULL))
>  				goto fail_put_bio;
>  
> -- 
> 1.7.7.5 (Apple Git-26)
> 

  reply	other threads:[~2013-06-24 13:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 10:56 [PATCH 0/4] xen-block: bug fixes for indirect-descriptors Roger Pau Monne
2013-06-21 10:56 ` [PATCH 1/4] xen-blkback: workaround compiler bug in gcc 4.1 Roger Pau Monne
2013-06-21 10:56 ` [PATCH 2/4] xen-blkfront: set blk_queue_max_hw_sectors correctly Roger Pau Monne
2013-06-21 10:56 ` [PATCH 3/4] xen-blkback: check the number of iovecs before allocating a bios Roger Pau Monne
2013-06-21 11:46   ` [Xen-devel] " Jan Beulich
2013-06-21 12:02     ` Roger Pau Monné
2013-06-22  7:59   ` [PATCH v2 " Roger Pau Monne
2013-06-24 13:28     ` Konrad Rzeszutek Wilk [this message]
2013-06-25  8:03       ` Roger Pau Monné
2013-06-21 10:56 ` [PATCH 4/4] xen-blkfront: increase the default number of indirect segments Roger Pau Monne
2013-06-21 11:49   ` [Xen-devel] " Jan Beulich

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=20130624132841.GA21144@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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