Use noflush for kpartx
authorHannes Reinecke <hare@suse.de>
Mon, 9 Feb 2009 12:59:57 +0000 (13:59 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Tue, 21 Apr 2009 23:44:53 +0000 (01:44 +0200)
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>
kpartx/devmapper.c
kpartx/devmapper.h
kpartx/kpartx.c

index 893d6dd..5686276 100644 (file)
@@ -53,7 +53,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;
 
@@ -64,6 +64,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);
 
index 2bd27d2..ca05239 100644 (file)
@@ -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 *);
index d1c06d2..afb956e 100644 (file)
@@ -414,7 +414,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;
                                }
@@ -467,7 +468,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++;
@@ -526,7 +528,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);