namei: Convert page_symlink() to use memalloc_nofs_save()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 22 Feb 2022 14:43:12 +0000 (09:43 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 8 May 2022 18:28:18 +0000 (14:28 -0400)
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>
fs/namei.c

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