md_monitor: Move locking into remove_component()

remove_component() requires locking, so move it into the
function itself instead of relying external locking.

Signed-off-by: Hannes Reinecke <hare@suse.de>
md_monitor: Lock MD device list

We need to lock the MD device list, too.

Signed-off-by: Hannes Reinecke <hare@suse.de
md_monitor: Clear up MD device mutex

When we remove an MD device we need to remove the device mutex, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
md_monitor: Fix race condition when removing MD

When removing an MD device we need to take care to modify md_list
atomically so as not to introduce races.

Signed-off-by: Hannes Reinecke <hare@suse.de>
md_monitor: Close race window on MD creation

When a new MD monitor is created we need to insert it atomically
into the list to avoid race conditions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
md_monitor: Stop array monitoring on DeviceDisappeared

Stop array monitoring when a 'DeviceDisappeared' message is
received.

Signed-off-by: Hannes Reinecke <hare@suse.de>
md_monitor: fixup concurrent MD array removal

When several arrays are removed and added concurrently we need
to re-check the device pointer during CLI processing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
monitor_testcase1: Use md_monitor CLI message for status

We want to test if md_monitor is still alive, so we should be
using the CLI call out for status.

Signed-off-by: Hannes Reinecke <hare@suse.de>
monitor_testcase11.sh: concurrent array startup/shutdown

Test concurrent startup and shutdown.

Signed-off-by: Hannes Reinecke <hare@suse.de>