Hello community,

here is the log from the commit of package multipath-tools for openSUSE:Factory 
checked in at 2018-03-24 16:10:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/multipath-tools (Old)
 and      /work/SRC/openSUSE:Factory/.multipath-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "multipath-tools"

Sat Mar 24 16:10:44 2018 rev:101 rq:589743 version:0.7.3+59+suse.1b6191c26774

Changes:
--------
--- /work/SRC/openSUSE:Factory/multipath-tools/multipath-tools.changes  
2018-03-01 12:07:12.083406399 +0100
+++ /work/SRC/openSUSE:Factory/.multipath-tools.new/multipath-tools.changes     
2018-03-24 16:10:46.881444119 +0100
@@ -1,0 +2,18 @@
+Wed Mar 21 08:32:13 UTC 2018 - [email protected]
+
+- Update to version 0.7.3+59+suse.1b6191c26774:
+  * libmultipath: don't reject maps with undefined prio (bsc#1085212,
+  bsc#1075129)
+  * multipathd: handle errors in uxlsnr as fatal (bsc#1086025)
+
+-------------------------------------------------------------------
+Tue Mar 20 14:55:34 UTC 2018 - [email protected]
+
+- Update to version 0.7.3+57+suse.bb6be4c8b4ca:
+  * multipathd: fix signal blocking logic (bsc#1086025)
+  * multipath-tools: handle exit signal immediately (bsc#1086025)
+  * multipath: fix DEF_TIMEOUT use (bsc#1086014)
+  * multipath-tools: foreign/NVME implementation v2 (upstream accepted)
+    (bsc#1082419)
+
+-------------------------------------------------------------------

Old:
----
  multipath-tools-0.7.3+53+suse.140f4937e9e7.tar.xz

New:
----
  multipath-tools-0.7.3+59+suse.1b6191c26774.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ multipath-tools.spec ++++++
--- /var/tmp/diff_new_pack.DXApbd/_old  2018-03-24 16:10:47.681415281 +0100
+++ /var/tmp/diff_new_pack.DXApbd/_new  2018-03-24 16:10:47.685415137 +0100
@@ -97,7 +97,7 @@
 
 Name:           multipath-tools
 Url:            http://christophe.varoqui.free.fr/
-Version:        0.7.3+53+suse.140f4937e9e7
+Version:        0.7.3+59+suse.1b6191c26774
 Release:        0
 Summary:        Tools to Manage Multipathed Devices with the device-mapper
 License:        GPL-2.0

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.DXApbd/_old  2018-03-24 16:10:47.741413118 +0100
+++ /var/tmp/diff_new_pack.DXApbd/_new  2018-03-24 16:10:47.745412974 +0100
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/openSUSE/multipath-tools.git</param>
-              <param 
name="changesrevision">140f4937e9e7b0c6fa68cf4f34fad6f5bc868706</param></service><service
 name="tar_scm">
+              <param 
name="changesrevision">1b6191c267746c9baa756623078b3bd84dc2b13c</param></service><service
 name="tar_scm">
                 <param 
name="url">https://github.com/mwilck/multipath-tools.git</param>
               <param 
name="changesrevision">08a969b7fce0db769b63bdbfead2a452dc417d58</param></service></servicedata>
\ No newline at end of file

++++++ multipath-tools-0.7.3+53+suse.140f4937e9e7.tar.xz -> 
multipath-tools-0.7.3+59+suse.1b6191c26774.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/configure.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/configure.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/configure.c     
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/configure.c     
2018-03-21 09:29:04.000000000 +0100
@@ -967,9 +967,6 @@
                        continue;
                }
 
-               if (pp1->priority == PRIO_UNDEF)
-                       mpp->action = ACT_REJECT;
-
                if (!mpp->paths) {
                        condlog(0, "%s: skip coalesce (no paths)", mpp->alias);
                        remove_map(mpp, vecs, 0);
@@ -995,8 +992,6 @@
                                        mpp->size);
                                mpp->action = ACT_REJECT;
                        }
-                       if (pp2->priority == PRIO_UNDEF)
-                               mpp->action = ACT_REJECT;
                }
                verify_paths(mpp, vecs);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/discovery.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/discovery.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/discovery.c     
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/discovery.c     
2018-03-21 09:29:04.000000000 +0100
@@ -767,7 +767,7 @@
        io_hdr.dxferp = resp;
        io_hdr.cmdp = inqCmdBlk;
        io_hdr.sbp = sense_b;
-       io_hdr.timeout = DEF_TIMEOUT;
+       io_hdr.timeout = DEF_TIMEOUT * 1000;
 
        if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
                return -1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign/nvme.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign/nvme.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign/nvme.c  
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign/nvme.c  
2018-03-21 09:29:04.000000000 +0100
@@ -26,7 +26,8 @@
 #include <libudev.h>
 #include <pthread.h>
 #include <limits.h>
-#include <glob.h>
+#include <dirent.h>
+#include <errno.h>
 #include "vector.h"
 #include "generic.h"
 #include "foreign.h"
@@ -278,7 +279,7 @@
                if (pci != NULL)
                        return snprintf(buff, len, "PCI:%s",
                                        udev_device_get_sysname(pci));
-               __attribute__ ((fallthrough));
+               /* fall through */
        default:
                return snprintf(buff, len, "%s", N_A);
                break;
@@ -352,17 +353,21 @@
 
 void cleanup(struct context *ctx)
 {
-       if (ctx == NULL)
-               return;
-
        (void)delete_all(ctx);
 
        lock(ctx);
+       /*
+        * Locking is not strictly necessary here, locking in foreign.c
+        * makes sure that no other code is called with this ctx any more.
+        * But this should make static checkers feel better.
+        */
        pthread_cleanup_push(unlock, ctx);
        if (ctx->udev)
                udev_unref(ctx->udev);
+       ctx->udev = NULL;
        if (ctx->mpvec)
                vector_free(ctx->mpvec);
+       ctx->mpvec = NULL;
        pthread_cleanup_pop(1);
        pthread_mutex_destroy(&ctx->mutex);
 
@@ -439,10 +444,15 @@
        return NULL;
 }
 
+static int no_dotfiles(const struct dirent *di)
+{
+       return di->d_name[0] != '.';
+}
+
 static void _find_slaves(struct context *ctx, struct nvme_map *map)
 {
        char pathbuf[PATH_MAX];
-       glob_t globbuf;
+       struct dirent **di = NULL;
        struct nvme_path *path;
        int r, i;
 
@@ -452,36 +462,28 @@
        vector_foreach_slot(map->pathvec, path, i)
                path->seen = false;
 
-       memset(&globbuf, 0, sizeof(globbuf));
        snprintf(pathbuf, sizeof(pathbuf),
-               "%s/slaves/*",
+               "%s/slaves",
                udev_device_get_syspath(map->udev));
 
-       r = glob(pathbuf, 0, NULL, &globbuf);
+       r = scandir(pathbuf, &di, no_dotfiles, alphasort);
 
-       if (r == GLOB_NOMATCH) {
+       if (r == 0) {
                condlog(3, "%s: %s: no paths for %s", __func__, THIS,
                        udev_device_get_sysname(map->udev));
-               globfree(&globbuf);
                return;
-       } else if (r != 0) {
-               condlog(1, "%s: %s: error %d searching paths for %d:%d", 
__func__,
-                       THIS, r, major(map->devt), minor(map->devt));
-               globfree(&globbuf);
+       } else if (r < 0) {
+               condlog(1, "%s: %s: error %d scanning paths of %s", __func__,
+                       THIS, errno, udev_device_get_sysname(map->udev));
                return;
        }
-       for (i = 0; i < globbuf.gl_pathc; i++) {
-               char *fn;
-               struct udev_device *udev;
 
-               fn = strrchr(globbuf.gl_pathv[i], '/');
-               if (fn == NULL)
-                       fn = globbuf.gl_pathv[i];
-               else
-                       fn++;
+       pthread_cleanup_push(free, di);
+       for (i = 0; i < r; i++) {
+               char *fn = di[i]->d_name;
+               struct udev_device *udev;
 
-               if (snprintf(pathbuf, sizeof(pathbuf),
-                            "%s/slaves/%s",
+               if (snprintf(pathbuf, sizeof(pathbuf), "%s/slaves/%s",
                             udev_device_get_syspath(map->udev), fn)
                    >= sizeof(pathbuf))
                        continue;
@@ -489,7 +491,8 @@
                path = _find_path_by_syspath(map, pathbuf);
                if (path != NULL) {
                        path->seen = true;
-                       condlog(4, "%s: %s already known", __func__, fn);
+                       condlog(4, "%s: %s already known",
+                               __func__, fn);
                        continue;
                }
 
@@ -508,12 +511,10 @@
                path->udev = udev;
                path->seen = true;
                path->map = map;
-               path->ctl =
-                       udev_device_get_parent_with_subsystem_devtype(udev,
-                                                                     "nvme",
-                                                                     NULL);
+               path->ctl = udev_device_get_parent_with_subsystem_devtype
+                       (udev, "nvme", NULL);
                if (path->ctl == NULL) {
-                       condlog(1, "%s: %s; failed to get controller for %s",
+                       condlog(1, "%s: %s: failed to get controller for %s",
                                __func__, THIS, fn);
                        cleanup_nvme_path(path);
                        continue;
@@ -528,7 +529,7 @@
                        udev_device_get_sysname(map->udev));
                vector_set_slot(map->pathvec, path);
        }
-       globfree(&globbuf);
+       pthread_cleanup_pop(1);
 
        map->nr_live = 0;
        vector_foreach_slot_backwards(map->pathvec, path, i) {
@@ -567,7 +568,11 @@
 
        map->devt = devt;
        map->udev = udev_device_ref(ud);
-       map->subsys = udev_device_ref(subsys);
+       /*
+        * subsys is implicitly referenced by map->udev,
+        * no need to take a reference here.
+        */
+       map->subsys = subsys;
        map->gen.ops = &nvme_map_ops;
 
        map->pathvec = vector_alloc();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign.c       
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign.c       
2018-03-21 09:29:04.000000000 +0100
@@ -23,7 +23,8 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <limits.h>
-#include <glob.h>
+#include <dirent.h>
+#include <fnmatch.h>
 #include <dlfcn.h>
 #include <libudev.h>
 #include "vector.h"
@@ -36,6 +37,24 @@
 
 static vector foreigns;
 
+/* This protects vector foreigns */
+static pthread_rwlock_t foreign_lock = PTHREAD_RWLOCK_INITIALIZER;
+
+static void rdlock_foreigns(void)
+{
+       pthread_rwlock_rdlock(&foreign_lock);
+}
+
+static void wrlock_foreigns(void)
+{
+       pthread_rwlock_wrlock(&foreign_lock);
+}
+
+static void unlock_foreigns(void *unused)
+{
+       pthread_rwlock_unlock(&foreign_lock);
+}
+
 #define get_dlsym(foreign, sym, lbl)                                   \
        do {                                                            \
                foreign->sym =  dlsym(foreign->handle, #sym);           \
@@ -46,111 +65,110 @@
                }                                                       \
        } while(0)
 
-static void free_foreign(struct foreign **fgn)
+static void free_foreign(struct foreign *fgn)
 {
-       if (fgn == NULL || *fgn == NULL)
+       struct context *ctx;
+
+       if (fgn == NULL)
                return;
-       if ((*fgn)->context != NULL)
-               (*fgn)->cleanup((*fgn)->context);
-       if ((*fgn)->handle != NULL)
-               dlclose((*fgn)->handle);
-       free(*fgn);
+
+       ctx = fgn->context;
+       fgn->context = NULL;
+       if (ctx != NULL)
+               fgn->cleanup(ctx);
+
+       if (fgn->handle != NULL)
+               dlclose(fgn->handle);
+       free(fgn);
 }
 
-void cleanup_foreign(void)
+void _cleanup_foreign(void)
 {
        struct foreign *fgn;
        int i;
 
-       vector_foreach_slot(foreigns, fgn, i)
-               free_foreign(&fgn);
+       if (foreigns == NULL)
+               return;
+
+       vector_foreach_slot_backwards(foreigns, fgn, i) {
+               vector_del_slot(foreigns, i);
+               free_foreign(fgn);
+       }
        vector_free(foreigns);
        foreigns = NULL;
 }
 
-int init_foreign(const char *multipath_dir)
+void cleanup_foreign(void)
+{
+       wrlock_foreigns();
+       _cleanup_foreign();
+       unlock_foreigns(NULL);
+}
+
+static const char foreign_pattern[] = "libforeign-*.so";
+
+static int select_foreign_libs(const struct dirent *di)
+{
+
+       return fnmatch(foreign_pattern, di->d_name, FNM_FILE_NAME) == 0;
+}
+
+static int _init_foreign(const char *multipath_dir)
 {
        char pathbuf[PATH_MAX];
-       static const char base[] = "libforeign-";
-       static const char suffix[] = ".so";
-       glob_t globbuf;
-       int ret = -EINVAL, r, i;
+       struct dirent **di;
+       int r, i;
 
-       if (foreigns != NULL) {
-               condlog(0, "%s: already initialized", __func__);
-               return -EEXIST;
-       }
        foreigns = vector_alloc();
+       if (foreigns == NULL)
+               return -ENOMEM;
 
-       if (snprintf(pathbuf, sizeof(pathbuf), "%s/%s*%s",
-                    multipath_dir, base, suffix) >= sizeof(pathbuf)) {
-               condlog(1, "%s: path length overflow", __func__);
-               goto err;
-       }
-
-       condlog(4, "%s: looking for %s\n", __func__, pathbuf);
-       memset(&globbuf, 0, sizeof(globbuf));
-       r = glob(pathbuf, 0, NULL, &globbuf);
+       r = scandir(multipath_dir, &di, select_foreign_libs, alphasort);
 
-       if (r == GLOB_NOMATCH) {
+       if (r == 0) {
                condlog(3, "%s: no foreign multipath libraries found",
                        __func__);
-               globfree(&globbuf);
                return 0;
-       } else if (r != 0) {
-               char *msg;
-
-               if (errno != 0) {
-                       ret = -errno;
-                       msg = strerror(errno);
-               } else {
-                       ret = -1;
-                       msg = (r == GLOB_ABORTED ? "read error" :
-                              "out of memory");
-               }
-               condlog(0, "%s: search for foreign libraries failed: %d (%s)",
-                       __func__, r, msg);
-               globfree(&globbuf);
-               goto err;
+       } else if (r < 0) {
+               r = errno;
+               condlog(1, "%s: error %d scanning foreign multipath libraries",
+                       __func__, r);
+               _cleanup_foreign();
+               return -r;
        }
 
-       for (i = 0; i < globbuf.gl_pathc; i++) {
-               char *msg, *fn;
+       pthread_cleanup_push(free, di);
+       for (i = 0; i < r; i++) {
+               const char *msg, *fn, *c;
                struct foreign *fgn;
                int len, namesz;
 
-               fn = strrchr(globbuf.gl_pathv[i], '/');
-               if (fn == NULL)
-                       fn = globbuf.gl_pathv[i];
-               else
-                       fn++;
+               fn = di[i]->d_name;
 
                len = strlen(fn);
-               if (len <= sizeof(base) + sizeof(suffix) - 2) {
-                       condlog(0, "%s: internal error: filename too short: %s",
-                               __func__, globbuf.gl_pathv[i]);
+               c = strchr(fn, '-');
+               if (len < sizeof(foreign_pattern) - 1 || c == NULL) {
+                       condlog(0, "%s: bad file name %s, fnmatch error?",
+                               __func__, fn);
                        continue;
                }
-
+               c++;
                condlog(4, "%s: found %s", __func__, fn);
 
-               namesz = len + 3 - sizeof(base) - sizeof(suffix);
+               namesz = len - sizeof(foreign_pattern) + 3;
                fgn = malloc(sizeof(*fgn) + namesz);
                if (fgn == NULL)
                        continue;
                memset(fgn, 0, sizeof(*fgn));
+               strlcpy((char*)fgn + offsetof(struct foreign, name), c, namesz);
 
-               strlcpy((char*)fgn + sizeof(*fgn), fn + sizeof(base) - 1,
-                       namesz);
-               fgn->name = (const char*)fgn + sizeof(*fgn);
-
-               fgn->handle = dlopen(globbuf.gl_pathv[i], RTLD_NOW|RTLD_LOCAL);
+               snprintf(pathbuf, sizeof(pathbuf), "%s/%s", multipath_dir, fn);
+               fgn->handle = dlopen(pathbuf, RTLD_NOW|RTLD_LOCAL);
                msg = dlerror();
                if (fgn->handle == NULL) {
-                       condlog(1, "%s: failed to open %s: %s", __func__,
-                               fn, msg);
-                       free_foreign(&fgn);
-                       continue;
+                       condlog(1, "%s: failed to dlopen %s: %s", __func__,
+                               pathbuf, msg);
+                       goto dl_err;
                }
 
                get_dlsym(fgn, init, dl_err);
@@ -170,27 +188,42 @@
                fgn->context = fgn->init(LIBMP_FOREIGN_API, fgn->name);
                if (fgn->context == NULL) {
                        condlog(0, "%s: init() failed for %s", __func__, fn);
-                       free_foreign(&fgn);
-                       continue;
+                       goto dl_err;
                }
 
                if (vector_alloc_slot(foreigns) == NULL) {
-                       free_foreign(&fgn);
-                       continue;
+                       goto dl_err;
                }
+
                vector_set_slot(foreigns, fgn);
-               condlog(3, "foreign library \"%s\" loaded successfully", 
fgn->name);
+               condlog(3, "foreign library \"%s\" loaded successfully",
+                       fgn->name);
 
                continue;
 
        dl_err:
-               free_foreign(&fgn);
+               free_foreign(fgn);
        }
-       globfree(&globbuf);
-
+       pthread_cleanup_pop(1);
        return 0;
-err:
-       cleanup_foreign();
+}
+
+int init_foreign(const char *multipath_dir)
+{
+       int ret;
+
+       wrlock_foreigns();
+
+       if (foreigns != NULL) {
+               unlock_foreigns(NULL);
+               condlog(0, "%s: already initialized", __func__);
+               return -EEXIST;
+       }
+
+       pthread_cleanup_push(unlock_foreigns, NULL);
+       ret = _init_foreign(multipath_dir);
+       pthread_cleanup_pop(1);
+
        return ret;
 }
 
@@ -199,29 +232,40 @@
        struct foreign *fgn;
        dev_t dt;
        int j;
+       int r = FOREIGN_IGNORED;
 
        if (udev == NULL) {
                condlog(1, "%s called with NULL udev", __func__);
                return FOREIGN_ERR;
        }
+
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return FOREIGN_ERR;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        dt = udev_device_get_devnum(udev);
        vector_foreach_slot(foreigns, fgn, j) {
-               int r = fgn->add(fgn->context, udev);
+               r = fgn->add(fgn->context, udev);
 
                if (r == FOREIGN_CLAIMED) {
                        condlog(3, "%s: foreign \"%s\" claims device %d:%d",
                                __func__, fgn->name, major(dt), minor(dt));
-                       return r;
+                       break;
                } else if (r == FOREIGN_OK) {
                        condlog(4, "%s: foreign \"%s\" owns device %d:%d",
                                __func__, fgn->name, major(dt), minor(dt));
-                       return r;
+                       break;
                } else if (r != FOREIGN_IGNORED) {
                        condlog(1, "%s: unexpected return value %d from \"%s\"",
                                __func__, r, fgn->name);
                }
        }
-       return FOREIGN_IGNORED;
+
+       pthread_cleanup_pop(1);
+       return r;
 }
 
 int change_foreign(struct udev_device *udev)
@@ -229,25 +273,36 @@
        struct foreign *fgn;
        int j;
        dev_t dt;
+       int r = FOREIGN_IGNORED;
 
        if (udev == NULL) {
                condlog(1, "%s called with NULL udev", __func__);
                return FOREIGN_ERR;
        }
+
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return FOREIGN_ERR;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        dt = udev_device_get_devnum(udev);
        vector_foreach_slot(foreigns, fgn, j) {
-               int r = fgn->change(fgn->context, udev);
+               r = fgn->change(fgn->context, udev);
 
                if (r == FOREIGN_OK) {
                        condlog(4, "%s: foreign \"%s\" completed %d:%d",
                                __func__, fgn->name, major(dt), minor(dt));
-                       return r;
+                       break;
                } else if (r != FOREIGN_IGNORED) {
                        condlog(1, "%s: unexpected return value %d from \"%s\"",
                                __func__, r, fgn->name);
                }
        }
-       return FOREIGN_IGNORED;
+
+       pthread_cleanup_pop(1);
+       return r;
 }
 
 int delete_foreign(struct udev_device *udev)
@@ -255,25 +310,36 @@
        struct foreign *fgn;
        int j;
        dev_t dt;
+       int r = FOREIGN_IGNORED;
 
        if (udev == NULL) {
                condlog(1, "%s called with NULL udev", __func__);
                return FOREIGN_ERR;
        }
+
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return FOREIGN_ERR;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        dt = udev_device_get_devnum(udev);
        vector_foreach_slot(foreigns, fgn, j) {
-               int r = fgn->delete(fgn->context, udev);
+               r = fgn->delete(fgn->context, udev);
 
                if (r == FOREIGN_OK) {
                        condlog(3, "%s: foreign \"%s\" deleted device %d:%d",
                                __func__, fgn->name, major(dt), minor(dt));
-                       return r;
+                       break;
                } else if (r != FOREIGN_IGNORED) {
                        condlog(1, "%s: unexpected return value %d from \"%s\"",
                                __func__, r, fgn->name);
                }
        }
-       return FOREIGN_IGNORED;
+
+       pthread_cleanup_pop(1);
+       return r;
 }
 
 int delete_all_foreign(void)
@@ -281,6 +347,13 @@
        struct foreign *fgn;
        int j;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return FOREIGN_ERR;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, j) {
                int r;
 
@@ -290,6 +363,8 @@
                                __func__, r, fgn->name);
                }
        }
+
+       pthread_cleanup_pop(1);
        return FOREIGN_OK;
 }
 
@@ -298,9 +373,18 @@
        struct foreign *fgn;
        int j;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, j) {
                fgn->check(fgn->context);
        }
+
+       pthread_cleanup_pop(1);
 }
 
 /* Call this after get_path_layout */
@@ -309,17 +393,29 @@
        struct foreign *fgn;
        int i;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, i) {
                const struct _vector *vec;
 
                fgn->lock(fgn->context);
+               pthread_cleanup_push(fgn->unlock, fgn->context);
+
                vec = fgn->get_paths(fgn->context);
                if (vec != NULL) {
                        _get_path_layout(vec, LAYOUT_RESET_NOT);
                }
                fgn->release_paths(fgn->context, vec);
-               fgn->unlock(fgn->context);
+
+               pthread_cleanup_pop(1);
        }
+
+       pthread_cleanup_pop(1);
 }
 
 /* Call this after get_multipath_layout */
@@ -328,18 +424,29 @@
        struct foreign *fgn;
        int i;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, i) {
                const struct _vector *vec;
 
                fgn->lock(fgn->context);
                pthread_cleanup_push(fgn->unlock, fgn->context);
+
                vec = fgn->get_multipaths(fgn->context);
                if (vec != NULL) {
                        _get_multipath_layout(vec, LAYOUT_RESET_NOT);
                }
                fgn->release_multipaths(fgn->context, vec);
+
                pthread_cleanup_pop(1);
        }
+
+       pthread_cleanup_pop(1);
 }
 
 int snprint_foreign_topology(char *buf, int len, int verbosity)
@@ -348,6 +455,13 @@
        int i;
        char *c = buf;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return 0;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, i) {
                const struct _vector *vec;
                const struct gen_multipath *gm;
@@ -373,6 +487,7 @@
                pthread_cleanup_pop(1);
        }
 
+       pthread_cleanup_pop(1);
        return c - buf;
 }
 
@@ -411,6 +526,13 @@
        int i;
        char *c = buf;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return 0;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, i) {
                const struct _vector *vec;
                const struct gen_path *gp;
@@ -434,6 +556,7 @@
                pthread_cleanup_pop(1);
        }
 
+       pthread_cleanup_pop(1);
        return c - buf;
 }
 
@@ -444,6 +567,13 @@
        int i;
        char *c = buf;
 
+       rdlock_foreigns();
+       if (foreigns == NULL) {
+               unlock_foreigns(NULL);
+               return 0;
+       }
+       pthread_cleanup_push(unlock_foreigns, NULL);
+
        vector_foreach_slot(foreigns, fgn, i) {
                const struct _vector *vec;
                const struct gen_multipath *gm;
@@ -467,5 +597,6 @@
                pthread_cleanup_pop(1);
        }
 
+       pthread_cleanup_pop(1);
        return c - buf;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign.h 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign.h
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/foreign.h       
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/foreign.h       
2018-03-21 09:29:04.000000000 +0100
@@ -188,9 +188,9 @@
        void (*release_paths)(const struct context *ctx,
                              const struct _vector* ppvec);
 
-       const char *name;
        void *handle;
        struct context *context;
+       const char name[0];
 };
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/generic.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/generic.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/generic.c       
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/generic.c       
2018-03-21 09:29:04.000000000 +0100
@@ -32,10 +32,8 @@
        gm->ops->snprint(gm, alias_buf, sizeof(alias_buf), 'n');
        gm->ops->snprint(gm, wwid_buf, sizeof(wwid_buf), 'w');
 
-       if (strcmp(alias_buf, wwid_buf))
-               n += snprintf(buf, len, "%%n (%%w) [%%G]");
-       else
-               n += snprintf(buf, len, "%%n [%%G]");
+       n += snprintf(buf, len, "%%n %s[%%G]:%%d %%s",
+                     strcmp(alias_buf, wwid_buf) ? "(%w) " : "");
 
        return (n < len ? n : len - 1);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/print.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/print.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/print.c 
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/print.c 
2018-03-21 09:29:04.000000000 +0100
@@ -28,8 +28,6 @@
 #include "devmapper.h"
 #include "uevent.h"
 #include "debug.h"
-#include "discovery.h"
-#include "dm-generic.h"
 
 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
 #define MIN(x,y) (((x) > (y)) ? (y) : (x))
@@ -1118,7 +1116,6 @@
 
        c += gmp->ops->style(gmp, c, sizeof(style) - (c - style),
                             verbosity);
-       c += snprintf(c, sizeof(style) - (c - style), " %%d %%s");
        if(isatty(1))
                c += sprintf(c, "%c[%dm", 0x1B, 0); /* bold off */
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/print.h 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/print.h
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/print.h 
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/print.h 
2018-03-21 09:29:04.000000000 +0100
@@ -1,5 +1,6 @@
 #ifndef _PRINT_H
 #define _PRINT_H
+#include "dm-generic.h"
 
 #define PRINT_PATH_LONG      "%w %i %d %D %p %t %T %s %o"
 #define PRINT_PATH_INDENT    "%i %d %D %t %T %o"
@@ -144,7 +145,6 @@
 void print_all_paths (vector pathvec, int banner);
 void print_all_paths_custo (vector pathvec, int banner, char *fmt);
 void print_hwtable (vector hwtable);
-
 int snprint_path_attr(const struct gen_path* gp,
                      char *buf, int len, char wildcard);
 int snprint_pathgroup_attr(const struct gen_pathgroup* gpg,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/vector.h 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/vector.h
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/libmultipath/vector.h        
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/libmultipath/vector.h        
2018-03-21 09:29:04.000000000 +0100
@@ -29,7 +29,6 @@
        void **slot;
 };
 typedef struct _vector *vector;
-typedef const struct _vector *cvector;
 
 #define VECTOR_DEFAULT_SIZE 1
 #define VECTOR_SIZE(V)   ((V) ? ((V)->allocated) / VECTOR_DEFAULT_SIZE : 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/main.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/main.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/main.c    
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/main.c    
2018-03-21 09:29:04.000000000 +0100
@@ -767,15 +767,6 @@
                mpp->flush_on_last_del = FLUSH_UNDEF;
                mpp->action = ACT_RELOAD;
        } else {
-               switch (add_foreign(pp->udev)) {
-               case FOREIGN_CLAIMED:
-               case FOREIGN_OK:
-                       orphan_path(pp, "claimed by foreign library");
-                       return 0;
-               default:
-                       break;
-               }
-
                if (!should_multipath(pp, vecs->pathvec)) {
                        orphan_path(pp, "only one path");
                        return 0;
@@ -1189,7 +1180,7 @@
                                r = 0;
                        else
                                r = uev_remove_map(uev, vecs);
-                       goto out;
+                        goto out;
                }
                goto out;
        }
@@ -2283,12 +2274,15 @@
 }
 
 void
-handle_signals(void)
+handle_signals(bool nonfatal)
 {
        if (exit_sig) {
                condlog(2, "exit (signal)");
+               exit_sig = 0;
                exit_daemon();
        }
+       if (!nonfatal)
+               return;
        if (reconfig_sig) {
                condlog(2, "reconfigure (signal)");
                set_config_state(DAEMON_CONFIGURE);
@@ -2299,7 +2293,6 @@
                log_reset("multipathd");
                pthread_mutex_unlock(&logq_lock);
        }
-       exit_sig = 0;
        reconfig_sig = 0;
        log_reset_sig = 0;
 }
@@ -2333,10 +2326,13 @@
 {
        sigset_t set;
 
-       sigemptyset(&set);
-       sigaddset(&set, SIGUSR2);
+       /* block all signals */
+       sigfillset(&set);
+       /* SIGPIPE occurs if logging fails */
+       sigdelset(&set, SIGPIPE);
        pthread_sigmask(SIG_SETMASK, &set, NULL);
 
+       /* Other signals will be unblocked in the uxlsnr thread */
        signal_set(SIGHUP, sighup);
        signal_set(SIGUSR1, sigusr1);
        signal_set(SIGUSR2, sigusr2);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/main.h 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/main.h
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/main.h    
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/main.h    
2018-03-21 09:29:04.000000000 +0100
@@ -39,6 +39,6 @@
 void * mpath_pr_event_handler_fn (void * );
 int update_map_pr(struct multipath *mpp);
 void * mpath_pr_event_handler_fn (void * pathp );
-void handle_signals(void);
+void handle_signals(bool);
 
 #endif /* MAIN_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/uxlsnr.c 
new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/uxlsnr.c
--- old/multipath-tools-0.7.3+53+suse.140f4937e9e7/multipathd/uxlsnr.c  
2018-02-26 13:47:43.000000000 +0100
+++ new/multipath-tools-0.7.3+59+suse.1b6191c26774/multipathd/uxlsnr.c  
2018-03-21 09:29:04.000000000 +0100
@@ -159,7 +159,7 @@
 
        if (ux_sock == -1) {
                condlog(1, "could not create uxsock: %d", errno);
-               return NULL;
+               exit_daemon();
        }
 
        pthread_cleanup_push(uxsock_cleanup, NULL);
@@ -168,13 +168,13 @@
        polls = (struct pollfd *)MALLOC((MIN_POLLS + 1) * sizeof(struct 
pollfd));
        if (!polls) {
                condlog(0, "uxsock: failed to allocate poll fds");
-               return NULL;
+               exit_daemon();
        }
-       sigemptyset(&mask);
-       sigaddset(&mask, SIGINT);
-       sigaddset(&mask, SIGTERM);
-       sigaddset(&mask, SIGHUP);
-       sigaddset(&mask, SIGUSR1);
+       sigfillset(&mask);
+       sigdelset(&mask, SIGINT);
+       sigdelset(&mask, SIGTERM);
+       sigdelset(&mask, SIGHUP);
+       sigdelset(&mask, SIGUSR1);
        while (1) {
                struct client *c, *tmp;
                int i, poll_count, num_clients;
@@ -221,19 +221,21 @@
                /* most of our life is spent in this call */
                poll_count = ppoll(polls, i, &sleep_time, &mask);
 
+               handle_signals(false);
                if (poll_count == -1) {
                        if (errno == EINTR) {
-                               handle_signals();
+                               handle_signals(true);
                                continue;
                        }
 
                        /* something went badly wrong! */
                        condlog(0, "uxsock: poll failed with %d", errno);
+                       exit_daemon();
                        break;
                }
 
                if (poll_count == 0) {
-                       handle_signals();
+                       handle_signals(true);
                        continue;
                }
 
@@ -292,6 +294,8 @@
                                FREE(inbuf);
                        }
                }
+               /* see if we got a non-fatal signal */
+               handle_signals(true);
 
                /* see if we got a new client */
                if (polls[0].revents & POLLIN) {


Reply via email to