From patchwork Mon Dec 3 19:36:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10710439 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0964C15A6 for ; Mon, 3 Dec 2018 19:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03F22AF24 for ; Mon, 3 Dec 2018 19:37:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4DC42B33A; Mon, 3 Dec 2018 19:37:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87B192AF24 for ; Mon, 3 Dec 2018 19:37:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D867C025D28; Mon, 3 Dec 2018 19:37:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48453103BAB7; Mon, 3 Dec 2018 19:37:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0292D3F604; Mon, 3 Dec 2018 19:37:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB3JbB34010965 for ; Mon, 3 Dec 2018 14:37:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4E726013F; Mon, 3 Dec 2018 19:37:11 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D4F0600C7; Mon, 3 Dec 2018 19:37:05 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5DD6F30BCBE9; Mon, 3 Dec 2018 19:37:04 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Mon, 03 Dec 2018 12:36:58 -0700 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Date: Mon, 3 Dec 2018 20:36:23 +0100 Message-Id: <20181203193624.21870-6-mwilck@suse.com> In-Reply-To: <20181203193624.21870-1-mwilck@suse.com> References: <20181203193624.21870-1-mwilck@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 03 Dec 2018 19:37:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 03 Dec 2018 19:37:04 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH v2 23/24] domap(): never return DOMAP_RETRY in daemon mode X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 03 Dec 2018 19:37:32 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP DOMAP_RETRY is only used by the multipath tool. multipathd always treats it exactly like DOMAP_FAIL. Simplify logic by only returning DOMAP_RETRY in non-daemon mode from domap(). Signed-off-by: Martin Wilck --- libmultipath/configure.c | 28 +++++++++++++--------------- multipathd/main.c | 9 +-------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 84ae5f56..1c549817 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -831,7 +831,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon) if (lock_multipath(mpp, 1)) { condlog(3, "%s: failed to create map (in use)", mpp->alias); - return DOMAP_RETRY; + return is_daemon ? DOMAP_FAIL : DOMAP_RETRY; } sysfs_set_max_sectors_kb(mpp, 0); @@ -1110,20 +1110,18 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, r = domap(mpp, params, is_daemon); - if (r == DOMAP_FAIL || r == DOMAP_RETRY) { - condlog(3, "%s: domap (%u) failure " - "for create/reload map", - mpp->alias, r); - if (r == DOMAP_FAIL || is_daemon) { - condlog(2, "%s: %s map", - mpp->alias, (mpp->action == ACT_CREATE)? - "ignoring" : "removing"); - remove_map(mpp, vecs, 0); - continue; - } else /* if (r == DOMAP_RETRY && !is_daemon) */ { - ret = CP_RETRY; - goto out; - } + if (r == DOMAP_RETRY) { + /* This happens in non-daemon case only */ + ret = CP_RETRY; + goto out; + } + + if (r == DOMAP_FAIL) { + condlog(2, "%s: domap failure, %s map", + mpp->alias, (mpp->action == ACT_CREATE) ? + "ignoring" : "removing"); + remove_map(mpp, vecs, 0); + continue; } if (r == DOMAP_DRY) continue; diff --git a/multipathd/main.c b/multipathd/main.c index d0e7107c..1bf3c481 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -998,15 +998,8 @@ rescan: /* * reload the map for the multipath mapped device */ -retry: ret = domap(mpp, params, 1); - if (ret == DOMAP_FAIL || ret == DOMAP_RETRY) { - if (ret < 0 && retries-- > 0) { - condlog(0, "%s: retry domap for addition of new " - "path %s", mpp->alias, pp->dev); - sleep(1); - goto retry; - } + if (ret == DOMAP_FAIL) { condlog(0, "%s: failed in domap for addition of new " "path %s", mpp->alias, pp->dev); /*