diff mbox series

[07/22] namei: Convert page_symlink() to use memalloc_nofs_save()

Message ID 20220222194820.737755-8-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Remove aop flags | expand

Commit Message

Matthew Wilcox Feb. 22, 2022, 7:48 p.m. UTC
Stop using AOP_FLAG_NOFS in favour of the scoped memory API.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/namei.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig Feb. 23, 2022, 6:56 a.m. UTC | #1
On Tue, Feb 22, 2022 at 07:48:05PM +0000, Matthew Wilcox (Oracle) wrote:
> Stop using AOP_FLAG_NOFS in favour of the scoped memory API.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/namei.c b/fs/namei.c
index 8335dad105b4..4f5c07d5579f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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>
@@ -5010,13 +5011,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;