diff mbox series

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

Message ID 20241216194051.34873-1-snitzer@kernel.org
State New
Headers show
Series NFS: fix deadlock with pNFS flexfiles IO retry error path | expand

Commit Message

Mike Snitzer Dec. 16, 2024, 7:40 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

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

commit 31545f4b7cdb6da6a0519120b8c96dc40f186aac upstream stable/linux-5.15.y.

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@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 31545f4b7cdb6da6a0519120b8c96dc40f186aac)
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@hammerspace.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 fs/nfs/write.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Juerg Haefliger Jan. 17, 2025, 1:27 p.m. UTC | #1
ML cleanup. Email not threaded.

...Juerg




> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2089410
> 
> commit 31545f4b7cdb6da6a0519120b8c96dc40f186aac upstream stable/linux-5.15.y.
> 
> 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@hammerspace.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 31545f4b7cdb6da6a0519120b8c96dc40f186aac)
> 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@hammerspace.com>
> Signed-off-by: Mike Snitzer <snitzer@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 = {
diff mbox series

Patch

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 = {