From: Andrew Morton <akpm@linux-foundation.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel@lists.linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Kurt Lin <lylin1023@gmail.com>
Subject: [PATCH] fuse: let memory-failure remove poisoned page-cache folios
Date: Fri, 27 Nov 2026 22:30:14 -0800 [thread overview]
Message-ID: <82801b542ac4481a85ec2c869294ca28.1@linux-foundation.org> (raw)
From: Andrew Morton <akpm@linux-foundation.org>
Subject: fuse: let memory-failure remove poisoned page-cache folios
Date: Sun, 22 Nov 2026 14:45:24 -0800
fuse_file_aops has no ->error_remove_folio(). memory_failure() then
falls back to mapping_evict_folio(), which cannot remove a dirty folio.
So when a dirty FUSE page-cache page is hard-poisoned, recovery fails:
Memory failure: 0x7ffce: Failed to invalidate
Memory failure: 0x7ffce: dirty LRU page still referenced by 1 users
Memory failure: 0x7ffce: recovery action for dirty LRU page: Failed
madvise(MADV_HWPOISON) returns -EBUSY. The poisoned folio stays in the
page cache, and the kernel later reads it again to write it back to the
server. With a real uncorrected memory error that is a second access to
bad memory.
The poisoned folio also outlives the last close() of an unlinked file by
however long the inode takes to be evicted. The memory-failure selftest
unpoisons the page in its teardown and that failed with -EBUSY in 6 of 40
runs on FUSE.
Set ->error_remove_folio() to generic_error_remove_folio(), as ext4, xfs,
btrfs, NFS and others do. The folio is then truncated at the time of the
error:
Memory failure: 0x7dcf5: recovery action for dirty LRU page: Recovered
madvise() returns 0 and nothing is written back. The -EIO which
memory_failure() records in the mapping is reported exactly as before:
by the first fsync(), or by close() if FOPEN_NOFLUSH is not in effect.
Tested on x86_64 under QEMU with a minimal /dev/fuse server and simulated
poison (MADV_HWPOISON), with and without the writeback cache and with
FOPEN_NOFLUSH. The memory-failure selftest then passes 40 of 40 runs on
FUSE. Not tested: virtiofs, DAX, a real memory error.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Kurt Lin <lylin1023@gmail.com>
fs/fuse/file.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/fuse/file.c~fuse-let-memory-failure-remove-poisoned-page-cache-folios
+++ a/fs/fuse/file.c
@@ -3185,6 +3185,7 @@ static const struct address_space_operat
.readahead = fuse_readahead,
.writepages = fuse_writepages,
.launder_folio = fuse_launder_folio,
+ .error_remove_folio = generic_error_remove_folio,
.dirty_folio = iomap_dirty_folio,
.release_folio = iomap_release_folio,
.invalidate_folio = iomap_invalidate_folio,
_
next reply other threads:[~2026-11-28 6:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 6:30 Andrew Morton [this message]
2026-11-28 18:36 ` [PATCH] fuse: let memory-failure remove poisoned page-cache folios Kurt Lin
2026-11-30 7:00 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82801b542ac4481a85ec2c869294ca28.1@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=fuse-devel@lists.linux.dev \
--cc=linmiaohe@huawei.com \
--cc=lylin1023@gmail.com \
--cc=miklos@szeredi.hu \
--cc=nao.horiguchi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.