[dm-devel] Re: racing libdevmapper calls

Christophe Varoqui christophe.varoqui at free.fr
Tue Oct 18 23:05:55 UTC 2005


On mer, 2005-10-19 at 00:30 +0200, Christophe Varoqui wrote:
> Hello,
> 
> The following command :
> # dmsetup remove foo;echo "0 10 linear 8:16 63"|dmsetup create foo &
> echo "0 20 linear 8:16 63"|dmsetup create foo
> 
> will quite easily produce error message like :
> "device-mapper ioctl cmd 3 failed: Device or resource busy"
> 
> Is it designed behaviour ?
> Can't we expect libdevmapper to serialize its ioctls ?
> 
> multipath(8), being run in storms by udev, has trouble with this.
> Ideas ?
> 
I realize this example is trivially flawed : 2nd ioctl will necessarily
fail, and the message is appropriate in this case.

But in multipath(8), I tried something like :

if (map exists) /* through DM_DEVICE_INFO */
	DM_DEVICE_RELOAD
else
	DM_DEVICE_CREATE

Which translate like :
# dmsetup remove foo;echo "0 10 linear 8:16 63"|dmsetup create foo &
dmsetup info foo || echo "0 20 linear 8:16 63"|dmsetup create foo

But I can't seem to avoid the "device-mapper ioctl cmd 3 failed: Device
or resource busy" messages.

Regards,
cvaroqui





More information about the dm-devel mailing list