diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-02-22 10:36:28 -0500 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-05-08 14:28:19 -0400 |
commit | 36d116e99da7e45c8827a157a0a92da0fbbfcaa2 (patch) | |
tree | b0c671e85fb0dd8c9444b41592b3a3938200d396 /fs/ext4/inline.c | |
parent | 8f50c8b7ffc727643693f33657a857aeeefbd80b (diff) | |
download | linux-36d116e99da7e45c8827a157a0a92da0fbbfcaa2.tar.bz2 |
ext4: Use scoped memory APIs in ext4_da_write_begin()
Instead of setting AOP_FLAG_NOFS, use memalloc_nofs_save() and
memalloc_nofs_restore() to prevent GFP_FS allocations recursing
into the filesystem with a journal already started.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 93694ceb5a34..d965ba08f68f 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -906,7 +906,6 @@ out: int ext4_da_write_inline_data_begin(struct address_space *mapping, struct inode *inode, loff_t pos, unsigned len, - unsigned flags, struct page **pagep, void **fsdata) { @@ -915,6 +914,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, struct page *page; struct ext4_iloc iloc; int retries = 0; + unsigned int flags; ret = ext4_get_inode_loc(inode, &iloc); if (ret) @@ -931,12 +931,6 @@ retry_journal: if (ret && ret != -ENOSPC) goto out_journal; - /* - * We cannot recurse into the filesystem as the transaction - * is already started. - */ - flags |= AOP_FLAG_NOFS; - if (ret == -ENOSPC) { ext4_journal_stop(handle); ret = ext4_da_convert_inline_data_to_extent(mapping, @@ -948,7 +942,13 @@ retry_journal: goto out; } - page = grab_cache_page_write_begin(mapping, 0, flags); + /* + * We cannot recurse into the filesystem as the transaction + * is already started. + */ + flags = memalloc_nofs_save(); + page = grab_cache_page_write_begin(mapping, 0, 0); + memalloc_nofs_restore(flags); if (!page) { ret = -ENOMEM; goto out_journal; |