close_sync() needs to set conf->next_resync to a large, but safe value below MaxSector and use it to determine whether or not to set start_next_window in wait_barrier() Solution suggested by Neil Brown.
Unified · Split
| @@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) · 880 unmodified lines | ||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if (bio && bio_data_dir(bio) == WRITE) { |
| 884 | − if (bio->bi_iter.bi_sector >= | |
| 885 | − conf->mddev->curr_resync_completed) { | |
| 884 | + if (bio->bi_iter.bi_sector >= conf->next_resync) { | |
| 886 | 885 | if (conf->start_next_window == MaxSector) |
| 887 | 886 | conf->start_next_window = |
| 888 | 887 | conf->next_resync + |
| @@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf) · 627 unmodified lines | ||
| 1516 | 1515 | conf->r1buf_pool = NULL; |
| 1517 | 1516 | |
| 1518 | 1517 | spin_lock_irq(&conf->resync_lock); |
| 1519 | − conf->next_resync = 0; | |
| 1518 | + conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE; | |
| 1520 | 1519 | conf->start_next_window = MaxSector; |
| 1521 | 1520 | conf->current_window_requests += |
| 1522 | 1521 | conf->next_window_requests; |