]> git.ipfire.org Git - thirdparty/mdadm.git/commit
--stop: separate 'is busy' test for 'did it stop properly'.
authorNeilBrown <neilb@suse.de>
Wed, 23 Mar 2011 04:42:24 +0000 (15:42 +1100)
committerNeilBrown <neilb@suse.de>
Wed, 23 Mar 2011 04:42:24 +0000 (15:42 +1100)
commitfb0d4b9ca2fca333d82fabd1a7aa55e138e83910
tree864ee17ddd112ab16543c90fec422ff33412221e
parentce7a187b9a2c58783276c9da65088494f4f85124
--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