FAILED: patch "[PATCH] fuse: don't launder folios of a bad inode" failed to apply to 6.6-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 01d0f3d294af126f517d92c11e100525537f8be4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 01d0f3d294af126f517d92c11e100525537f8be4 Mon Sep 17 00:00:00 2001
From: Joanne Koong <[email protected]>
Date: Tue, 6 Oct 2026 03:51:36 -0700
Subject: [PATCH] fuse: don't launder folios of a bad inode
fuse_flush() and fuse_writepages() reject writing back dirty data for any inode that has been marked bad, but fuse_launder_folio() doesn't.
This can cause the following warning in fuse_write_file_get() to trigger, as reported by syzbot:
WARNING: fs/fuse/file.c:2043 at fuse_write_file_get fs/fuse/file.c:2043 [inline]
WARNING: fs/fuse/file.c:2043 at fuse_iomap_writeback_range+0x7c8/0x18f0 fs/fuse/file.c:2227
Call Trace:
iomap_writeback_folio+0x1526/0x2490 fs/iomap/buffered-io.c:2022
fuse_launder_folio+0x17b/0x240 fs/fuse/file.c:2331
folio_unmap_invalidate+0x4cd/0x830 mm/truncate.c:634
invalidate_inode_pages2_range+0x629/0xb30 mm/truncate.c:726
fuse_open+0x5a6/0x770 fs/fuse/file.c:297This can be hit on a writeback cache mount:
1) a writeable file is open and a buffered write dirties some pages
2) another thread opens the same file read-only. fuse_open() passes the bad inode check and sends OPEN to the server.
3) a SETATTR reply with the wrong file type marks the inode bad
4) the writeable file is closed. Flush and release skip writeback because the inode is bad. The pages stay dirty but the file gets removed from write_files.
5) server replies to the OPEN. The reply has no FOPEN_KEEP_CACHE, so fuse_open() calls invalidate_inode_pages2().
6) the invalidation finds the dirty pages and calls fuse_launder_folio(), which finds no wriable file and hits the WARN_ON in fuse_write_file_get().
Instead of trying to write back dirty data for the bad inode, fuse_launder_folio() should return -EIO.
--- fs/fuse/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/fuse/file.c +3 -0
@@ -2351,6 +2351,9 @@ static int fuse_launder_folio(struct folio *folio) .wb_ctx = &data, }; +if (fuse_is_bad (wpc.inode)) +return -EIO ; +if (folio_clear_dirty_for_io (folio)) { err =iomap_writeback_folio (&wpc, folio); err =fuse_iomap_writeback_submit (&wpc, err);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 fuse: don't launder folios of a bad inode
From: Joanne Koong <[email protected]>
[ Upstream commit 01d0f3d294af126f517d92c11e100525537f8be4 ]
fuse_flush() and fuse_writepages() reject writing back dirty data for any inode that has been marked bad, but fuse_launder_folio() doesn't.
This can cause the following warning in fuse_write_file_get() to trigger, as reported by syzbot:
WARNING: fs/fuse/file.c:2043 at fuse_write_file_get fs/fuse/file.c:2043 [inline]
WARNING: fs/fuse/file.c:2043 at fuse_iomap_writeback_range+0x7c8/0x18f0 fs/fuse/file.c:2227
Call Trace:
iomap_writeback_folio+0x1526/0x2490 fs/iomap/buffered-io.c:2022
fuse_launder_folio+0x17b/0x240 fs/fuse/file.c:2331
folio_unmap_invalidate+0x4cd/0x830 mm/truncate.c:634
invalidate_inode_pages2_range+0x629/0xb30 mm/truncate.c:726
fuse_open+0x5a6/0x770 fs/fuse/file.c:297This can be hit on a writeback cache mount:
1) a writeable file is open and a buffered write dirties some pages
2) another thread opens the same file read-only. fuse_open() passes the bad inode check and sends OPEN to the server.
3) a SETATTR reply with the wrong file type marks the inode bad
4) the writeable file is closed. Flush and release skip writeback because the inode is bad. The pages stay dirty but the file gets removed from write_files.
5) server replies to the OPEN. The reply has no FOPEN_KEEP_CACHE, so fuse_open() calls invalidate_inode_pages2().
6) the invalidation finds the dirty pages and calls fuse_launder_folio(), which finds no wriable file and hits the WARN_ON in fuse_write_file_get().
Instead of trying to write back dirty data for the bad inode, fuse_launder_folio() should return -EIO.
--- fs/fuse/file.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/fuse/file.c +4 -0
@@ -2476,6 +2476,10 @@ static int fuse_write_end(struct file *file, struct address_space *mapping,static int fuse_launder_folio (struct folio *folio) {int err =0 ; + +if (fuse_is_bad (folio->mapping->host)) +return -EIO ; +if (folio_clear_dirty_for_io (folio)) {struct inode *inode = folio->mapping->host;
Signature · 1 line
2.53.0