[dm-devel] [PATCH] multipath: fix multipath -l <devmap> without output

Mauricio Faria de Oliveira mauricfo at linux.vnet.ibm.com
Mon Jul 25 13:41:38 UTC 2016


Currently, the multipath -l <devmap> output is empty, and an error
is printed to syslog:

    # ./multipath -l mpatha
    #

    # echo $?
    1

    # tail /var/log/messages
    ...
    ... multipath: mpatha: can't get udev device

That's due to dev_type not being initialized, and incorrectly evaluated.
So, initialize it to DEV_NONE, which is verified/reset by get_dev_type().

Now there's actual output and no error in syslog:

    # ./multipath -l mpatha
    mpatha (3600a0b800011e95c000055d855167d1c) dm-0 IBM,1815      FAStT
    ...

    # echo $?
    0

Signed-off-by: Mauricio Faria de Oliveira <mauricfo at linux.vnet.ibm.com>

(tested on '2613ce0 Bump version code to 0.6.2')
---
 multipath/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/multipath/main.c b/multipath/main.c
index 6ccece7..93376a9 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -511,7 +511,7 @@ main (int argc, char *argv[])
 	extern int optind;
 	int r = 1;
 	enum mpath_cmds cmd = CMD_CREATE;
-	enum devtypes dev_type;
+	enum devtypes dev_type = DEV_NONE;
 	char *dev = NULL;
 	struct config *conf;
 
-- 
1.8.3.1




More information about the dm-devel mailing list