diff options
author | Jens Axboe <axboe@kernel.dk> | 2017-09-27 07:45:36 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-10-03 10:38:17 -0400 |
commit | 94dc24c0c59a224a093f110060d01c2c620f275a (patch) | |
tree | 13d901e901caf86342e4e47dabfeb5b5a4f5f7dc /fs/buffer.c | |
parent | 640ab98fb3629c0f8417b9b2532eca596495f3bb (diff) |
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>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 1234ae343aef..3b60cd8456db 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -988,8 +988,6 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
988 | gfp_mask |= __GFP_NOFAIL; | 988 | gfp_mask |= __GFP_NOFAIL; |
989 | 989 | ||
990 | page = find_or_create_page(inode->i_mapping, index, gfp_mask); | 990 | page = find_or_create_page(inode->i_mapping, index, gfp_mask); |
991 | if (!page) | ||
992 | return ret; | ||
993 | 991 | ||
994 | BUG_ON(!PageLocked(page)); | 992 | BUG_ON(!PageLocked(page)); |
995 | 993 | ||
@@ -1008,9 +1006,7 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
1008 | /* | 1006 | /* |
1009 | * Allocate some buffers for this page | 1007 | * Allocate some buffers for this page |
1010 | */ | 1008 | */ |
1011 | bh = alloc_page_buffers(page, size, false); | 1009 | bh = alloc_page_buffers(page, size, true); |
1012 | if (!bh) | ||
1013 | goto failed; | ||
1014 | 1010 | ||
1015 | /* | 1011 | /* |
1016 | * Link the page to the buffers and initialise them. Take the | 1012 | * Link the page to the buffers and initialise them. Take the |