namei: Convert page_symlink() to use memalloc_nofs_save()

Stop using AOP_FLAG_NOFS in favour of the scoped memory API.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Matthew Wilcox (Oracle) 2022-02-22 09:43:12 -05:00
parent 56f5746c41
commit 2d878178ba

View File

@ -22,6 +22,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/sched/mm.h>
#include <linux/fsnotify.h> #include <linux/fsnotify.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/security.h> #include <linux/security.h>
@ -5008,13 +5009,15 @@ int page_symlink(struct inode *inode, const char *symname, int len)
struct page *page; struct page *page;
void *fsdata; void *fsdata;
int err; int err;
unsigned int flags = 0; unsigned int flags;
if (nofs)
flags |= AOP_FLAG_NOFS;
retry: retry:
if (nofs)
flags = memalloc_nofs_save();
err = pagecache_write_begin(NULL, mapping, 0, len-1, err = pagecache_write_begin(NULL, mapping, 0, len-1,
flags, &page, &fsdata); 0, &page, &fsdata);
if (nofs)
memalloc_nofs_restore(flags);
if (err) if (err)
goto fail; goto fail;