Don't display the state of the newly added map during addition in the daemon
authorKonrad Rzeszutek <konrad@virtualiron.com>
Tue, 24 Mar 2009 18:14:37 +0000 (19:14 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Tue, 24 Mar 2009 18:14:37 +0000 (19:14 +0100)
and don't switch groups.

A previous commit mass-changed #ifdef DAEMON to check for 'mpp->waiter'.
Unfortunatly when the 'domap' function is called with ACT_CREATE in the daemon,
the mpp->waiter is not set, hence the multipath client mode logic is choosen.
Fixing this triggers another issues which is that newly added path via
ACT_CREATE won't have their waitevent thread created as the caller checks
mpp->action (which changed to ACT_NOTHING) and won't start the thread.

libmultipath/config.h
libmultipath/configure.c
multipath/main.c
multipathd/main.c
multipathd/main.h

index fb917f4..07aa8c0 100644 (file)
@@ -64,6 +64,7 @@ struct config {
        int pg_timeout;
        int max_fds;
        int force_reload;
+       int daemon;
 
        char * dev;
        char * sysfs_dir;
index 83ee0ae..e00582f 100644 (file)
@@ -369,7 +369,7 @@ domap (struct multipath * mpp)
                 * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
                 * succeeded
                 */
-               if (!mpp->waiter) {
+               if (!conf->daemon) {
                        /* multipath client mode */
                        dm_switchgroup(mpp->alias, mpp->bestpg);
                        if (mpp->action != ACT_NOTHING)
@@ -380,9 +380,12 @@ domap (struct multipath * mpp)
                        condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
                                mpp->size, TGT_MPATH, mpp->params);
                        /*
-                        * Required action is over, reset for the stateful daemon
+                        * Required action is over, reset for the stateful daemon.
+                        * But don't do it for creation as we use in the caller the
+                        * mpp->action to figure out whether to start the watievent checker.
                         */
-                       mpp->action = ACT_NOTHING;
+                       if (mpp->action != ACT_CREATE)
+                               mpp->action = ACT_NOTHING;
                }
                return DOMAP_OK;
        }
index 1fee475..dacae1f 100644 (file)
@@ -421,6 +421,7 @@ main (int argc, char *argv[])
                        conf->dev_type = DEV_DEVMAP;
 
        }
+       conf->daemon = 0;
        dm_init();
 
        if (conf->remove == FLUSH_ONE) {
index 996bd9d..b7532f1 100644 (file)
@@ -1334,7 +1334,7 @@ child (void * param)
                condlog(0, "can not find sysfs mount point");
                exit(1);
        }
-
+       conf->daemon = 1;
        /*
         * fetch and configure both paths and multipaths
         */
index 1a6dc55..b3a90f8 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef MAIN_H
 #define MAIN_H
 
-#define DAEMON 1
 #define MAPGCINT 5
 
 int reconfigure (struct vectors *);