[PATCH] multipathd: add map feature fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hii, 

Its found that the add map feature of multipathd tools is not working. i.e its  not able to add the map again once removed. The following is the test case:

Case  : remove and add map.
root@x86-generic-64:~# multipathd -k'show maps'
name    sysfs uuid
dmpath0 dm-0  1IET_00010001
root@x86-generic-64:~# multipathd -k'remove map dmpath0'
ok
root@x86-generic-64:~# multipathd -k'show maps'
root@x86-generic-64:~# multipathd -k'add map dmpath0'
ok
root@x86-generic-64:~# multipathd -k'show maps'
root@x86-generic-64:~#
Once a map is removed, we are able to add it only using #multipath  command and not using multipathd tools.

I worked on a fix for the same and the following patch solves the problem. There is also some unused code which could removed here in ev_add_map function. 
PFA the patches.

It would be great if the patches are reviewed. It would also help if someone could share the procedure for submission of patches.

Regards,
Tejaswini 
commit 910b4a82ec483b48eaf8b24eb3d7829273c690ed
Author: Tejaswini <tejaswinipoluri3@xxxxxxxxx>
Date:   Wed Jul 8 17:18:03 2015 +0530

    multipathd: Disabled code that is not being used.
    
    This part of the code is moved to cli_add_map and
    disabled here as it is not used by any function call
    here.
    
    Signed-off-by: Tejaswini <tejaswinipoluri3@xxxxxxxxx>

diff --git a/multipathd/main.c b/multipathd/main.c
index f876258..060237c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -329,6 +329,8 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
 			return 1;
 		}
 	}
+#if 0 /*Disabled as the code is not being used by anyone.
+	TODO:confirm that no feature requires this code*/
 	r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
 
 	if (refwwid) {
@@ -344,6 +346,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
 		condlog(0, "%s: uev_add_map %s failed", alias, dev);
 
 	FREE(refwwid);
+#endif
 	return r;
 }
 
commit 79ab9090d3fbcdb5844478419135d1390cf548c2
Author: Tejaswini <tejaswinipoluri3@xxxxxxxxx>
Date:   Wed Jul 8 15:08:56 2015 +0530

    multipathd: Fixing add map functionality
    
    Add map feature of multipathd tools fails as the device
    is also been completely removed along with removing the map
    in the remove map code. So when add map is called we are
    creating the device again in kernel and doing add map
    using the coloasce_paths code.
    
    Signed-off-by: Tejaswini Poluri <tpoluri@xxxxxxxxxx>

diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index dc96c45..c54c767 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -537,7 +537,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
 	char dev_path[PATH_SIZE];
 	char *alias;
 	int rc;
-
+	char *refwwid;
 	param = convert_dev(param, 0);
 	condlog(2, "%s: add map (operator)", param);
 
@@ -547,6 +547,14 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
 		condlog(2, "%s: map blacklisted", param);
 		return 0;
 	}
+	rc = get_refwwid(param, DEV_DEVMAP, vecs->pathvec, &refwwid);
+
+        if (refwwid) {
+                condlog(2, "%s: add map (operator)", refwwid);
+                if(coalesce_paths(vecs, NULL, refwwid, 0))
+			condlog(2, "%s: coalesce-paths failed", param);
+                dm_lib_release();
+        }
 	minor = dm_get_minor(param);
 	if (minor < 0) {
 		condlog(2, "%s: not a device mapper table", param);
@@ -566,6 +574,7 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
 	}
 	rc = ev_add_map(dev_path, alias, vecs);
 	FREE(alias);
+	FREE(refwwid);
 	return rc;
 }
 
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux