aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-10-26 17:33:54 +1100
committerNeilBrown <neilb@suse.de>2010-10-28 17:36:06 +1100
commit6746557f0325a66f57d179126426e38a8ea66945 (patch)
tree3b1db04c854b6ccc4752560f0d30c85e6cbbda6a /drivers/md/raid1.c
parentmd: Fix possible deadlock with multiple mempool allocations. (diff)
downloadlinux-dev-6746557f0325a66f57d179126426e38a8ea66945.tar.xz
linux-dev-6746557f0325a66f57d179126426e38a8ea66945.zip
md: use bio_kmalloc rather than bio_alloc when failure is acceptable.
bio_alloc can never fail (as it uses a mempool) but an block indefinitely, especially if the caller is holding a reference to a previously allocated bio. So these to places which both handle failure and hold multiple bios should not use bio_alloc, they should use bio_kmalloc. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3362cfc8073c..40f58d3b67ff 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -100,7 +100,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
* Allocate bios : 1 for reading, n-1 for writing
*/
for (j = pi->raid_disks ; j-- ; ) {
- bio = bio_alloc(gfp_flags, RESYNC_PAGES);
+ bio = bio_kmalloc(gfp_flags, RESYNC_PAGES);
if (!bio)
goto out_free_bio;
r1_bio->bios[j] = bio;