]> git.ipfire.org Git - thirdparty/mdadm.git/commit
Simplistig locking for --incremental.
authorBill Nottingham <notting@redhat.com>
Mon, 5 May 2008 09:44:04 +0000 (19:44 +1000)
committerNeil Brown <neilb@suse.de>
Mon, 5 May 2008 09:44:04 +0000 (19:44 +1000)
commit767bd452981d5fae96487b1394f9d1ff535a3127
tree595edad926e7458e9c82ddedb599030aaed11df6
parent62552fdfccf7db17edb136e504703e6b18cec72a
Simplistig locking for --incremental.

From: Bill Nottingham <notting@redhat.com>

mdadm --incremental doesn't really do any locking. If you get multiple
events in parallel for the same device (that has not yet started), they
will all go down the path to create the array. One will succeed, the
rest will have SET_ARRAY_INFO die with -EBUSY (md: array mdX already has disks!)
and will exit without adding the disk.

Original bug report is: https://bugzilla.redhat.com/show_bug.cgi?id=433932

This is solved by adding very very rudimentary locking. Incremental() now
opens the device with O_EXCL to ensure only one invocation is frobbing the
array at once. A simple loop just tries to open 5 times a second for 5
seconds. If the array stays locked that long, you probably have bigger
issues.
mdopen.c