[dm-devel] racing libdevmapper calls

Alasdair G Kergon agk at redhat.com
Thu Oct 20 14:38:12 UTC 2005


Neither libdevmapper nor dmsetup does any locking.

It's easy to make the case for dmsetup to include locking - but
dmsetup is only meant as a diagnostic tool so it's hardly an 
important feature to add.

DM_DEVICE_CREATE with a table supplied is *not* an atomic
operation.  It only exists to provide backwards-compatibility for
the original version of the ioctls (when it *was* atomic).  It's 
perfectly OK still to use it when convenient, but you have to 
remember it's actually performing *two* ioctls:

  DM_DEV_CREATE
  DM_TABLE_LOAD

If you need finer-level control, you may be better off calling
those two separately i.e. DM_DEVICE_CREATE without a table 
(if the device doesn't already exist) then DM_DEVICE_RELOAD.

Alasdair
-- 
agk at redhat.com




More information about the dm-devel mailing list