forked from pool/multipath-tools
57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
From 67f0f96ae532f8fda862576fba6f718809ade128 Mon Sep 17 00:00:00 2001
|
|
From: Hannes Reinecke <hare@suse.de>
|
|
Date: Tue, 14 Oct 2008 08:38:29 +0200
|
|
Subject: [PATCH] kpartx -l does not remove it's loop device
|
|
|
|
When doing a kpartx -l it does not remove it's loop device when done.
|
|
|
|
The appended patch to multipath-tools could fix this.
|
|
|
|
References: 417266
|
|
|
|
Signed-off-by: Philipp Zimmer <pzimmer@novell.com>
|
|
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
---
|
|
kpartx/kpartx.c | 11 +++++++++++
|
|
1 files changed, 11 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
|
|
index d1ba87c..43dcd13 100644
|
|
--- a/kpartx/kpartx.c
|
|
+++ b/kpartx/kpartx.c
|
|
@@ -198,6 +198,7 @@ main(int argc, char **argv){
|
|
char *mapname = NULL;
|
|
int loopro = 0;
|
|
int hotplug = 0;
|
|
+ int loopcreated = 0;
|
|
struct stat buf;
|
|
|
|
initpts();
|
|
@@ -292,6 +293,7 @@ main(int argc, char **argv){
|
|
fprintf(stderr, "can't set up loop\n");
|
|
exit (1);
|
|
}
|
|
+ loopcreated = 1;
|
|
}
|
|
device = loopdev;
|
|
}
|
|
@@ -394,6 +396,15 @@ main(int argc, char **argv){
|
|
break;
|
|
}
|
|
|
|
+ if (loopcreated && S_ISREG (buf.st_mode)) {
|
|
+ if (del_loop(device)) {
|
|
+ if (verbose)
|
|
+ printf("can't del loop : %s\n",
|
|
+ device);
|
|
+ exit(1);
|
|
+ }
|
|
+ printf("loop deleted : %s\n", device);
|
|
+ }
|
|
break;
|
|
|
|
case DELETE:
|
|
--
|
|
1.5.2.4
|
|
|