[dm-devel] possible bug with kpartx -d and absolute paths

Parke parke.nexus at gmail.com
Mon Jun 22 19:56:39 UTC 2015


Hi,

On Ubuntu 14.04:
kpartx version 0.4.9-3ubuntu7.2 has interesting behavior.
kpartx from version 0.5.0 built from source misbehaves identically.

The following works as expected:

cd /
kpartx -a mnt/path/to/disk.img
kpartx -d mnt/path/to/disk.img

However, if I use absolute paths, instead of relative paths, -a will
succeed, and -d will unexpectedly silently have no effect.

kpartx -a /mnt/path/to/disk.img
kpartx -d /mnt/path/to/disk.img    # silently has no effect

In this case, to delete the partition mappings, I need to:

kpartx -d /dev/loop0
losetup -d /dev/loop0

Further investigation revealed that kpartx is unexpectedly confused by
different files that happen to have the same name:

cd /mnt/path/to
kpartx -a disk.img    # succeeds, as expected

cd ..
kpartx -d to/disk.img    # silently has no effect

cd /tmp
touch disk.img
kpartx -d disk.img    # unexpectedly unmaps /mnt/path/to/disk.img and
detaches /dev/loop0

Cheers,

Parke




More information about the dm-devel mailing list