From cd520f7a35e0c946d758b6c54c78f6081484d5c0 Mon Sep 17 00:00:00 2001 From: Christophe Varoqui Date: Fri, 30 Sep 2005 15:19:02 +0200 Subject: [PATCH] [multipath] *bad bad nasty* map reload code path * the uuid needs not be set for DM_DEVICE_RELOAD * remove map upon map load/reload failure is *wrong* *wrong* * "int op" superfluous --- multipath/main.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/multipath/main.c b/multipath/main.c index cafacae..a20aad6 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -580,7 +580,6 @@ reinstate_paths (struct multipath * mpp) static int domap (struct multipath * mpp) { - int op = ACT_NOTHING; int r = 0; print_mp(mpp); @@ -606,39 +605,26 @@ domap (struct multipath * mpp) return 0; case ACT_CREATE: - op = DM_DEVICE_CREATE; + r = dm_addmap(DM_DEVICE_CREATE, mpp->alias, DEFAULT_TARGET, + mpp->params, mpp->size, mpp->wwid); break; case ACT_RELOAD: - op = DM_DEVICE_RELOAD; + r = dm_addmap(DM_DEVICE_RELOAD, mpp->alias, DEFAULT_TARGET, + mpp->params, mpp->size, NULL); break; default: break; } - - /* - * device mapper creation or updating - * here we know we'll have garbage on stderr from - * libdevmapper. so shut it down temporarily. - */ - dm_log_init_verbose(0); - - r = dm_addmap(op, mpp->alias, DEFAULT_TARGET, mpp->params, mpp->size, mpp->wwid); - - if (r == 0) - dm_simplecmd(DM_DEVICE_REMOVE, mpp->alias); - else if (op == DM_DEVICE_RELOAD) + if (r) { + /* + * DM_DEVICE_CREATE or DM_DEVICE_RELOAD succeeded + */ dm_simplecmd(DM_DEVICE_RESUME, mpp->alias); - - /* - * PG order is random, so we need to set the primary one - * upon create or reload - */ - dm_switchgroup(mpp->alias, mpp->nextpg); - - dm_log_init_verbose(1); + dm_switchgroup(mpp->alias, mpp->nextpg); + } return r; } -- 2.7.4