]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md/raid1: Avoid raid1 resync getting stuck
authorJes Sorensen <Jes.Sorensen@redhat.com>
Wed, 16 Sep 2015 14:20:05 +0000 (10:20 -0400)
committerNeilBrown <neilb@suse.com>
Fri, 2 Oct 2015 07:23:44 +0000 (17:23 +1000)
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>
drivers/md/raid1.c

index 5f4f5536f66f2d81b9f102e23dd67259c78863c0..049df6c4a8cc302c9a266e34e5a1edefecb31cf7 100644 (file)
@@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
        }
 
        if (bio && bio_data_dir(bio) == WRITE) {
-               if (bio->bi_iter.bi_sector >=
-                   conf->mddev->curr_resync_completed) {
+               if (bio->bi_iter.bi_sector >= conf->next_resync) {
                        if (conf->start_next_window == MaxSector)
                                conf->start_next_window =
                                        conf->next_resync +
@@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf)
        conf->r1buf_pool = NULL;
 
        spin_lock_irq(&conf->resync_lock);
-       conf->next_resync = 0;
+       conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE;
        conf->start_next_window = MaxSector;
        conf->current_window_requests +=
                conf->next_window_requests;