set choose_first true for cluster read in read balance when the area is resyncing.
Unified · Split
| @@ -539,7 +539,13 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect · 538 unmodified lines | ||
| 539 | 539 | has_nonrot_disk = 0; |
| 540 | 540 | choose_next_idle = 0; |
| 541 | 541 | |
| 542 | − choose_first = (conf->mddev->recovery_cp < this_sector + sectors); | |
| 542 | + if ((conf->mddev->recovery_cp < this_sector + sectors) || | |
| 543 | + (mddev_is_clustered(conf->mddev) && | |
| 544 | + md_cluster_ops->area_resyncing(conf->mddev, this_sector, | |
| 545 | + this_sector + sectors))) | |
| 546 | + choose_first = 1; | |
| 547 | + else | |
| 548 | + choose_first = 0; | |
| 543 | 549 | |
| 544 | 550 | for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { |
| 545 | 551 | sector_t dist; |