diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2015-09-16 10:20:05 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-10-02 03:23:44 -0400 |
commit | e8ff8bf09ff49733534ff3cee91bde030186055f (patch) | |
tree | a88b4a7f0d402a2aefeecc97b752c13e931874f6 /drivers/md/raid1.c | |
parent | 644df1a85fc4b0c7a16800f55717261546f4e651 (diff) |
md/raid1: Avoid raid1 resync getting stuck
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.
Reported-by: Nate Dailey <nate.dailey@stratus.com>
Tested-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 5f4f5536f66f..049df6c4a8cc 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) | |||
881 | } | 881 | } |
882 | 882 | ||
883 | if (bio && bio_data_dir(bio) == WRITE) { | 883 | if (bio && bio_data_dir(bio) == WRITE) { |
884 | if (bio->bi_iter.bi_sector >= | 884 | if (bio->bi_iter.bi_sector >= conf->next_resync) { |
885 | conf->mddev->curr_resync_completed) { | ||
886 | if (conf->start_next_window == MaxSector) | 885 | if (conf->start_next_window == MaxSector) |
887 | conf->start_next_window = | 886 | conf->start_next_window = |
888 | conf->next_resync + | 887 | conf->next_resync + |
@@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf) | |||
1516 | conf->r1buf_pool = NULL; | 1515 | conf->r1buf_pool = NULL; |
1517 | 1516 | ||
1518 | spin_lock_irq(&conf->resync_lock); | 1517 | spin_lock_irq(&conf->resync_lock); |
1519 | conf->next_resync = 0; | 1518 | conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE; |
1520 | conf->start_next_window = MaxSector; | 1519 | conf->start_next_window = MaxSector; |
1521 | conf->current_window_requests += | 1520 | conf->current_window_requests += |
1522 | conf->next_window_requests; | 1521 | conf->next_window_requests; |