aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-09-10 02:01:24 -0400
committerNeilBrown <neilb@suse.de>2014-09-21 21:26:01 -0400
commitc2fd4c94deedb89ac1746c4a53219be499372c06 (patch)
treec0d082333a84c70b3eda3e68232eea88bbc52f39 /drivers/md/raid1.c
parent235549605eb7f1c5a37cef8b09d12e6d412c5cd6 (diff)
md/raid1: update next_resync under resync_lock.
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 cc: stable@vger.kernel.org (v3.13+) Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3b14a495c424..acfccec9ea3a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -827,7 +827,7 @@ static void flush_pending_writes(struct r1conf *conf)
827 * there is no normal IO happeing. It must arrange to call 827 * there is no normal IO happeing. It must arrange to call
828 * lower_barrier when the particular background IO completes. 828 * lower_barrier when the particular background IO completes.
829 */ 829 */
830static void raise_barrier(struct r1conf *conf) 830static void raise_barrier(struct r1conf *conf, sector_t sector_nr)
831{ 831{
832 spin_lock_irq(&conf->resync_lock); 832 spin_lock_irq(&conf->resync_lock);
833 833
@@ -837,6 +837,7 @@ static void raise_barrier(struct r1conf *conf)
837 837
838 /* block any new IO from starting */ 838 /* block any new IO from starting */
839 conf->barrier++; 839 conf->barrier++;
840 conf->next_resync = sector_nr;
840 841
841 /* For these conditions we must wait: 842 /* For these conditions we must wait:
842 * A: while the array is in frozen state 843 * A: while the array is in frozen state
@@ -2543,9 +2544,8 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
2543 2544
2544 bitmap_cond_end_sync(mddev->bitmap, sector_nr); 2545 bitmap_cond_end_sync(mddev->bitmap, sector_nr);
2545 r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); 2546 r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO);
2546 raise_barrier(conf);
2547 2547
2548 conf->next_resync = sector_nr; 2548 raise_barrier(conf, sector_nr);
2549 2549
2550 rcu_read_lock(); 2550 rcu_read_lock();
2551 /* 2551 /*