]> git.ipfire.org Git - thirdparty/mdadm.git/commit - Assemble.c
Assemble: don't use O_EXCL until we have checked device content.
authorNeilBrown <neilb@suse.de>
Tue, 6 Mar 2012 23:41:24 +0000 (10:41 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 6 Mar 2012 23:41:24 +0000 (10:41 +1100)
commit56d1885944b25cc186ad18827b62e14c49b3c3b5
tree78f45af2bc8b7506e211a9019b3dcd668086b98a
parent0011874f7e8ee85b8c0d52a37ca461248864017a
Assemble: don't use O_EXCL until we have checked device content.

If we open with O_EXCL before checking that the device is one that
we really want, then that could cause some other process to think
the device is busy when it isn't really.

This particularly affects running "mdadm -A devname" in parallel for
different arrays.  One might be looking at a device that it won't
end up using while another trys and fails to look at a device that
it needs.

So delay the O_EXCL until after all identity checks.

Multiple "mdadm -As" will still have races, but that is fundamentally
racy anyway.

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