From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/mpage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/mpage.c b/fs/mpage.c index b7e7f570733a..8d54676c44cb 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -30,6 +30,7 @@ #include <linux/backing-dev.h> #include <linux/pagevec.h> #include <linux/cleancache.h> +#include <linux/sched/mm.h> #include "internal.h" /* @@ -614,13 +615,16 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, alloc_new: if (bio == NULL) { + unsigned nofs_flag; if (first_unmapped == blocks_per_page) { if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9), page, wbc)) goto out; } + nofs_flag = memalloc_nofs_save(); bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), - BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH); + BIO_MAX_PAGES, GFP_KERNEL|__GFP_HIGH); + memalloc_nofs_restore(nofs_flag); if (bio == NULL) goto confused; -- 2.16.1