mirror of https://gitee.com/openkylin/linux.git
buffer: grow_dev_page() should use __GFP_NOFAIL for all cases
We currently use it for find_or_create_page(), which means that it cannot fail. Ensure we also pass in 'retry == true' to alloc_page_buffers(), which also ensure that it cannot fail. After this, there are no failure cases in grow_dev_page() that occur because of a failed memory allocation. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
640ab98fb3
commit
94dc24c0c5
|
@ -988,8 +988,6 @@ grow_dev_page(struct block_device *bdev, sector_t block,
|
||||||
gfp_mask |= __GFP_NOFAIL;
|
gfp_mask |= __GFP_NOFAIL;
|
||||||
|
|
||||||
page = find_or_create_page(inode->i_mapping, index, gfp_mask);
|
page = find_or_create_page(inode->i_mapping, index, gfp_mask);
|
||||||
if (!page)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
BUG_ON(!PageLocked(page));
|
BUG_ON(!PageLocked(page));
|
||||||
|
|
||||||
|
@ -1008,9 +1006,7 @@ grow_dev_page(struct block_device *bdev, sector_t block,
|
||||||
/*
|
/*
|
||||||
* Allocate some buffers for this page
|
* Allocate some buffers for this page
|
||||||
*/
|
*/
|
||||||
bh = alloc_page_buffers(page, size, false);
|
bh = alloc_page_buffers(page, size, true);
|
||||||
if (!bh)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Link the page to the buffers and initialise them. Take the
|
* Link the page to the buffers and initialise them. Take the
|
||||||
|
|
Loading…
Reference in New Issue