diff options
author | NeilBrown <neilb@suse.de> | 2010-10-26 02:33:54 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-10-28 02:36:06 -0400 |
commit | 6746557f0325a66f57d179126426e38a8ea66945 (patch) | |
tree | 3b1db04c854b6ccc4752560f0d30c85e6cbbda6a /drivers/md | |
parent | 4e78064f42ad474ce9c31760861f7fb0cfc22532 (diff) |
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')
-rw-r--r-- | drivers/md/raid1.c | 2 | ||||
-rw-r--r-- | drivers/md/raid10.c | 2 |
2 files changed, 2 insertions, 2 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) | |||
100 | * Allocate bios : 1 for reading, n-1 for writing | 100 | * Allocate bios : 1 for reading, n-1 for writing |
101 | */ | 101 | */ |
102 | for (j = pi->raid_disks ; j-- ; ) { | 102 | for (j = pi->raid_disks ; j-- ; ) { |
103 | bio = bio_alloc(gfp_flags, RESYNC_PAGES); | 103 | bio = bio_kmalloc(gfp_flags, RESYNC_PAGES); |
104 | if (!bio) | 104 | if (!bio) |
105 | goto out_free_bio; | 105 | goto out_free_bio; |
106 | r1_bio->bios[j] = bio; | 106 | r1_bio->bios[j] = bio; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 8f5543a62416..6709cb255200 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -120,7 +120,7 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data) | |||
120 | * Allocate bios. | 120 | * Allocate bios. |
121 | */ | 121 | */ |
122 | for (j = nalloc ; j-- ; ) { | 122 | for (j = nalloc ; j-- ; ) { |
123 | bio = bio_alloc(gfp_flags, RESYNC_PAGES); | 123 | bio = bio_kmalloc(gfp_flags, RESYNC_PAGES); |
124 | if (!bio) | 124 | if (!bio) |
125 | goto out_free_bio; | 125 | goto out_free_bio; |
126 | r10_bio->devs[j].bio = bio; | 126 | r10_bio->devs[j].bio = bio; |