mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Kurt Lin <lylin1023@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>, <linux-mm@kvack.org>,
	<linux-f2fs-devel@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>, Jaegeuk Kim <jaegeuk@kernel.org>,
	Chao Yu <chao@kernel.org>
Subject: Re: [PATCH] f2fs: let memory-failure remove poisoned page-cache folios
Date: Thu, 3 Dec 2026 14:39:12 +0800	[thread overview]
Message-ID: <45aac4ce-c2f4-f513-4f2d-958c729b0db9@huawei.com> (raw)
In-Reply-To: <20261202-f2fs-error-remove-folio-v1-1-645aef601439@gmail.com>

On 2026/12/2 1:15, Kurt Lin wrote:
> f2fs_dblock_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 f2fs page-cache page is hard-poisoned, recovery fails:
> 
>   Memory failure: 0x6289: Failed to invalidate
>   Memory failure: 0x6289: recovery action for dirty LRU page: Failed
> 
> madvise(MADV_HWPOISON) returns -EBUSY and the poisoned folio stays in
> the page cache. read() keeps returning its contents without an error,
> and the next fsync() writes it back to disk before reporting -EIO. With
> a real memory error, the kernel keeps reading the poisoned memory.
> 
> Set ->error_remove_folio() to generic_error_remove_folio(), as ext4,
> xfs, btrfs and others do. The folio is then truncated at the time of
> the error, and f2fs_invalidate_folio() drops its dirty accounting:
> 
>   Memory failure: 0x742b: recovery action for dirty LRU page: Recovered
> 
> madvise() returns 0 and nothing is written back. fsync() still reports
> -EIO, and an atomic write with a poisoned page still fails to commit
> with -EIO and is rolled back.
> 
> Found and tested with the help of an AI coding assistant.
> 
> Signed-off-by: Kurt Lin <lylin1023@gmail.com>

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

Thanks.
.

      reply	other threads:[~2026-12-03  6:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 17:15 Kurt Lin
2026-12-03  6:39 ` Miaohe Lin [this message]

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=45aac4ce-c2f4-f513-4f2d-958c729b0db9@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lylin1023@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®