kpartx -d now uses absolute paths to delete mappings, since the
commit
9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b. We should use
those same absolute paths to create the mappings.
Without this patch, the following workflow (as seen in the
manual page for kpartx) fails to actually remove the devices:
# kpartx -av disk.img
...
# kpartx -d disk.img
if (!loopdev) {
loopdev = find_unused_loop_device();
if (!loopdev) {
loopdev = find_unused_loop_device();
- if (set_loop(loopdev, device, 0, &ro)) {
+ if (set_loop(loopdev, rpath, 0, &ro)) {
fprintf(stderr, "can't set up loop\n");
exit (1);
}
fprintf(stderr, "can't set up loop\n");
exit (1);
}