Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

md/raid1: fix the comparing region of interval tree

Interval tree uses [start, end] as a region which stores in the tree.
In raid1, it uses the wrong end value. For example:
bio(A,B) is too big and needs to be split to bio1(A,C-1), bio2(C,B).
The region of bio1 is [A,C] and the region of bio2 is [C,B]. So bio1 and
bio2 overlap which is not right.

Fix this problem by using right end value of the region.

Fixes: d0d2d8ba0494 ("md/raid1: introduce wait_for_serialization")
Signed-off-by: Xiao Ni <xni@redhat.com>
Link: https://lore.kernel.org/linux-raid/20260305011839.5118-2-xni@redhat.com/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>

authored by

Xiao Ni and committed by
Yu Kuai
de3544d2 52e43249

+2 -2
+2 -2
drivers/md/raid1.c
··· 62 62 unsigned long flags; 63 63 int ret = 0; 64 64 sector_t lo = r1_bio->sector; 65 - sector_t hi = lo + r1_bio->sectors; 65 + sector_t hi = lo + r1_bio->sectors - 1; 66 66 struct serial_in_rdev *serial = &rdev->serial[idx]; 67 67 68 68 spin_lock_irqsave(&serial->serial_lock, flags); ··· 452 452 int mirror = find_bio_disk(r1_bio, bio); 453 453 struct md_rdev *rdev = conf->mirrors[mirror].rdev; 454 454 sector_t lo = r1_bio->sector; 455 - sector_t hi = r1_bio->sector + r1_bio->sectors; 455 + sector_t hi = r1_bio->sector + r1_bio->sectors - 1; 456 456 bool ignore_error = !raid1_should_handle_error(bio) || 457 457 (bio->bi_status && bio_op(bio) == REQ_OP_DISCARD); 458 458