md/raid1: check bitmap before behind write
authorYu Kuai <yukuai3@huawei.com>
Mon, 7 Jul 2025 01:27:05 +0000 (09:27 +0800)
committerYu Kuai <yukuai3@huawei.com>
Sat, 6 Sep 2025 09:11:58 +0000 (17:11 +0800)
commit20cecae877a634ffc49b4cd7b0f6927209badbab
tree6376a669cd4aab95b1dabc88ec9e9b373a8146f7
parentbb74b093c33cf20876e23ad8aa0d206b537ccb69
md/raid1: check bitmap before behind write

behind write rely on bitmap, because the number of IO are recorded in
bitmap->behind_writes, and callers rely on bitmap_wait_behind_writes()
to wait for IO to be done.

However, currently callers doesn't check if bitmap is enabeld before
calling into behind methods. Hence if behind write start without bitmap,
readers will not wait for slow write IO to be done and old data can be
read in some corner cases.

Link: https://lore.kernel.org/linux-raid/20250707012711.376844-10-yukuai1@huaweicloud.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Xiao Ni <xni@redhat.com>
drivers/md/md-bitmap.c
drivers/md/raid1.c