diff mbox

[05/10] gfs2: Use memalloc_nofs_* scope API

Message ID 20180219140230.5077-6-rgoldwyn@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Goldwyn Rodrigues Feb. 19, 2018, 2:02 p.m. UTC
From: Goldwyn Rodrigues <rgoldwyn@suse.com>

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/gfs2/aops.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 2f725b4a386b..802d2d223902 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -21,6 +21,7 @@ 
 #include <linux/gfs2_ondisk.h>
 #include <linux/backing-dev.h>
 #include <linux/uio.h>
+#include <linux/sched/mm.h>
 #include <trace/events/writeback.h>
 
 #include "gfs2.h"
@@ -671,6 +672,7 @@  static int gfs2_write_begin(struct file *file, struct address_space *mapping,
 	pgoff_t index = pos >> PAGE_SHIFT;
 	unsigned from = pos & (PAGE_SIZE - 1);
 	struct page *page;
+	unsigned nofs_flags;
 
 	gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &ip->i_gh);
 	error = gfs2_glock_nq(&ip->i_gh);
@@ -719,8 +721,9 @@  static int gfs2_write_begin(struct file *file, struct address_space *mapping,
 		goto out_trans_fail;
 
 	error = -ENOMEM;
-	flags |= AOP_FLAG_NOFS;
+	nofs_flags = memalloc_nofs_save();
 	page = grab_cache_page_write_begin(mapping, index, flags);
+	memalloc_nofs_restore(nofs_flags);
 	*pagep = page;
 	if (unlikely(!page))
 		goto out_endtrans;