From patchwork Mon Mar 16 12:36:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6017741 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 995549F691 for ; Mon, 16 Mar 2015 12:41:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3E9D20501 for ; Mon, 16 Mar 2015 12:41:06 +0000 (UTC) Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89B33204E2 for ; Mon, 16 Mar 2015 12:41:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCcOnO005363; Mon, 16 Mar 2015 08:38:24 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t2GCbIdP028884 for ; Mon, 16 Mar 2015 08:37:18 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCbITr021929; Mon, 16 Mar 2015 08:37:18 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCbFL2019963 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL); Mon, 16 Mar 2015 08:37:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0777EADE8; Mon, 16 Mar 2015 12:37:10 +0000 (UTC) From: Hannes Reinecke To: Christophe Varoqui Date: Mon, 16 Mar 2015 13:36:35 +0100 Message-Id: <1426509425-15978-49-git-send-email-hare@suse.de> In-Reply-To: <1426509425-15978-1-git-send-email-hare@suse.de> References: <1426509425-15978-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -6.909 (BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, URIBL_BLOCKED) 195.135.220.15 cantor2.suse.de 195.135.220.15 cantor2.suse.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 48/78] multipathd: reload map if reinstate failed 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel might fail the 'reinstate' device-mapper message if the path is disabled. In these cases we need to reload the map to give device-mapper a chance to add the correct devices to the table. Signed-off-by: Hannes Reinecke --- multipathd/main.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index e197d59..2eade36 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -965,19 +965,23 @@ fail_path (struct path * pp, int del_active) /* * caller must have locked the path list before calling that function */ -static void +static int reinstate_path (struct path * pp, int add_active) { + int ret = 0; + if (!pp->mpp) - return; + return 0; - if (dm_reinstate_path(pp->mpp->alias, pp->dev_t)) + if (dm_reinstate_path(pp->mpp->alias, pp->dev_t)) { condlog(0, "%s: reinstate failed", pp->dev_t); - else { + ret = 1; + } else { condlog(2, "%s: reinstated", pp->dev_t); if (add_active) update_queue_mode_add_path(pp->mpp); } + return ret; } static void @@ -1132,6 +1136,7 @@ check_path (struct vectors * vecs, struct path * pp) int newstate; int new_path_up = 0; int chkr_new_path_up = 0; + int add_active; int oldchkrstate = pp->chkrstate; if (pp->initialized && !pp->mpp) @@ -1259,11 +1264,17 @@ check_path (struct vectors * vecs, struct path * pp) oldstate != PATH_GHOST) { if (pp->mpp->delay_watch_checks > 0) pp->watch_checks = pp->mpp->delay_watch_checks; - reinstate_path(pp, 1); + add_active = 1; } else { if (pp->watch_checks > 0) pp->watch_checks--; - reinstate_path(pp, 0); + add_active = 0; + } + if (reinstate_path(pp, add_active)) { + condlog(3, "%s: reload map", pp->dev); + ev_add_path(pp, vecs); + pp->tick = 1; + return 0; } new_path_up = 1; @@ -1281,7 +1292,12 @@ check_path (struct vectors * vecs, struct path * pp) if (pp->dmstate == PSTATE_FAILED || pp->dmstate == PSTATE_UNDEF) { /* Clear IO errors */ - reinstate_path(pp, 0); + if (reinstate_path(pp, 0)) { + condlog(3, "%s: reload map", pp->dev); + ev_add_path(pp, vecs); + pp->tick = 1; + return 0; + } } else { LOG_MSG(4, checker_message(&pp->checker)); if (pp->checkint != conf->max_checkint) {