]> git.baikalelectronics.ru Git - kernel.git/commit
md: use common code for all calls to ->hot_remove_disk()
authorNeilBrown <neilb@suse.de>
Wed, 24 Apr 2013 01:42:41 +0000 (11:42 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 24 Apr 2013 01:42:41 +0000 (11:42 +1000)
commit6af79e710a7c31ec96507a46c092e04d606c0098
tree6ce6cc0b1d9f147bbc2e3b72cf6e52da922d2f7f
parent82fda0400ae6aec4d3e5e85b11d0fe8f4ddb1ea6
md: use common code for all calls to ->hot_remove_disk()

slot_store and remove_and_add_spares both call ->hot_remove_disk(),
but with slightly different tests and consequences, which is
at least untidy and might be buggy.

So modify remove_and_add_spaces() so that it can be asked
to remove a specific device, and call it from slot_store().

We also clear the Blocked flag to ensure that doesn't prevent
removal.  The purpose of Blocked is to prevent automatic removal
by the kernel before an error is acknowledged.
If the array is read/write then user-space would have not reason
to remove a device unless it was known to be 'spare' or 'faulty' in
which it would have already cleared the Blocked flag.
If the array is read-only, the flag might still be blocked, but
there is no harm in clearing the flag for read-only arrays.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c