multipath: check for running daemon when called with '-u'
authorHannes Reinecke <hare@suse.de>
Wed, 9 Jul 2014 09:43:28 +0000 (11:43 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sun, 29 Mar 2015 15:58:50 +0000 (17:58 +0200)
When multipath is called to check for a valid device it really
should check if the daemon is running. Otherwise it'll blindly
assume the device to be eligible for multipathing even though
the daemon isn't running.

Signed-off-by: Hannes Reinecke <hare@suse.de>
multipath/main.c

index 08ba66c..ce8fb5b 100644 (file)
@@ -56,6 +56,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <wwids.h>
+#include <uxsock.h>
 #include "dev_t.h"
 
 int logsink;
@@ -622,6 +623,18 @@ main (int argc, char *argv[])
                condlog(0, "the -c option requires a path to check");
                goto out;
        }
+       if (conf->cmd == CMD_VALID_PATH &&
+           conf->dev_type == DEV_UEVENT) {
+               int fd;
+
+               fd = ux_socket_connect(DEFAULT_SOCKET);
+               if (fd == -1) {
+                       printf("%s is not a valid multipath device path\n",
+                               conf->dev);
+                       goto out;
+               }
+               close(fd);
+       }
        if (conf->cmd == CMD_REMOVE_WWID && !conf->dev) {
                condlog(0, "the -w option requires a device");
                goto out;