Re: [PATCH v2] ubifs: prevent corrupted data write via error_remove_folio
From: xu.xin16
Date: Tue Feb 24 2026 - 04:52:16 EST
> From: Jinpeng Cui <cui.jinpeng2@xxxxxxxxxx>
>
> When a memory corruption event triggers memory_failure, ext4 releases
> references to the affected dirty pages, ensuring that no corrupted data
> is written to disk.
>
> However, ubifs currently lacks the error_remove_folio capabilityand
> therefore cannot release references to faulty private memory. As a result,
> corrupted data may eventually be written to flash storage.
>
> Add generic_error_remove_folio support to ubifs,
> preventing corrupted memory data from being persisted to flash.
>
> Signed-off-by: Jinpeng Cui <cui.jinpeng2@xxxxxxxxxx>
> Signed-off-by: Shengming Hu <hu.shengming@xxxxxxxxxx>
> Signed-off-by: Fan Yu <fan.yu9@xxxxxxxxxx>
> Reviewed-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
> ---
> Changes in v2:
> - Some format fixes according to
> https://lore.kernel.org/all/20260211173233604W9pVxv17lV3V2uYD3zCOq@xxxxxxxxxx/
>
> fs/ubifs/file.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
> index ca41ce8208c4..730318eb1ba8 100644
> --- a/fs/ubifs/file.c
> +++ b/fs/ubifs/file.c
> @@ -1635,6 +1635,7 @@ const struct address_space_operations ubifs_file_address_operations = {
> .dirty_folio = ubifs_dirty_folio,
> .migrate_folio = filemap_migrate_folio,
> .release_folio = ubifs_release_folio,
> + .error_remove_folio = generic_error_remove_folio,
> };
>
> const struct inode_operations ubifs_file_inode_operations = {
> --
> 2.25.1
Reviewed-by: xu xin <xu.xin16@xxxxxxxxxx>