dmsetup rename sometimes creates new device name but does not remove original device name
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lvm2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: lvm2
Running dmsetup rename sometimes creates a new device name but does not remove the original device name.
The behavior is observed when dmsetup rename is called from cryptdisks_start ... perhaps there is a timing issue when decrypting encrypted devices?
# ls /dev/mapper <--- encrypted devices are not present
# cryptdisks_start CRYPT <--- encrypted device is described in crypttab
Starting crypto disk...
CRYPT (starting)...
Key slot unlocked.
CRYPT (started)... [ OK ] <--- encrypted device has been mapped and renamed using dmsetup
# ls /dev/mapper
CRYPT_unformatted CRYPT <--- however, note that the intermediate device name is still present after being renamed
# dmsetup info CRYPT_unformatted
Device does not exist.
Command failed
# dmsetup info CRYPT
Name: CRYPT
State: ACTIVE
...<snip>...
# dmsetup remove CRYPT_unformatted
device-mapper: remove ioctl failed: No such device or address
Command failed
# rm CRYPT_unformatted <--- this succeeds in removing the intermediate device name
# dmsetup rename CRYPT CRYPT2 <--- when run from command line after cryptdisk_start has finished, this succeeds
This seems to be the cause of bug 502665, itself a regression from bug 475936.
I would be happy to provide additional information that would be helpful for resolving this.
tags: | added: patch |
When a device is being renamed, if it is currently in use, the new device name is created but old device name is not removed. The attached forces cryptdisks_start to wait until it is safe to rename the device. In my case, the delay is typically about one second.
The attached is only a work-around, it seems to me that similar logic would be better suited somewhere in dmsetup.