From 1f2868f30f951abfab5fcbb7d2e238d6c9742564 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 2 Feb 2012 16:51:24 -0500 Subject: [PATCH] --- yaml --- r: 287370 b: refs/heads/master c: 5c55125f4794f4e77574fc09839cb47b0eb45b06 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/target/target_core_iblock.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 6c9bcdd3e094..f5063064757e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3011684c0b0b77b0f88113ef1c15b18befc6734a +refs/heads/master: 5c55125f4794f4e77574fc09839cb47b0eb45b06 diff --git a/trunk/drivers/target/target_core_iblock.c b/trunk/drivers/target/target_core_iblock.c index d43d5eb5ed20..8572eae62da7 100644 --- a/trunk/drivers/target/target_core_iblock.c +++ b/trunk/drivers/target/target_core_iblock.c @@ -488,6 +488,13 @@ iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num) struct iblock_req *ib_req = IBLOCK_REQ(task); struct bio *bio; + /* + * Only allocate as many vector entries as the bio code allows us to, + * we'll loop later on until we have handled the whole request. + */ + if (sg_num > BIO_MAX_PAGES) + sg_num = BIO_MAX_PAGES; + bio = bio_alloc_bioset(GFP_NOIO, sg_num, ib_dev->ibd_bio_set); if (!bio) { pr_err("Unable to allocate memory for bio\n");