Bug#827412: multipath-tools: /dev/mapper device files not removed when partition is removed

Ritesh Raj Sarraf rrs at debian.org
Fri Jun 17 11:47:36 UTC 2016


On Fri, 2016-06-17 at 14:32 +0530, Ritesh Raj Sarraf wrote:
> 
> 
> To be honest, I'm a little lost now. This last line looks like where the bug
> is,
> but again, if this is the bug, I can't see a reason why the patch worked on
> it.
> 
> Can you run the following command on the device that you create a partition
> for?
> sudo udevadm info --path /sys/block/dm-0 --query=all
> 
> Where dm-X is your device.

I ran it on my virtual setup.


root at debian-btrfs:~# udevadm info --path /sys/block/dm-2 --query=all
P: /devices/virtual/block/dm-2
N: dm-2
L: 50
S: disk/by-id/dm-name-36001405226c2409d98a4e35ba427b274-part1
S: disk/by-id/dm-uuid-part1-mpath-36001405226c2409d98a4e35ba427b274
S: disk/by-id/scsi-36001405226c2409d98a4e35ba427b274-part1
S: disk/by-id/wwn-0x6001405226c2409d98a4e35ba427b274-part1
S: mapper/36001405226c2409d98a4e35ba427b274-part1
E: DEVLINKS=/dev/disk/by-id/wwn-0x6001405226c2409d98a4e35ba427b274-part1 /dev/disk/by-id/dm-uuid-part1-mpath-36001405226c2409d98a4e35ba427b274 /dev/mapper/36001405226c2409d98a4e35ba427b274-part1 /dev/disk/by-id/dm-name-36001405226c2409d98a4e35ba427b274-part1 /dev/disk/by-id/scsi-36001405226c2409d98a4e35ba427b274-part1
E: DEVNAME=/dev/dm-2
E: DEVPATH=/devices/virtual/block/dm-2
E: DEVTYPE=disk
E: DM_ACTIVATION=1
E: DM_MPATH=36001405226c2409d98a4e35ba427b274
E: DM_NAME=36001405226c2409d98a4e35ba427b274-part1
E: DM_PART=1
E: DM_STATE=ACTIVE
E: DM_SUSPENDED=0
E: DM_TABLE_STATE=LIVE
E: DM_TYPE=scsi
E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
E: DM_UDEV_PRIMARY_SOURCE_FLAG=1
E: DM_UDEV_RULES=1
E: DM_UUID=part1-mpath-36001405226c2409d98a4e35ba427b274
E: DM_WWN=0x6001405226c2409d98a4e35ba427b274
E: ID_PART_ENTRY_DISK=253:1
E: ID_PART_ENTRY_NUMBER=1
E: ID_PART_ENTRY_OFFSET=65528
E: ID_PART_ENTRY_SCHEME=dos
E: ID_PART_ENTRY_SIZE=2031624
E: ID_PART_ENTRY_TYPE=0x83
E: MAJOR=253
E: MINOR=2
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=339233875


The problem here is: E: DM_UUID=part1-mpath-36001405226c2409d98a4e35ba427b274 and the udev rule's: ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
        RUN+="/sbin/kpartx -u -p -part /dev/$name"


For the whole device, the report is such:

root at debian-btrfs:~# udevadm info --path /sys/block/dm-1 --query=all
P: /devices/virtual/block/dm-1
N: dm-1
L: 50
S: disk/by-id/dm-name-36001405226c2409d98a4e35ba427b274
S: disk/by-id/dm-uuid-mpath-36001405226c2409d98a4e35ba427b274
S: disk/by-id/scsi-36001405226c2409d98a4e35ba427b274
S: disk/by-id/wwn-0x6001405226c2409d98a4e35ba427b274
S: mapper/36001405226c2409d98a4e35ba427b274
E: DEVLINKS=/dev/disk/by-id/dm-uuid-mpath-36001405226c2409d98a4e35ba427b274 /dev/disk/by-id/scsi-36001405226c2409d98a4e35ba427b274 /dev/mapper/36001405226c2409d98a4e35ba427b274 /dev/disk/by-id/dm-name-36001405226c2409d98a4e35ba427b274 /dev/disk/by-id/wwn-0x6001405226c2409d98a4e35ba427b274
E: DEVNAME=/dev/dm-1
E: DEVPATH=/devices/virtual/block/dm-1
E: DEVTYPE=disk
E: DM_NAME=36001405226c2409d98a4e35ba427b274
E: DM_STATE=ACTIVE
E: DM_SUSPENDED=0
E: DM_TABLE_STATE=LIVE
E: DM_TYPE=scsi
E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
E: DM_UDEV_PRIMARY_SOURCE_FLAG=1
E: DM_UDEV_RULES=1
E: DM_UUID=mpath-36001405226c2409d98a4e35ba427b274
E: DM_WWN=0x6001405226c2409d98a4e35ba427b274
E: ID_PART_TABLE_TYPE=dos
E: MAJOR=253
E: MINOR=1
E: SUBSYSTEM=block
E: TAGS=:systemd:
E: USEC_INITIALIZED=24061606


Now I am not sure if DM_UUID being prepended with partN is the correct behavior. Andrew: Do you know about it ?
From what I understand, the state of DM_UUID is different in Debian than Upstream. See debian/dmsetup_env for details.
Maybe the previous maintainer has the history of this deviation.


That said, my previous patch was not correct. I still don't know why it worked for your case. :-)

But for Debian, in its current form, perhaps the new (attached) patch will be better. Can you please test it Andrew?
I'll also talk to Guido when I get a chance.


-- 
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System
-------------- next part --------------
A non-text attachment was scrubbed...
Name: catch-partitioned-devices-dmuuid.patch
Type: text/x-patch
Size: 480 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-lvm-maintainers/attachments/20160617/fc18f1d8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-lvm-maintainers/attachments/20160617/fc18f1d8/attachment.sig>


More information about the pkg-lvm-maintainers mailing list