Fix kpart -d regression where matching devices not found
cover Fix kpart -d regression where matching devices not found
The Lorax project found a regression in kpartx -d behavior introduced by the following commit: 9bdfa3eb8e24b668e6c2bb882cddb0ccfe23ed5b
This patch should fix the problem. It's easy to reproduce this problem (I did it on Fedora 28) with the following commands:
# kpartx -av disk.img
...
# kpartx -dv disk.imgNotice that the loop devices and partition mappings created by the first command are not cleaned up by the second command.
Stef Walter (1):
kpartx: Use absolute paths to create mappings
kpartx/kpartx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH 1/1 kpartx: Use absolute paths to create mappings
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
---
kpartx/kpartx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)kpartx/kpartx.c +1 -1
@@ -341,7 +341,7 @@ main(int argc, char **argv){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 ); }
Signature · 1 line
2.17.1
Re: [PATCH 1/1] kpartx: Use absolute paths to create mappings
Quoted 10 lines · Stef Walter
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
Quoted 24 lines
--- kpartx/kpartx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kpartx/kpartx.c +1
-1@@ -341,7 +341,7 @@ main(int argc, char **argv){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 ); }Signature · 6 lines
2.17.1 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel