From patchwork Thu Sep 2 21:57:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473163 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A394CC433F5 for ; Thu, 2 Sep 2021 22:02:57 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36BF360F12 for ; Thu, 2 Sep 2021 22:02:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 36BF360F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620176; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xK9F6ZQIDfByQ/D4qN1aeVobYT3GQl1Xzk/mpRJiEm8=; b=aGjnEvvOwm/6XNq7nSGut4+CAQxiQUQh5m+HqnJo+A9lGMWgepAKIU9NXKeeOAbkULsXH2 7un4pnjY7+c3a90cvgFn3IJjpgDeFssdb9E4ZDgV3//JfTg50T+Ehh/dWvi8aWYu7rFBJ/ 6IWs4NlbfEN0Klc1XRb3SkXTIlcOzS8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-562-1bMYa3vZPbShyvtEwyGEug-1; Thu, 02 Sep 2021 18:02:53 -0400 X-MC-Unique: 1bMYa3vZPbShyvtEwyGEug-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A199107ACCD; Thu, 2 Sep 2021 22:02:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 883F35D9FC; Thu, 2 Sep 2021 22:02:46 +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 62F1E18087F1; Thu, 2 Sep 2021 22:02:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182LvwP7013338 for ; Thu, 2 Sep 2021 17:57:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3160860C4A; Thu, 2 Sep 2021 21:57:58 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4911260BF1; Thu, 2 Sep 2021 21:57:54 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182LvqUW012295; Thu, 2 Sep 2021 16:57:52 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182LvqCV012294; Thu, 2 Sep 2021 16:57:52 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:44 -0500 Message-Id: <1630619869-12251-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 1/6] multipath.conf: fix typo in ghost_delay description 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- multipath/multipath.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 064e4826..d6b8c7f6 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -1251,7 +1251,7 @@ The default is: in \fB/sys/block//queue/max_sectors_kb\fR Sets the number of seconds that multipath will wait after creating a device with only ghost paths before marking it ready for use in systemd. This gives the active paths time to appear before the multipath runs the hardware handler -to switch the ghost paths to active ones. Setting this to \fI0\fR or \fIon\fR +to switch the ghost paths to active ones. Setting this to \fI0\fR or \fIno\fR makes multipath immediately mark a device with only ghost paths as ready. .RS .TP From patchwork Thu Sep 2 21:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473165 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52A70C433F5 for ; Thu, 2 Sep 2021 22:03:14 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4CBC60724 for ; Thu, 2 Sep 2021 22:03:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E4CBC60724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620193; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=p19JDSE8AhzyMeoT5bWAvHyxNJaBlHns2VAvIip1GZo=; b=GPZ4Nnd6q2M6hb/BmcmvebAKeK15ZBvEY5ukl7KtF/rbvK3kIXWuWLHhL3zuOdoqi+tqq/ gJX+xZHBMApWLcj+tiIg7EQuGEvtrs0sAt4Gwchz828SxeMVR5WFqpAv9x9oWadgmeZymy sjP63j/Pba44UODy0hL9aXD78QiKMY0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-n3flX8aqMceKcdT7j49gjA-1; Thu, 02 Sep 2021 18:03:11 -0400 X-MC-Unique: n3flX8aqMceKcdT7j49gjA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 418B418766DB; Thu, 2 Sep 2021 22:03:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 13ECD5D9FC; Thu, 2 Sep 2021 22:03:06 +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 B174A1806D0F; Thu, 2 Sep 2021 22:03:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182Lvwrc013347 for ; Thu, 2 Sep 2021 17:57:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C09F6A91F; Thu, 2 Sep 2021 21:57:58 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 843CC6A8F8; Thu, 2 Sep 2021 21:57:55 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182LvrJZ012299; Thu, 2 Sep 2021 16:57:54 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182LvrTp012298; Thu, 2 Sep 2021 16:57:53 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:45 -0500 Message-Id: <1630619869-12251-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 2/6] mpathpersist: fail commands when no usable paths exist 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com "mpathpersist -oCK " will return success if it is run on devices with no usable paths, but nothing is actually done. The -L command will fail, but it should give up sooner, and with a more helpful error message. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmpathpersist/mpath_persist.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 190e9707..26710e79 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -604,7 +604,8 @@ int mpath_prout_common(struct multipath *mpp,int rq_servact, int rq_scope, return ret ; } } - return MPATH_PR_SUCCESS; + condlog (0, "%s: no path available", mpp->wwid); + return MPATH_PR_DMMP_ERROR; } int send_prout_activepath(char * dev, int rq_servact, int rq_scope, @@ -663,6 +664,11 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, active_pathcount = count_active_paths(mpp); + if (active_pathcount == 0) { + condlog (0, "%s: no path available", mpp->wwid); + return MPATH_PR_DMMP_ERROR; + } + struct threadinfo thread[active_pathcount]; memset(thread, 0, sizeof(thread)); for (i = 0; i < active_pathcount; i++){ From patchwork Thu Sep 2 21:57:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473167 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51AD4C433F5 for ; Thu, 2 Sep 2021 22:03:17 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EBB2B60F12 for ; Thu, 2 Sep 2021 22:03:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EBB2B60F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620196; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Fk4r6J4P+ByDH0PGpc6NAPL1gn3a/hMimeKd5iNxLvw=; b=XjanLArL0W3zwfNq+YHK/dr4dN9vFcvbnPy1OVZXUNV3ZiMEwro518i0A25/FCKFNqJm5p jItHZxlVmQRdXo6xm7tYrOBiLG2P4ArwtQ8JVtVEZyFo3Tf7edaqD4DdGX9+0k0FLDwEq3 DNb+jZXmieTJLQyU4TVoaJzF7ApWy0E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-3iShAxGQOXqEQelpLWAkZw-1; Thu, 02 Sep 2021 18:03:14 -0400 X-MC-Unique: 3iShAxGQOXqEQelpLWAkZw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47CE6100E407; Thu, 2 Sep 2021 22:03:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28C9A17A98; Thu, 2 Sep 2021 22:03:10 +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 C62631800FDD; Thu, 2 Sep 2021 22:03:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182LvwrD013346 for ; Thu, 2 Sep 2021 17:57:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B25669322; Thu, 2 Sep 2021 21:57:58 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 054426A8FF; Thu, 2 Sep 2021 21:57:56 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182Lvthh012303; Thu, 2 Sep 2021 16:57:55 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182LvsdK012302; Thu, 2 Sep 2021 16:57:54 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:46 -0500 Message-Id: <1630619869-12251-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 3/6] multipath: print warning if multipathd is not running. 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com If multipath notices that multipath devices exist or were created, and multipathd is not running, it now prints a warning message, so users are notified of the issue. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/configure.c | 3 ++- libmultipath/configure.h | 1 + libmultipath/libmultipath.version | 5 +++++ multipath/main.c | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 12278640..2f417914 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1082,7 +1082,8 @@ deadmap (struct multipath * mpp) return 1; /* dead */ } -int check_daemon(void) +extern int +check_daemon(void) { int fd; char *reply; diff --git a/libmultipath/configure.h b/libmultipath/configure.h index 92a5aba6..efe18b7d 100644 --- a/libmultipath/configure.h +++ b/libmultipath/configure.h @@ -59,3 +59,4 @@ struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type); void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath); void trigger_partitions_udev_change(struct udev_device *dev, const char *action, int len); +int check_daemon(void); diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version index 1d84d97c..7b48265f 100644 --- a/libmultipath/libmultipath.version +++ b/libmultipath/libmultipath.version @@ -285,3 +285,8 @@ global: print_strbuf; truncate_strbuf; } LIBMULTIPATH_8.0.0; + +LIBMULTIPATH_8.2.0 { +global: + check_daemon; +} LIBMULTIPATH_8.1.0; diff --git a/multipath/main.c b/multipath/main.c index 8fc0e15f..6c70760f 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -456,6 +456,7 @@ configure (struct config *conf, enum mpath_cmds cmd, { vector curmp = NULL; vector pathvec = NULL; + vector newmp = NULL; int r = RTVL_FAIL, rc; int di_flag = 0; char * refwwid = NULL; @@ -466,8 +467,9 @@ configure (struct config *conf, enum mpath_cmds cmd, */ curmp = vector_alloc(); pathvec = vector_alloc(); + newmp = vector_alloc(); - if (!curmp || !pathvec) { + if (!curmp || !pathvec || !newmp) { condlog(0, "can not allocate memory"); goto out; } @@ -569,16 +571,24 @@ configure (struct config *conf, enum mpath_cmds cmd, /* * core logic entry point */ - rc = coalesce_paths(&vecs, NULL, refwwid, + rc = coalesce_paths(&vecs, newmp, refwwid, conf->force_reload, cmd); r = rc == CP_RETRY ? RTVL_RETRY : rc == CP_OK ? RTVL_OK : RTVL_FAIL; out: + if (r == RTVL_OK && + (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG || + cmd == CMD_CREATE) && + (VECTOR_SIZE(curmp) > 0 || VECTOR_SIZE(newmp) > 0) && + !check_daemon()) + condlog(2, "Warning: multipath devices exist, but multipathd service is not running"); + if (refwwid) FREE(refwwid); free_multipathvec(curmp, KEEP_PATHS); vecs.mpvec = NULL; + free_multipathvec(newmp, KEEP_PATHS); free_pathvec(pathvec, FREE_PATHS); vecs.pathvec = NULL; From patchwork Thu Sep 2 21:57:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473269 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D72DC433F5 for ; Thu, 2 Sep 2021 22:04:26 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 41CEB60F12 for ; Thu, 2 Sep 2021 22:04:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 41CEB60F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620265; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FwV47wkzHoi7sWw0vBGdXgpU7dQX/zl2JmXWThXd7QA=; b=X1h/H71xWo/dBUDanp3+dZ6bD/V5bOXDI7RnIo2jM7RXXGRlMAA5mrVQv+tkUcte6H/UPC qNZuxmNWHaR1P4k5cf2giSa6QH/4hxvXE49IORgMetaExLuTuahTNCU26O581F6cKBfCbS nqqjN5ddvx4hXrWtxFZ6ySOI/lsoVlE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-278-_DuwaoOnNKKdGxqXfpg10Q-1; Thu, 02 Sep 2021 18:04:23 -0400 X-MC-Unique: _DuwaoOnNKKdGxqXfpg10Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DFDE280292A; Thu, 2 Sep 2021 22:04:18 +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 C19495D9C6; Thu, 2 Sep 2021 22:04:18 +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 75BEF44A5A; Thu, 2 Sep 2021 22:04:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182Lw1Ot013380 for ; Thu, 2 Sep 2021 17:58:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E610102AE41; Thu, 2 Sep 2021 21:58:01 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 183AA10074F1; Thu, 2 Sep 2021 21:57:58 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182Lvu0T012307; Thu, 2 Sep 2021 16:57:56 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182Lvull012306; Thu, 2 Sep 2021 16:57:56 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:47 -0500 Message-Id: <1630619869-12251-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 4/6] libmultipath: remove unneeded code in coalesce_paths 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com The code at the end of coalesce_paths() removes a multipath device that was just created/reloaded, if none of its path devices have pp->dev set. This code is very old, and no longer has any actual effect. Multipath devices no longer get placed in pathvec without having pp->dev set. Even if they could, there's no point in creating/reloading the device and then immediately removing it. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/configure.c | 46 ---------------------------------------- 1 file changed, 46 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 2f417914..3f241c5c 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1060,28 +1060,6 @@ int domap(struct multipath *mpp, char *params, int is_daemon) return DOMAP_FAIL; } -static int -deadmap (struct multipath * mpp) -{ - int i, j; - struct pathgroup * pgp; - struct path * pp; - - if (!mpp->pg) - return 1; - - vector_foreach_slot (mpp->pg, pgp, i) { - if (!pgp->paths) - continue; - - vector_foreach_slot (pgp->paths, pp, j) - if (strlen(pp->dev)) - return 0; /* alive */ - } - - return 1; /* dead */ -} - extern int check_daemon(void) { @@ -1313,30 +1291,6 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); } - /* - * Flush maps with only dead paths (ie not in sysfs) - * Keep maps with only failed paths - */ - if (mpvec) { - vector_foreach_slot (newmp, mpp, i) { - char alias[WWID_SIZE]; - - if (!deadmap(mpp)) - continue; - - strlcpy(alias, mpp->alias, WWID_SIZE); - - vector_del_slot(newmp, i); - i--; - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); - - if (dm_flush_map(alias)) - condlog(2, "%s: remove failed (dead)", - alias); - else - condlog(2, "%s: remove (dead)", alias); - } - } ret = CP_OK; out: free(size_mismatch_seen); From patchwork Thu Sep 2 21:57:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473169 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22F7EC433F5 for ; Thu, 2 Sep 2021 22:03:20 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDAC160F12 for ; Thu, 2 Sep 2021 22:03:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDAC160F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620198; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9q9TUUjYekL5/PNCa1ZyN6LdAyNkDpdzXf8cGOr8D7Y=; b=an1XIhbESdjpBnPKWhJMcDueTzUVoTEneIRaWAOTb5B8eanmZRZOLEiKOrS9gfRW8I/IG0 MiZ6dydrIiKYLXgrfwKLJtSduQx6ttV/ZQp5kVYLYHDZjdX4V6Ga9L161dvXMocV+r79Z9 23HtIsYGXTf8MadfiDCdXoG6bO1wrWY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-q2PcETPZPhevVDMXWLk9mA-1; Thu, 02 Sep 2021 18:03:17 -0400 X-MC-Unique: q2PcETPZPhevVDMXWLk9mA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A3AE107ACE3; Thu, 2 Sep 2021 22:03:12 +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 3074460BF1; Thu, 2 Sep 2021 22:03:12 +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 CE92D4EEA1; Thu, 2 Sep 2021 22:03:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182LvxjK013358 for ; Thu, 2 Sep 2021 17:57:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 869B96A8F8; Thu, 2 Sep 2021 21:57:59 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7222169322; Thu, 2 Sep 2021 21:57:59 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182Lvvel012311; Thu, 2 Sep 2021 16:57:57 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182Lvvc3012310; Thu, 2 Sep 2021 16:57:57 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:48 -0500 Message-Id: <1630619869-12251-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 5/6] libmultipath: deal with dynamic PTHREAD_STACK_MIN 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf() returns a long and can, at least in theory, return -1. This change causes compilation to fail in setup_thread_attr() due to a comparision with different signedness, since stacksize is a size_t. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmultipath/util.c b/libmultipath/util.c index e2fafe85..ea858409 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -223,8 +223,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached) ret = pthread_attr_init(attr); assert(ret == 0); - if (stacksize < PTHREAD_STACK_MIN) - stacksize = PTHREAD_STACK_MIN; + if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN) + stacksize = (size_t)PTHREAD_STACK_MIN; ret = pthread_attr_setstacksize(attr, stacksize); assert(ret == 0); if (detached) { From patchwork Thu Sep 2 21:57:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12473271 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 963F4C433EF for ; Thu, 2 Sep 2021 22:04:28 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4BBFA60724 for ; Thu, 2 Sep 2021 22:04:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4BBFA60724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630620267; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EdaUOAZ3R6Z9UHEyeZ2EdweiOjhfHlmjsJCb8oy9dBE=; b=e9MlhfiErM1QfviZlSwW4alOdj+Kr7Ld8gviTcv0NYH1jYKnb4r9wnhjve0H68Qi5pDjNZ ys0uvQEcJfhIl5Q+6mgQRBvGyOjCvj+bfQ54sT4GkXRqJVeWZS+kykvTmhyn/FTREzl6CS WX8nsVUlX4P/LpjouPV0Zr+S7LvYwc8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-9WqlPL8MOteGA8MjippWRg-1; Thu, 02 Sep 2021 18:04:26 -0400 X-MC-Unique: 9WqlPL8MOteGA8MjippWRg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DADF5107ACE6; Thu, 2 Sep 2021 22:04:20 +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 C18DD60BF1; Thu, 2 Sep 2021 22:04:20 +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 95CA744A5C; Thu, 2 Sep 2021 22:04:20 +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 182Lw4tm013400 for ; Thu, 2 Sep 2021 17:58:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 882E95B826; Thu, 2 Sep 2021 21:58:04 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBAA1369A; Thu, 2 Sep 2021 21:58:00 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 182LvxXn012315; Thu, 2 Sep 2021 16:57:59 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 182LvwBC012314; Thu, 2 Sep 2021 16:57:58 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Thu, 2 Sep 2021 16:57:49 -0500 Message-Id: <1630619869-12251-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> References: <1630619869-12251-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 6/6] libmultipath: drop unnecessary parameter from remove_map() 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com When remove_map() is called, if the multipath device is in a mpvec, it must be removed from it, because the device will be freed. Now that the mpvec is passed as a separate parameter to remove_map(), the purge_vec parameter is redundant. It was only used by coalesce_paths(), since the multipath device isn't on any vector when remove_map() is called there. Instead, remove_map() can just be called with a NULL mpvec, when there is no mpvec to remove the device from. remove_map_by_alias() also has a redundant purge_vec parameter. Since it only removes a map if it finds in on vec->mpvec, calling it with KEEP_VEC would be a bug, since it would leave a pointer to the freed device in the vector. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmpathpersist/mpath_persist.c | 2 +- libmultipath/configure.c | 13 ++++++------- libmultipath/structs_vec.c | 12 ++++++------ libmultipath/structs_vec.h | 11 ++--------- multipath/main.c | 4 ++-- multipathd/dmevents.c | 2 +- multipathd/main.c | 12 ++++++------ 7 files changed, 24 insertions(+), 32 deletions(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 26710e79..803a2a28 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -410,7 +410,7 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid) if (update_multipath_table(mpp, pathvec, DI_CHECKER) != DMP_OK || update_mpp_paths(mpp, pathvec)) { condlog(1, "error parsing map %s", mpp->wwid); - remove_map(mpp, pathvec, curmp, PURGE_VEC); + remove_map(mpp, pathvec, curmp); i--; } else extract_hwe_from_path(mpp); diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 3f241c5c..7edb355b 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1198,7 +1198,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, if (!mpp->paths) { condlog(0, "%s: skip coalesce (no paths)", mpp->alias); - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); continue; } @@ -1226,7 +1226,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, verify_paths(mpp); if (setup_map(mpp, ¶ms, vecs)) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); continue; } @@ -1248,7 +1248,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, condlog(2, "%s: %s map", mpp->alias, (mpp->action == ACT_CREATE)? "ignoring" : "removing"); - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); continue; } else /* if (r == DOMAP_RETRY && !is_daemon) */ { ret = CP_RETRY; @@ -1257,7 +1257,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, } if (r == DOMAP_DRY) { if (!vector_alloc_slot(newmp)) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); goto out; } vector_set_slot(newmp, mpp); @@ -1282,14 +1282,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, if (mpp->action != ACT_REJECT) { if (!vector_alloc_slot(newmp)) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); goto out; } vector_set_slot(newmp, mpp); } else - remove_map(mpp, vecs->pathvec, vecs->mpvec, - KEEP_VEC); + remove_map(mpp, vecs->pathvec, NULL); } ret = CP_OK; out: diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 24d6fd24..85d97ac1 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -334,7 +334,7 @@ void set_path_removed(struct path *pp) } void -remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec) +remove_map(struct multipath *mpp, vector pathvec, vector mpvec) { int i; @@ -343,7 +343,7 @@ remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec) */ orphan_paths(pathvec, mpp, "map removed internally"); - if (purge_vec && + if (mpvec && (i = find_slot(mpvec, (void *)mpp)) != -1) vector_del_slot(mpvec, i); @@ -354,12 +354,12 @@ remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec) } void -remove_map_by_alias(const char *alias, struct vectors * vecs, int purge_vec) +remove_map_by_alias(const char *alias, struct vectors * vecs) { struct multipath * mpp = find_mp_by_alias(vecs->mpvec, alias); if (mpp) { condlog(2, "%s: removing map by alias", alias); - remove_map(mpp, vecs->pathvec, vecs->mpvec, purge_vec); + remove_map(mpp, vecs->pathvec, vecs->mpvec); } } @@ -373,7 +373,7 @@ remove_maps(struct vectors * vecs) return; vector_foreach_slot (vecs->mpvec, mpp, i) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); i--; } @@ -704,7 +704,7 @@ struct multipath *add_map_with_path(struct vectors *vecs, struct path *pp, return mpp; out: - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); return NULL; } diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h index ee2b723b..29ede454 100644 --- a/libmultipath/structs_vec.h +++ b/libmultipath/structs_vec.h @@ -27,15 +27,8 @@ int update_mpp_paths(struct multipath * mpp, vector pathvec); int update_multipath_strings (struct multipath *mpp, vector pathvec); void extract_hwe_from_path(struct multipath * mpp); -enum { - KEEP_VEC, - PURGE_VEC, -}; - -void remove_map (struct multipath *mpp, vector pathvec, vector mpvec, - int purge_vec); -void remove_map_by_alias(const char *alias, struct vectors * vecs, - int purge_vec); +void remove_map (struct multipath *mpp, vector pathvec, vector mpvec); +void remove_map_by_alias(const char *alias, struct vectors * vecs); void remove_maps (struct vectors * vecs); void sync_map_state (struct multipath *); diff --git a/multipath/main.c b/multipath/main.c index 6c70760f..65ece830 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -191,14 +191,14 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid) if (refwwid && strlen(refwwid) && strncmp(mpp->wwid, refwwid, WWID_SIZE)) { condlog(3, "skip map %s: out of scope", mpp->alias); - remove_map(mpp, pathvec, curmp, PURGE_VEC); + remove_map(mpp, pathvec, curmp); i--; continue; } if (update_multipath_table(mpp, pathvec, flags) != DMP_OK) { condlog(1, "error parsing map %s", mpp->wwid); - remove_map(mpp, pathvec, curmp, PURGE_VEC); + remove_map(mpp, pathvec, curmp); i--; continue; } diff --git a/multipathd/dmevents.c b/multipathd/dmevents.c index f52f5970..f035ee7f 100644 --- a/multipathd/dmevents.c +++ b/multipathd/dmevents.c @@ -359,7 +359,7 @@ static int dmevent_loop (void) pthread_testcancel(); r = 0; if (curr_dev.action == EVENT_REMOVE) - remove_map_by_alias(curr_dev.name, waiter->vecs, PURGE_VEC); + remove_map_by_alias(curr_dev.name, waiter->vecs); else r = update_multipath(waiter->vecs, curr_dev.name, 1); pthread_cleanup_pop(1); diff --git a/multipathd/main.c b/multipathd/main.c index ae8272e3..3aff241d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -385,7 +385,7 @@ remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs) condlog(3, "%s: removing map from internal tables", mpp->alias); if (!poll_dmevents) stop_waiter_thread(mpp); - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); } static void @@ -518,7 +518,7 @@ retry: fail: if (new_map && (retries < 0 || wait_for_events(mpp, vecs))) { condlog(0, "%s: failed to create new map", mpp->alias); - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); return 1; } @@ -572,7 +572,7 @@ add_map_without_path (struct vectors *vecs, const char *alias) return mpp; out: - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); return NULL; } @@ -1162,7 +1162,7 @@ rescan: goto fail; fail_map: - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); fail: orphan_path(pp, "failed to add path"); return 1; @@ -1469,7 +1469,7 @@ map_discovery (struct vectors * vecs) vector_foreach_slot (vecs->mpvec, mpp, i) if (update_multipath_table(mpp, vecs->pathvec, 0) != DMP_OK) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); i--; } @@ -2706,7 +2706,7 @@ configure (struct vectors * vecs) */ vector_foreach_slot(vecs->mpvec, mpp, i) { if (wait_for_events(mpp, vecs)) { - remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC); + remove_map(mpp, vecs->pathvec, vecs->mpvec); i--; continue; }