From: Konrad Rzeszutek Date: Tue, 24 Mar 2009 18:14:37 +0000 (+0100) Subject: Don't display the state of the newly added map during addition in the daemon X-Git-Tag: 0.4.9~141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f46ffaf4e0a079180d4e11b4b2fb8425bda4d065;p=platform%2Fupstream%2Fmultipath-tools.git Don't display the state of the newly added map during addition in the daemon 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. --- diff --git a/libmultipath/config.h b/libmultipath/config.h index fb917f4..07aa8c0 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -64,6 +64,7 @@ struct config { int pg_timeout; int max_fds; int force_reload; + int daemon; char * dev; char * sysfs_dir; diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 83ee0ae..e00582f 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -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; } diff --git a/multipath/main.c b/multipath/main.c index 1fee475..dacae1f 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -421,6 +421,7 @@ main (int argc, char *argv[]) conf->dev_type = DEV_DEVMAP; } + conf->daemon = 0; dm_init(); if (conf->remove == FLUSH_ONE) { diff --git a/multipathd/main.c b/multipathd/main.c index 996bd9d..b7532f1 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -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 */ diff --git a/multipathd/main.h b/multipathd/main.h index 1a6dc55..b3a90f8 100644 --- a/multipathd/main.h +++ b/multipathd/main.h @@ -1,7 +1,6 @@ #ifndef MAIN_H #define MAIN_H -#define DAEMON 1 #define MAPGCINT 5 int reconfigure (struct vectors *);