From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.220 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796279967; b=1m4ZjAvuP6eSbOcgQAWVMTDbzJoE2xGBPiKMgClYJuppWiBztNswdN4Wph8O6RKP6wDA xMxuYBzCT8DKM8TBojsWyYq+9a5cVu3XHnRjvQTCD1tqWb9q4Pqrkx3uWlQm5vlKLuS2d qZ0TR9wuAcqFYWZWtdpB7llEJNrNrRv9vH68ABz4JPvWmFw6oM1lR6wLKI6FF6mMkLSb5 eKUk0BFPSZt2Asnjf06B4cToYtf0/kD1h4Woc/MLHOrLSOJFfycahMECBYu7K+z8rv/NX jvIBL4YYfL9ifT+8k+iHSmOmHIOC125T1J7PNSUTMj6bJRVYpcMmP5hMWXCxuFxwXMw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796279967; h=DMARC-Filter:dkim-signature:Received:Received:Received:Subject:To:CC: References:From:Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: Content-Type:Content-Language:Content-Transfer-Encoding: X-Originating-IP:X-ClientProxiedBy; bh=h0E7gtvwDlU1s0XQQG4E9CfB3MaDFbZYJBgfnFlzdLs=; b=mmbaud8i3y1zidzRPOYp+RJUPClWGGNtptfvBSgkhH7/pJzoUC1hw0q1Z+uMdjRHaOJr 86P6YWUcma9uxeVYV+XqiseV1jUJVivy4nrrcUOsXUtZD1dPW1prMv8DZB22/IwYY36X9 jsV4/uok9zvmGKovaynJxFZQy8yNLxFLr/q+hpgBoLhKX2h3nnbCNglkvCCFhycsKCWk6 dRJxCp1uL03VDPC2QOQ5FybRn3O/SwouMgIqHiLAZ/j9nGIB63GmMwCkhdq76Xde51Fh+ bSDvHkpoyAQ6kCZT+WyQf9VIIsd7Og03eklLJCuNSCJVyVw0bhnQ2PyEnDXBtuTwPCA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b="wdWAi/2p"; arc=none smtp.remote-ip=113.46.200.220 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 611A4606A322 for ; Thu, 3 Dec 2026 06:39:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 611A4606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=wdWAi/2p dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=h0E7gtvwDlU1s0XQQG4E9CfB3MaDFbZYJBgfnFlzdLs=; b=wdWAi/2pUXzoSlbdjLQT+MIqc6iUuPK2rRmnFgoqMGQMUUYMbCBkDQIkvShkw39+BUgM2XiCU ADibDmnIn2ijz8bow9tH+w2UU88nbRnU56My5aGHAlnXP+hH4L5aRCZynPAfqPaLeTlUtoY6NYB qbL9LYbluSxDZJmr+Cu6L6g= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4jg4hQ3P5Lz12LG5; Thu, 3 Dec 2026 14:38:30 +0800 (CST) Received: from whupemk100004.china.huawei.com (unknown [7.152.185.74]) by mail.maildlp.com (Postfix) with ESMTPS id 0D60940579; Thu, 3 Dec 2026 14:39:14 +0800 (CST) Received: from [10.173.98.163] (10.173.98.163) by whupemk100004.china.huawei.com (7.152.185.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Thu, 3 Dec 2026 14:39:12 +0800 Subject: Re: [PATCH] f2fs: let memory-failure remove poisoned page-cache folios To: Kurt Lin CC: Andrew Morton , Naoya Horiguchi , , , , Jaegeuk Kim , Chao Yu References: <20261202-f2fs-error-remove-folio-v1-1-645aef601439@gmail.com> From: Miaohe Lin Message-ID: <45aac4ce-c2f4-f513-4f2d-958c729b0db9@huawei.com> Date: Thu, 3 Dec 2026 14:39:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 In-Reply-To: <20261202-f2fs-error-remove-folio-v1-1-645aef601439@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To whupemk100004.china.huawei.com (7.152.185.74) 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 Reviewed-by: Miaohe Lin Thanks. .