From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- 2.16.1