libmpathpersist: updatepaths: deal with missing pp->udev
authorMartin Wilck <mwilck@suse.com>
Mon, 27 May 2019 12:59:37 +0000 (14:59 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 3 Jul 2019 06:28:29 +0000 (08:28 +0200)
We will change the data structure initialization to a lazy
approach, where pp->udev isn't necessarily initialized
when get_mpvec() is called. Deal with it.

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmpathpersist/mpath_persist.c

index 6505774..fee1db7 100644 (file)
@@ -16,6 +16,7 @@
 #include "config.h"
 #include "switchgroup.h"
 #include "discovery.h"
 #include "config.h"
 #include "switchgroup.h"
 #include "discovery.h"
+#include "configure.h"
 #include "dmparser.h"
 #include <ctype.h>
 #include "propsel.h"
 #include "dmparser.h"
 #include <ctype.h>
 #include "propsel.h"
@@ -96,6 +97,17 @@ updatepaths (struct multipath * mpp)
                                continue;
                        }
                        pp->mpp = mpp;
                                continue;
                        }
                        pp->mpp = mpp;
+                       if (pp->udev == NULL) {
+                               pp->udev = get_udev_device(pp->dev_t, DEV_DEVT);
+                               if (pp->udev == NULL) {
+                                       pp->state = PATH_DOWN;
+                                       continue;
+                               }
+                               conf = get_multipath_config();
+                               pathinfo(pp, conf, DI_SYSFS|DI_CHECKER);
+                               put_multipath_config(conf);
+                               continue;
+                       }
                        if (pp->state == PATH_UNCHECKED ||
                                        pp->state == PATH_WILD) {
                                conf = get_multipath_config();
                        if (pp->state == PATH_UNCHECKED ||
                                        pp->state == PATH_WILD) {
                                conf = get_multipath_config();