Cannot create dm-linear or dm-crypt mapping on scsi or mmc block device if mapping already exists on partition of device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Saludos,

I've hit some unexpected behavior that is not intuitive and might be
considered a bug. A dm-linear or dm-crypt (possibly others) mapping is
attempted to be created on a scsi or mmc block device (again, possibly
others) when there already exists a mapping on a sub block device, the
mapping creation will fail with EBUSY.  Here's a concrete example:

# dmsetup create --concise "dm-test,,,ro,0 8 linear /dev/sda1 0"
# dmsetup create --concise "dm-test2,,,ro,0 4 linear /dev/sda1 2"
# dmsetup create --concise "dm-test3,,,ro,0 4 linear /dev/sda 2"
[  968.046906] device-mapper: table: 252:2: linear: Device lookup failed (-EBUSY)
[  968.047305] device-mapper: ioctl: error adding target to table
device-mapper: reload ioctl on dm-test3 (252:2) failed: Device or resource busy
Command failed.
# dmsetup create --concise "dm-test4,,,ro,0 4 linear ${DEV}2 8"
# dmsetup table --show
dm-test: 0 8 linear 8:1 0
dm-test2: 0 4 linear 8:1 2
dm-test4: 0 4 linear 8:2 8

The second command shows that dm-linear has no issues with creating an
overlapping mapping on the same device. It makes little sense that the
third command fails where the second and fourth succeed. Further testing
shows that if there is an existing linear mapping on the full block device,
then mappings fail to be created on any partition block devices. This has
been tested on scsi and mmc devices. It is also true for the dm-crypt
target and mixing dm-linear and dm-crypt mappings. I've tested on Ubuntu's
6.8.1 test kernel. I doubt this is affected by any Ubuntu patching, but
perhaps someone could confirm this on a vanilla kernel.

I noticed this because I tried to create a dm-linear mapping of a scsi
device to capture sectors not contained in a partition, but it failed
because I already had a dm-crypt mapping on a partition of the device.

Any ideas what's going on? Are there good reasons for this behavior that
I'm unaware of? I've done some searching but haven't found it having been
reported anywhere. If this has been discussed, please point me in that
direction.

Glenn




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux