From patchwork Wed Sep 1 18:29:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bmarzins@sourceware.org X-Patchwork-Id: 147911 Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o81N4HAk026713 for ; Wed, 1 Sep 2010 23:04:52 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81ITWiB009777; Wed, 1 Sep 2010 14:29:35 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81ITV27011231 for ; Wed, 1 Sep 2010 14:29:31 -0400 Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.14]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81ITPWV031862 for ; Wed, 1 Sep 2010 14:29:25 -0400 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id o81ITJpL001049 for ; Wed, 1 Sep 2010 14:29:19 -0400 Received: (qmail 24884 invoked by uid 9475); 1 Sep 2010 18:29:19 -0000 Date: 1 Sep 2010 18:29:19 -0000 Message-ID: <20100901182919.24882.qmail@sourceware.org> From: bmarzins@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.14 X-loop: dm-devel@redhat.com Subject: [dm-devel] multipath-tools/multipathd main.c X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Sep 2010 23:05:00 +0000 (UTC) --- multipath-tools/multipathd/main.c 2010/08/09 16:16:10 1.69.2.28 +++ multipath-tools/multipathd/main.c 2010/09/01 18:29:18 1.69.2.29 @@ -52,6 +52,7 @@ #include #include #include +#include #include "main.h" #include "pidfile.h" @@ -933,6 +934,29 @@ return 0; } +int update_path_groups(struct multipath *mpp, struct vectors *vecs) +{ + int i; + struct path * pp; + + update_mpp_paths(mpp, vecs->pathvec); + vector_foreach_slot (mpp->paths, pp, i) + pathinfo(pp, conf->hwtable, DI_PRIO); + setup_map(mpp); + mpp->action = ACT_RELOAD; + if (domap(mpp) <= 0) { + condlog(0, "%s: failed to update map : %s", mpp->alias, + strerror(errno)); + return 1; + } + dm_lib_release(); + setup_multipath(vecs, mpp); + sync_map_state(mpp); + + return 0; +} + + static void * checkerloop (void *ap) { @@ -942,6 +966,7 @@ int newstate; unsigned int i; sigset_t old; + int oldpriority; mlockall(MCL_CURRENT | MCL_FUTURE); vecs = (struct vectors *)ap; @@ -1095,9 +1120,13 @@ * path prio refreshing */ condlog(4, "path prio refresh"); + oldpriority = pp->priority; pathinfo(pp, conf->hwtable, DI_PRIO); - if (need_switch_pathgroup(pp->mpp, 0)) { + if (pp->priority != oldpriority && + pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio) + update_path_groups(pp->mpp, vecs); + else if (need_switch_pathgroup(pp->mpp, 0)) { if (pp->mpp->pgfailback > 0 && pp->mpp->failback_tick <= 0) pp->mpp->failback_tick =