This is a note to let you know that I've just added the patch titled md/raid1: update next_resync under resync_lock. to the 3.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: md-raid1-update-next_resync-under-resync_lock.patch and it can be found in the queue-3.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c2fd4c94deedb89ac1746c4a53219be499372c06 Mon Sep 17 00:00:00 2001 From: NeilBrown <neilb@xxxxxxx> Date: Wed, 10 Sep 2014 16:01:24 +1000 Subject: md/raid1: update next_resync under resync_lock. From: NeilBrown <neilb@xxxxxxx> commit c2fd4c94deedb89ac1746c4a53219be499372c06 upstream. raise_barrier() uses next_resync as part of its calculations, so it really should be updated first, instead of afterwards. next_resync is always used under resync_lock so update it under resync lock to, just before it is used. That is safest. This could cause normal IO and resync IO to interact badly so it suitable for -stable. Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761 Signed-off-by: NeilBrown <neilb@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/raid1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -827,7 +827,7 @@ static void flush_pending_writes(struct * there is no normal IO happeing. It must arrange to call * lower_barrier when the particular background IO completes. */ -static void raise_barrier(struct r1conf *conf) +static void raise_barrier(struct r1conf *conf, sector_t sector_nr) { spin_lock_irq(&conf->resync_lock); @@ -837,6 +837,7 @@ static void raise_barrier(struct r1conf /* block any new IO from starting */ conf->barrier++; + conf->next_resync = sector_nr; /* For these conditions we must wait: * A: while the array is in frozen state @@ -2542,9 +2543,8 @@ static sector_t sync_request(struct mdde bitmap_cond_end_sync(mddev->bitmap, sector_nr); r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); - raise_barrier(conf); - conf->next_resync = sector_nr; + raise_barrier(conf, sector_nr); rcu_read_lock(); /* Patches currently in stable-queue which might be from neilb@xxxxxxx are queue-3.16/md-raid1-fix_read_error-should-act-on-all-non-faulty-devices.patch queue-3.16/md-raid1-count-resync-requests-in-nr_pending.patch queue-3.16/md-raid1-update-next_resync-under-resync_lock.patch queue-3.16/md-raid1-intialise-start_next_window-for-read-case-to-avoid-hang.patch queue-3.16/md-raid1-don-t-use-next_resync-to-determine-how-far-resync-has-progressed.patch queue-3.16/md-raid1-be-more-cautious-where-we-read-balance-during-resync.patch queue-3.16/md-raid1-make-sure-resync-waits-for-conflicting-writes-to-complete.patch queue-3.16/md-raid1-clean-up-request-counts-properly-in-close_sync.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html