]> git.ipfire.org Git - thirdparty/mdadm.git/commit
--stop: separate 'is busy' test for 'did it stop properly'.
authorNeilBrown <neilb@suse.de>
Thu, 17 Mar 2011 02:35:10 +0000 (13:35 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 17 Mar 2011 02:35:10 +0000 (13:35 +1100)
commiteb0af52689656f6526540ee3a72b0647e7a7b20d
tree18f4df305e0bc84c7bae5b616b66f5d1bbb83b3c
parent1d8862cf613d671bcfbb796ca023161d2b907402
--stop: separate 'is busy' test for 'did it stop properly'.

Stopping an md array requires that there is no other user of it.
However with udev and udisks and such there can be transient other
users of md devices which can interfere with stopping the array.

If there is a transient users, we really want "mdadm --stop" to wait a
little while and retry.
However if the array is genuinely in-use (e.g. mounted), then we
don't want to wait at all - we want to fail immediately.

So before trying to stop, re-open device with O_EXCL.  If this fails
then the device is probably in use, so give up.

If it succeeds, but a subsequent STOP_ARRAY fails, then it is possibly
a transient failure, so try again for a few seconds.

Signed-off-by: NeilBrown <neilb@suse.de>
Manage.c