Skip to content
Commit 45b47895 authored by Song Liu's avatar Song Liu
Browse files

md: fix bi_status reporting in md_end_clone_io

md_end_clone_io() may overwrite error status in orig_bio->bi_status with
BLK_STS_OK. This could happen when orig_bio has BIO_CHAIN (split by
md_submit_bio => bio_split_to_limits, for example). As a result, upper
layer may miss error reported from md (or the device) and consider the
failed IO was successful.

Fix this by only update orig_bio->bi_status when current bio reports
error and orig_bio is BLK_STS_OK. This is the same behavior as
__bio_chain_endio().

Fixes: 10764815

 ("md: add io accounting for raid0 and raid5")
Cc: stable@vger.kernel.org # v5.14+
Reported-by: default avatarBhanu Victor DiCara <00bvd0+linux@gmail.com>
Closes: https://lore.kernel.org/regressions/5727380.DvuYhMxLoT@bvd0/


Signed-off-by: default avatarSong Liu <song@kernel.org>
Tested-by: default avatarXiao Ni <xni@redhat.com>
Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Acked-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
parent e63a5730
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment