From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/f2fs/f2fs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 6300ac5bcbe4..98b0827af06e 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -24,6 +24,7 @@ #include <linux/bio.h> #include <linux/blkdev.h> #include <linux/quotaops.h> +#include <linux/sched/mm.h> #include <crypto/hash.h> #define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_F2FS_FS_ENCRYPTION) @@ -1905,6 +1906,8 @@ static inline s64 valid_inode_count(struct f2fs_sb_info *sbi) static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, pgoff_t index, bool for_write) { + struct page *pg = NULL; + unsigned nofs_flags; #ifdef CONFIG_F2FS_FAULT_INJECTION struct page *page = find_lock_page(mapping, index); @@ -1918,7 +1921,11 @@ static inline struct page *f2fs_grab_cache_page(struct address_space *mapping, #endif if (!for_write) return grab_cache_page(mapping, index); - return grab_cache_page_write_begin(mapping, index, AOP_FLAG_NOFS); + + nofs_flags = memalloc_nofs_save(); + pg = grab_cache_page_write_begin(mapping, index, 0); + memalloc_nofs_restore(nofs_flags); + return pg; } static inline struct page *f2fs_pagecache_get_page( -- 2.16.1