[dm-devel] [PATCH 01/14] multipathd: return if dm_get_major_minor failed in, cli_add_map

lixiaokeng lixiaokeng at huawei.com
Wed Sep 2 07:15:48 UTC 2020


If dm_get_major_minor failed, log with major and minor should not
be printed to avoid major and minor used before initialization.

Signed-off-by: Lixiaokeng <lixiaokeng at huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26 at huawei.com>
Signed-off-by: Linfeilong <linfeilong at huawei.com>
---
 multipathd/cli_handlers.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 8db37961..2d297fd0 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -847,11 +847,12 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
 		else {
 			sprintf(dev_path, "dm-%d", minor);
 			alias = dm_mapname(major, minor);
+			if (!alias)
+				condlog(2, "%s: mapname not found for %d:%d",
+					param, major, minor);
 		}
 		/*if there is no mapname found, we first create the device*/
 		if (!alias && !count) {
-			condlog(2, "%s: mapname not found for %d:%d",
-				param, major, minor);
 			get_refwwid(CMD_NONE, param, DEV_DEVMAP,
 				    vecs->pathvec, &refwwid);
 			if (refwwid) {
-- 




More information about the dm-devel mailing list