]> git.baikalelectronics.ru Git - kernel.git/commit
md: remove check for MD_RECOVERY_NEEDED in action_store.
authorNeilBrown <neilb@suse.com>
Mon, 21 Dec 2015 00:01:21 +0000 (11:01 +1100)
committerNeilBrown <neilb@suse.com>
Mon, 21 Dec 2015 00:10:06 +0000 (11:10 +1100)
commitb4b3e5a3a600680f88399be194014b6a14859cdb
tree10e0c0b1ea968e006a35180d2e18bf412da8950b
parent4789f5333aa51d09119700d0b0b08b3f0d183ebb
md: remove check for MD_RECOVERY_NEEDED in action_store.

md currently doesn't allow a 'sync_action' such as 'reshape' to be set
while MD_RECOVERY_NEEDED is set.

This s a problem, particularly since commit cad01867fccc as that can
cause ->check_shape to call mddev_resume() which sets
MD_RECOVERY_NEEDED.  So by the time we come to start 'reshape' it is
very likely that MD_RECOVERY_NEEDED is still set.

Testing for this flag is not really needed and is in any case very
racy as it can be set at any moment - asynchronously.  Any race
between setting a sync_action and setting MD_RECOVERY_NEEDED must
already be handled properly in some locked code, probably
md_check_recovery(), so remove the test here.

The test on MD_RECOVERY_RUNNING is also racy in the 'reshape' case
so we should test it again after getting mddev_lock().

As this fixes a race and a regression which can cause 'reshape' to
fail, it is suitable for -stable kernels since 4.1

Reported-by: Xiao Ni <xni@redhat.com>
Fixes: cad01867fccc ("md/raid5: fix allocation of 'scribble' array.")
Cc: stable@vger.kernel.org (v4.1+)
Signed-off-by: NeilBrown <neilb@suse.com>
drivers/md/md.c