diff mbox

[07/10] fs: namei use memalloc_nofs_* scope API

Message ID 20180219140230.5077-8-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/namei.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/namei.c b/fs/namei.c
index 921ae32dbc80..6cb314a256c5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -39,6 +39,7 @@ 
 #include <linux/bitops.h>
 #include <linux/init_task.h>
 #include <linux/uaccess.h>
+#include <linux/sched/mm.h>
 
 #include "internal.h"
 #include "mount.h"
@@ -4797,7 +4798,7 @@  int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
 	int err;
 	unsigned int flags = 0;
 	if (nofs)
-		flags |= AOP_FLAG_NOFS;
+		flags = memalloc_nofs_save();
 
 retry:
 	err = pagecache_write_begin(NULL, mapping, 0, len-1,
@@ -4815,8 +4816,12 @@  int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
 		goto retry;
 
 	mark_inode_dirty(inode);
+	if (nofs)
+		memalloc_nofs_restore(flags);
 	return 0;
 fail:
+	if (nofs)
+		memalloc_nofs_restore(flags);
 	return err;
 }
 EXPORT_SYMBOL(__page_symlink);