]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: do not convert the unwritten extents if data writeback fails
authorBaokun Li <libaokun1@huawei.com>
Wed, 22 Jan 2025 11:05:26 +0000 (19:05 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 13 Mar 2025 14:08:08 +0000 (10:08 -0400)
commite856f93e0fb249955f7d5efb18fe20500a9ccc6d
tree5e4f2dccf4f47a2108cfa5cb319a1288d6a3469b
parent2f94b537c48db155f5aa68d63b747f9d82248341
ext4: do not convert the unwritten extents if data writeback fails

When dioread_nolock is turned on (the default), it will convert unwritten
extents to written at ext4_end_io_end(), even if the data writeback fails.

It leads to the possibility that stale data may be exposed when the
physical block corresponding to the file data is read-only (i.e., writes
return -EIO, but reads are normal).

Therefore a new ext4_io_end->flags EXT4_IO_END_FAILED is added, which
indicates that some bio write-back failed in the current ext4_io_end.
When this flag is set, the unwritten to written conversion is no longer
performed. Users can read the data normally until the caches are dropped,
after that, the failed extents can only be read to all 0.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20250122110533.4116662-3-libaokun@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/page-io.c