[PATCH 0/5] ext4: fix issues caused by data write-back failures

libaokun
2024-12-20T06:11:48Z

From: Baokun Li <libaokun1@huawei.com>

Recently some of our customers remounted ext4 from
"dioread_nolock,data_err=abort" to "dioread_lock,data_err=abort" and the
ext4 filesystem became read-only.

Then I found that "data_err=abort" is not working in dioread_nolock mode,
when data writeback fails, the error is always recorded in inode mapping,
but no one will check it, not even when converting unwritten to written,
which could expose stale data. When remounted with dioread_lock, the error
recorded in the inode mapping was checked and the journal aborted, and the
file system became read-only later.

Patch 1: Clean up duplicate code and ensure that an warning is printed
when data may be lost;
Patch 2: Fix an issue that could expose stale data when data writeback
fails;
Patch 3: Make “data_err=abort” works in dioread_nolock mode.
Patch 4: Remove useless i_unwritten and related code.
Patch 5: Pack holes in ext4_inode_info to save memory.

Baokun Li (5):
ext4: replace opencoded ext4_end_io_end() in ext4_put_io_end()
ext4: do not convert the unwritten extents if data writeback fails
ext4: abort journal on data writeback failure if in data_err=abort mode
ext4: remove unused member 'i_unwritten' from 'ext4_inode_info'
ext4: pack holes in ext4_inode_info

fs/ext4/ext4.h | 32 ++++++++------------------------
fs/ext4/inode.c | 2 +-
fs/ext4/page-io.c | 38 +++++++++++++++++++++++++-------------
fs/ext4/super.c | 9 +--------
4 files changed, 35 insertions(+), 46 deletions(-)

--
2.46.1