File multipath-tools-kpartx-use-noflush of Package multipath-tools

commit 712f1ab067598ccf075b9dd1e5bc3367128c8252
Author: Hannes Reinecke <hare@suse.de>
Date:   Mon Feb 9 13:59:57 2009 +0100

    Use noflush for kpartx
    
    kpartx has to use 'noflush' to be able to complete for an all-paths
    down scenario. Otherwise no uevent might be sent and multipath
    will stall.
    
    References: 473352
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
index 6f6edba..6579bff 100644
--- a/kpartx/devmapper.c
+++ b/kpartx/devmapper.c
@@ -54,7 +54,7 @@ dm_prereq (char * str, int x, int y, int z)
 }
 
 extern int
-dm_simplecmd (int task, const char *name) {
+dm_simplecmd (int task, const char *name, int no_flush) {
 	int r = 0;
 	struct dm_task *dmt;
 
@@ -65,6 +65,10 @@ dm_simplecmd (int task, const char *name) {
 		goto out;
 
 	dm_task_no_open_count(dmt);
+	dm_task_skip_lockfs(dmt);
+
+	if (no_flush)
+		dm_task_no_flush(dmt);
 
 	r = dm_task_run(dmt);
 
diff --git a/kpartx/devmapper.h b/kpartx/devmapper.h
index 9290768..6789472 100644
--- a/kpartx/devmapper.h
+++ b/kpartx/devmapper.h
@@ -1,5 +1,5 @@
 int dm_prereq (char *, int, int, int);
-int dm_simplecmd (int, const char *);
+int dm_simplecmd (int, const char *, int);
 int dm_addmap (int, const char *, const char *, const char *, uint64_t,
 	       const char *, int);
 int dm_map_present (char *);
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 43dcd13..9e51116 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -419,7 +419,8 @@ main(int argc, char **argv){
 				if (!slices[j].size || !dm_map_present(partname))
 					continue;
 
-				if (!dm_simplecmd(DM_DEVICE_REMOVE, partname)) {
+				if (!dm_simplecmd(DM_DEVICE_REMOVE,
+							partname, 0)) {
 					r++;
 					continue;
 				}
@@ -472,7 +473,8 @@ main(int argc, char **argv){
 					r++;
 				}
 				if (op == DM_DEVICE_RELOAD &&
-				    !dm_simplecmd(DM_DEVICE_RESUME, partname)) {
+				    !dm_simplecmd(DM_DEVICE_RESUME,
+							partname, 1)) {
 					fprintf(stderr, "resume failed on %s\n",
 						partname);
 					r++;
@@ -533,7 +535,7 @@ main(int argc, char **argv){
 
 					if (op == DM_DEVICE_RELOAD)
 						dm_simplecmd(DM_DEVICE_RESUME,
-							     partname);
+							     partname, 1);
 
 					dm_devn(partname, &slices[j].major,
 						&slices[j].minor);
openSUSE Build Service is sponsored by