md/raid1: clean up request counts properly in close_sync()
authorNeilBrown <neilb@suse.de>
Thu, 4 Sep 2014 06:30:38 +0000 (16:30 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:23 +0000 (14:52 -0700)
commit4d57fec84b64556fbb9a1527a791d68404b5bc60
treec4692fd004ea9a64788923708670063d2010727e
parent4f31b027c3f2671d3d1da47666a23eca930baafb
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>
drivers/md/raid1.c