mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
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>
This commit is contained in:
parent
4e78064f42
commit
6746557f03
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -120,7 +120,7 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data)
|
|||
* Allocate bios.
|
||||
*/
|
||||
for (j = nalloc ; j-- ; ) {
|
||||
bio = bio_alloc(gfp_flags, RESYNC_PAGES);
|
||||
bio = bio_kmalloc(gfp_flags, RESYNC_PAGES);
|
||||
if (!bio)
|
||||
goto out_free_bio;
|
||||
r10_bio->devs[j].bio = bio;
|
||||
|
|
Loading…
Reference in a new issue