Skip to content

Commit

Permalink
md/raid1: fix bug in read_balance introduced by hot-replace
Browse files Browse the repository at this point in the history
When we added hot_replace we doubled the number of devices
that could be in a RAID1 array.  So we doubled how far read_balance
would search.  Unfortunately we didn't double the point at which
it looped back to the beginning - so it effectively loops over
all non-replacement disks twice.
This doesn't cause bad behaviour, but it pointless and means we
never read from replacement devices.

Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Jul 3, 2012
1 parent fab363b commit 32644af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
int bad_sectors;

int disk = start_disk + i;
if (disk >= conf->raid_disks)
disk -= conf->raid_disks;
if (disk >= conf->raid_disks * 2)
disk -= conf->raid_disks * 2;

rdev = rcu_dereference(conf->mirrors[disk].rdev);
if (r1_bio->bios[disk] == IO_BLOCKED
Expand Down

0 comments on commit 32644af

Please sign in to comment.