summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-09-04 16:30:38 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 14:52:23 -0700
commit4d57fec84b64556fbb9a1527a791d68404b5bc60 (patch)
treec4692fd004ea9a64788923708670063d2010727e /drivers
parent4f31b027c3f2671d3d1da47666a23eca930baafb (diff)
md/raid1: clean up request counts properly in close_sync()
commit 669cc7ba77864e7b1ac39c9f2b2afb8730f341f4 upstream. If there are outstanding writes when close_sync is called, the change to ->start_next_window might cause them to decrement the wrong counter when they complete. Fix this by merging the two counters into the one that will be decremented. Having an incorrect value in a counter can cause raise_barrier() to hangs, so this is suitable for -stable. Fixes: 79ef3a8aa1cb1523cc231c9a90a278333c21f761 Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index d7690f86fdb9..3aa305f5a9af 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1548,8 +1548,13 @@ static void close_sync(struct r1conf *conf)
mempool_destroy(conf->r1buf_pool);
conf->r1buf_pool = NULL;
+ spin_lock_irq(&conf->resync_lock);
conf->next_resync = 0;
conf->start_next_window = MaxSector;
+ conf->current_window_requests +=
+ conf->next_window_requests;
+ conf->next_window_requests = 0;
+ spin_unlock_irq(&conf->resync_lock);
}
static int raid1_spare_active(struct mddev *mddev)