diff mbox series

[1/1] kpartx: Use absolute paths to create mappings

Message ID 20181006073856.15246-2-stefw@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series Fix kpart -d regression where matching devices not found | expand

Commit Message

Stef Walter Oct. 6, 2018, 7:38 a.m. UTC
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(-)

Comments

Benjamin Marzinski Oct. 9, 2018, 11:21 p.m. UTC | #1
On Sat, Oct 06, 2018 at 09:38:56AM +0200, Stef Walter wrote:
> 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

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>

> ---
>  kpartx/kpartx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
> index 442b6bd9..d4fb53be 100644
> --- a/kpartx/kpartx.c
> +++ b/kpartx/kpartx.c
> @@ -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);
>  			}
> -- 
> 2.17.1
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 442b6bd9..d4fb53be 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -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);
 			}