diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-02-02 16:51:24 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-07 01:48:46 -0500 |
commit | 5c55125f4794f4e77574fc09839cb47b0eb45b06 (patch) | |
tree | 2e35bfcfe983dee5d5afbf0437dd3ff5f9a4938a | |
parent | 3011684c0b0b77b0f88113ef1c15b18befc6734a (diff) |
iblock: fix handling of large requests
Requesting to many bvecs upsets bio_alloc_bioset, so limit the number we ask
for to the amount it can handle.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_iblock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index d43d5eb5ed20..8572eae62da7 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -488,6 +488,13 @@ iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num) | |||
488 | struct iblock_req *ib_req = IBLOCK_REQ(task); | 488 | struct iblock_req *ib_req = IBLOCK_REQ(task); |
489 | struct bio *bio; | 489 | struct bio *bio; |
490 | 490 | ||
491 | /* | ||
492 | * Only allocate as many vector entries as the bio code allows us to, | ||
493 | * we'll loop later on until we have handled the whole request. | ||
494 | */ | ||
495 | if (sg_num > BIO_MAX_PAGES) | ||
496 | sg_num = BIO_MAX_PAGES; | ||
497 | |||
491 | bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); | 498 | bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); |
492 | if (!bio) { | 499 | if (!bio) { |
493 | pr_err("Unable to allocate memory for bio\n"); | 500 | pr_err("Unable to allocate memory for bio\n"); |