@@ -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(