Return-Path: Received: from mx2.suse.de ([195.135.220.15]:40091 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbeBSOCt (ORCPT ); Mon, 19 Feb 2018 09:02:49 -0500 From: Goldwyn Rodrigues To: linux-fsdevel@vger.kernel.org Cc: mhocko@kernel.org, Goldwyn Rodrigues Subject: [PATCH 05/10] gfs2: Use memalloc_nofs_* scope API Date: Mon, 19 Feb 2018 08:02:25 -0600 Message-Id: <20180219140230.5077-6-rgoldwyn@suse.de> In-Reply-To: <20180219140230.5077-1-rgoldwyn@suse.de> References: <20180219140230.5077-1-rgoldwyn@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Goldwyn Rodrigues Signed-off-by: Goldwyn Rodrigues --- fs/gfs2/aops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 #include #include +#include #include #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; -- 2.16.1