multipathd: drop lock before calling uev_add_path
authorBenjamin Marzinski <bmarzins@redhat.com>
Fri, 7 Apr 2017 06:16:35 +0000 (01:16 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 12 Apr 2017 07:22:34 +0000 (09:22 +0200)
commit c6a18f4541d0a161e2f5fed8c67d9732bf512b37 made uev_update_path
call uev_add_path while holding the vecs lock, which is deadlocks, since
uev_add_path grabs the vecs lock itself.

Cc: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/main.c

index f671d58..f4ff13e 100644 (file)
@@ -974,6 +974,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
        struct path * pp;
        struct config *conf;
        int disable_changed_wwids;
+       int needs_reinit = 0;
 
        conf = get_multipath_config();
        disable_changed_wwids = conf->disable_changed_wwids;
@@ -1009,7 +1010,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
                }
 
                if (pp->initialized == INIT_REQUESTED_UDEV)
-                       retval = uev_add_path(uev, vecs, 1);
+                       needs_reinit = 1;
                else if (mpp && ro >= 0) {
                        condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro);
 
@@ -1041,7 +1042,8 @@ out:
 
                condlog(0, "%s: spurious uevent, path not found", uev->kernel);
        }
-
+       if (needs_reinit)
+               retval = uev_add_path(uev, vecs, 1);
        return retval;
 }