[SRU][jammy PATCH v2 1/1] NFS: nfs_async_write_reschedule_io must not recurse into the writeback code

Mike Snitzer snitzer at kernel.org
Fri Nov 29 14:49:35 UTC 2024


From: Trond Myklebust <trond.myklebust at hammerspace.com>

BugLink: https://bugs.launchpad.net/bugs/2089410

commit b1a28f2eb9ea7a5a1763fe53fe699aa0feae4231 upstream.

It is not safe to call filemap_fdatawrite_range() from
nfs_async_write_reschedule_io(), since we're often calling from a page
reclaim context. Just let fsync() redrive the writeback for us.

Signed-off-by: Trond Myklebust <trond.myklebust at hammerspace.com>
(cherry picked from commit b1a28f2eb9ea7a5a1763fe53fe699aa0feae4231)
Fixes: 7be7b3ca16a59 ("NFS: Ensure we immediately start writeback on rescheduled writes")
Link: https://lore.kernel.org/stable/2024112146-tiptoeing-available-c5fe@gregkh/T/
Closes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2089410
Signed-off-by: Mike Snitzer <snitzer at hammerspace.com>
Signed-off-by: Mike Snitzer <snitzer at kernel.org>
---
 fs/nfs/write.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 2e1c45344d1fd..00e11c6602fe4 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1437,8 +1437,6 @@ static void nfs_async_write_error(struct list_head *head, int error)
 static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr)
 {
 	nfs_async_write_error(&hdr->pages, 0);
-	filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset,
-			hdr->args.offset + hdr->args.count - 1);
 }
 
 static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops = {
-- 
2.44.0




More information about the kernel-team mailing list