md/raid1: update next_resync under resync_lock.
authorNeilBrown <neilb@suse.de>
Wed, 10 Sep 2014 06:01:24 +0000 (16:01 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:23 +0000 (14:52 -0700)
commit58e62ed358d38a3ce7a31f169e1f317f53b8938f
tree09b47c1748d42aca0954c754f070a49984ff5fbd
parentff96e1acf2b7d3e8b86374ec1b5d30a2194e43d1
md/raid1: update next_resync under resync_lock.

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@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid1.c