]> git.baikalelectronics.ru Git - kernel.git/commit
md: fix race when unfreezing sync_action
authorNeilBrown <neilb@suse.de>
Thu, 28 May 2015 07:53:29 +0000 (17:53 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 28 May 2015 08:04:45 +0000 (18:04 +1000)
commitea52a27110b1b58ef7716735e448834ea4219583
tree3af5cac150be4c0cf4d2e0d46dc9fba1328b8670
parent961f80e6b4edb640c40db8e25a960153836fd89d
md: fix race when unfreezing sync_action

A recent change removed the need for locking around writing
to "sync_action" (and various other places), but introduced a
subtle race.
When e.g. setting 'reshape' on a 'frozen' array, the 'frozen'
flag is cleared before 'reshape' is set, so the md thread can
get in and start trying recovery - which isn't wanted.

So instead of clearing MD_RECOVERY_FROZEN for any command
except 'frozen', only clear it when each specific command
is parsed.  This allows the handling of 'reshape' to clear
the bit while a lock is held.

Also remove some places where we set MD_RECOVERY_NEEDED,
as it is always set on non-error exit of the function.

Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: 0168ec248405 ("md: make reconfig_mutex optional for writes to md sysfs files.")
drivers/md/md.c