Fix hang on reconfigure CLI command
authorChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 25 May 2011 21:21:42 +0000 (23:21 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 25 May 2011 21:21:42 +0000 (23:21 +0200)
Restore the vector locking outside the reconfigure() function.
Moving it inside caused a double-lock hang situation. The
first locker being uxsock_trigger(), caller of reconfigure().

Discussion on-going on wether we'd better stop locking from
uxsock_trigger().

multipathd/main.c

index cc75921..e0606b6 100644 (file)
@@ -1332,7 +1332,6 @@ reconfigure (struct vectors * vecs)
        struct config * old = conf;
        int retval = 1;
 
        struct config * old = conf;
        int retval = 1;
 
-       lock(vecs->lock);
        /*
         * free old map and path vectors ... they use old conf state
         */
        /*
         * free old map and path vectors ... they use old conf state
         */
@@ -1353,7 +1352,6 @@ reconfigure (struct vectors * vecs)
                retval = 0;
        }
 
                retval = 0;
        }
 
-       unlock(vecs->lock);
        return retval;
 }
 
        return retval;
 }
 
@@ -1411,7 +1409,9 @@ sighup (int sig)
        if (running_state != DAEMON_RUNNING)
                return;
 
        if (running_state != DAEMON_RUNNING)
                return;
 
+       lock(gvecs->lock);
        reconfigure(gvecs);
        reconfigure(gvecs);
+       unlock(gvecs->lock);
 
 #ifdef _DEBUG_
        dbg_free_final(NULL);
 
 #ifdef _DEBUG_
        dbg_free_final(NULL);