From patchwork Tue Aug 11 21:58:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709751 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C6D0109B for ; Tue, 11 Aug 2020 22:00:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD0DC207DA for ; Tue, 11 Aug 2020 22:00:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OflVGoyG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD0DC207DA Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183253; 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=u3YlVikdd7ygMqxO5PKAg575FB0Y60TnE+VDp4BFuaM=; b=OflVGoyGoHm7M6DNGSWSqjdY8cuj1TU3sAXeA9GX76tmR6J7U9CdjvGmg1BT5mdE64m3OC hYpcyU0PlXaJzmIaj6fxSUKC6LTCgM+t1G+5VuTpbBMRCa2Qn2zTpuzRh6k9emW1qmk1mE HPHicQb7vaCgTEEnfKq+QylXiaIUme4= 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-481-lRK0jsWWPlSuhGCe-oxoVg-1; Tue, 11 Aug 2020 18:00:51 -0400 X-MC-Unique: lRK0jsWWPlSuhGCe-oxoVg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC5F7106B242; Tue, 11 Aug 2020 22:00:46 +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 BFD065C6D9; Tue, 11 Aug 2020 22:00: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 6F66AA554A; Tue, 11 Aug 2020 22:00:46 +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 07BLwnWx009100 for ; Tue, 11 Aug 2020 17:58:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2DD071009880; Tue, 11 Aug 2020 21:58:49 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4513710016E8; Tue, 11 Aug 2020 21:58:47 +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 07BLwjNf015839; Tue, 11 Aug 2020 16:58:45 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwjGZ015838; Tue, 11 Aug 2020 16:58:45 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:36 -0500 Message-Id: <1597183123-15797-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-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 1/8] Makefile.inc: trim extra information from systemd version 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.16 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 Some systemd versions print extra information in the "pkg-config --modversion" output, which confuses make. Trim this off. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc b/Makefile.inc index e7256e3a..8ea3352d 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -37,7 +37,7 @@ endif ifndef SYSTEMD ifeq ($(shell pkg-config --modversion libsystemd >/dev/null 2>&1 && echo 1), 1) - SYSTEMD = $(shell pkg-config --modversion libsystemd) + SYSTEMD = $(shell pkg-config --modversion libsystemd | awk '{print $$1}') else ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1) SYSTEMD = $(shell systemctl --version 2> /dev/null | \ From patchwork Tue Aug 11 21:58:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709755 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84DAF618 for ; Tue, 11 Aug 2020 22:01:00 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 416E32078B for ; Tue, 11 Aug 2020 22:01:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EGpT/PE6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 416E32078B Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183259; 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=V8COgXECvf+H+5HCAKBFBOfKuKOLnOx4j6huhjKuDAs=; b=EGpT/PE6Qqnj7Uf7TXsSMbW15s57bJ6G7y5Ym+RP66OeVhlwr6V5PhY/lx7PUwKsbVI0Nh XPxUC4gHKiAtaIAfn8SxJLiR5HyBvzjkF5+pZCuGMhhzuWa/hO8P/Ln2sbyYtBxFYpj9xz muHZYKGtab6mZw9h051a444JC9QWxeo= 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-369-0S8pEWx9MxGcZhOwmxdiZQ-1; Tue, 11 Aug 2020 18:00:56 -0400 X-MC-Unique: 0S8pEWx9MxGcZhOwmxdiZQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDAD280048C; Tue, 11 Aug 2020 22:00:51 +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 B308B8BA28; Tue, 11 Aug 2020 22:00:51 +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 89931A554C; Tue, 11 Aug 2020 22:00:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwp1Q009136 for ; Tue, 11 Aug 2020 17:58:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA38F8AD0F; Tue, 11 Aug 2020 21:58:51 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50A718AD05; Tue, 11 Aug 2020 21:58:48 +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 07BLwkgJ015843; Tue, 11 Aug 2020 16:58:47 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwkxK015842; Tue, 11 Aug 2020 16:58:46 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:37 -0500 Message-Id: <1597183123-15797-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 2/8] kpartx: fix -Wsign-compare error 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.11 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 --- kpartx/kpartx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index c24ad6d9..653ce0c8 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -738,7 +738,7 @@ struct block { /* blknr is always in 512 byte blocks */ char * getblock (int fd, unsigned int blknr) { - unsigned int secsz = get_sector_size(fd); + int secsz = get_sector_size(fd); unsigned int blks_per_sec = secsz / 512; unsigned int secnr = blknr / blks_per_sec; unsigned int blk_off = (blknr % blks_per_sec) * 512; From patchwork Tue Aug 11 21:58:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709765 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D563618 for ; Tue, 11 Aug 2020 22:02:04 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C3A7206C3 for ; Tue, 11 Aug 2020 22:02:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RqH50yCv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C3A7206C3 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183323; 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=mPjInyvx7prtkRntqz3wEuTz54XDUOgV8Y02mn+ezAc=; b=RqH50yCvpPcIZtPY+HrxGu++k8tGiK+ZKNQ2dihE6zCd1oEED/s8pxJf26nhhLJITacoP4 Gg1d59uLJ96pW8g7pHwjoISlyRGgRHsnKnAH/DJmlGwPxJwoMnQIlmjQMk5jw33kl4+8jj inzP/FTL7FtQTjlMre1pA8Kd2+AixV0= 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-443-YBjiGP84Ouykr1aiHT-WTA-1; Tue, 11 Aug 2020 18:00:58 -0400 X-MC-Unique: YBjiGP84Ouykr1aiHT-WTA-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 9D9D8106B24B; Tue, 11 Aug 2020 22:00:53 +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 7DB881EA; Tue, 11 Aug 2020 22:00:53 +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 500B81809554; Tue, 11 Aug 2020 22:00:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwqT9009146 for ; Tue, 11 Aug 2020 17:58:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72D961A921; Tue, 11 Aug 2020 21:58:52 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94D1719931; Tue, 11 Aug 2020 21:58:49 +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 07BLwmqF015847; Tue, 11 Aug 2020 16:58:48 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwlXU015846; Tue, 11 Aug 2020 16:58:47 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:38 -0500 Message-Id: <1597183123-15797-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 3/8] libmultipath: refactor path counting 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 pathcountgr() is never used except by pathcount(), and neither is the special case for PATH_WILD. Simplify this and change it into a helper function that is called by pathcount, and will be used again in a future patch. Leave count_active_paths alone for the sake of compiler optimization. Also use count_active_paths() in mpath_persist. Signed-off-by: Benjamin Marzinski --- libmpathpersist/mpath_persist.c | 4 ++-- libmultipath/structs.c | 31 +++++++++++++++++-------------- libmultipath/structs.h | 1 - 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 3da7a6cf..a132f4e9 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -436,7 +436,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope, all_tg_pt = (mpp->all_tg_pt == ALL_TG_PT_ON || paramp->sa_flags & MPATH_F_ALL_TG_PT_MASK); - active_pathcount = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST); + active_pathcount = count_active_paths(mpp); if (active_pathcount == 0) { condlog (0, "%s: no path available", mpp->wwid); @@ -648,7 +648,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, if (!mpp) return MPATH_PR_DMMP_ERROR; - active_pathcount = pathcount (mpp, PATH_UP) + pathcount (mpp, PATH_GHOST); + active_pathcount = count_active_paths(mpp); struct threadinfo thread[active_pathcount]; memset(thread, 0, sizeof(thread)); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 2dd378c4..90874559 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -455,30 +455,33 @@ find_path_by_devt (const struct _vector *pathvec, const char * dev_t) return NULL; } -int pathcountgr(const struct pathgroup *pgp, int state) +static int do_pathcount(const struct multipath *mpp, const int *states, + unsigned int nr_states) { + struct pathgroup *pgp; struct path *pp; int count = 0; - int i; + unsigned int i, j, k; - vector_foreach_slot (pgp->paths, pp, i) - if ((pp->state == state) || (state == PATH_WILD)) - count++; + if (!mpp->pg || !nr_states) + return count; + vector_foreach_slot (mpp->pg, pgp, i) { + vector_foreach_slot (pgp->paths, pp, j) { + for (k = 0; k < nr_states; k++) { + if (pp->state == states[k]) { + count++; + break; + } + } + } + } return count; } int pathcount(const struct multipath *mpp, int state) { - struct pathgroup *pgp; - int count = 0; - int i; - - if (mpp->pg) { - vector_foreach_slot (mpp->pg, pgp, i) - count += pathcountgr(pgp, state); - } - return count; + return do_pathcount(mpp, &state, 1); } int count_active_paths(const struct multipath *mpp) diff --git a/libmultipath/structs.h b/libmultipath/structs.h index d69bc2e9..0c03e711 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -446,7 +446,6 @@ struct path * find_path_by_devt (const struct _vector *pathvec, const char *devt struct path * find_path_by_dev (const struct _vector *pathvec, const char *dev); struct path * first_path (const struct multipath *mpp); -int pathcountgr (const struct pathgroup *, int); int pathcount (const struct multipath *, int); int count_active_paths(const struct multipath *); int pathcmp (const struct pathgroup *, const struct pathgroup *); From patchwork Tue Aug 11 21:58:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709761 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2965C109B for ; Tue, 11 Aug 2020 22:01:07 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D82F7206C3 for ; Tue, 11 Aug 2020 22:01:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LmujwUGB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D82F7206C3 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183265; 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=uPrhcUdYuZ22Vs/plOmZH7OJhnreiQjRtUThzyFhSSE=; b=LmujwUGBYpRpAlXatkA/55/Oy2YW/Otkf1Y2iOlBSCtbdcBhJLXhJFHK22akiFcz0pqDgI DFPdZqS9mT1aIPnDpHtLuANdZadBFvzhED9ks1tEp/x/UI4sh7efZC3kYZTcyXLumXamd4 QEfgyN2RSrC1bQbkmq0kaVAw7XI4V0g= 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-235-rvc1RggwNkWsZ-7E2Gk_dw-1; Tue, 11 Aug 2020 18:01:03 -0400 X-MC-Unique: rvc1RggwNkWsZ-7E2Gk_dw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B0C6E928; Tue, 11 Aug 2020 22:00:59 +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 2FD8F87D97; Tue, 11 Aug 2020 22:00:59 +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 029741809561; Tue, 11 Aug 2020 22:00:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwri7009163 for ; Tue, 11 Aug 2020 17:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF6F45D9DD; Tue, 11 Aug 2020 21:58:53 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDE635D9D7; Tue, 11 Aug 2020 21:58:50 +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 07BLwnSq015851; Tue, 11 Aug 2020 16:58:49 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwn2o015850; Tue, 11 Aug 2020 16:58:49 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:39 -0500 Message-Id: <1597183123-15797-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 4/8] libmultipath: count pending paths as active on loads 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.15 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 multipath loads a table, it signals to udev if there are no active paths. Multipath wasn't counting pending paths as active. This meant that if all the paths were pending, udev would treat the device as not ready, and not run kpartx on it. Even if the pending paths later because active and were reinstated, the kernel would not send a new uevent, because from its point of view, they were always up. The alternative would be to continue to treat them as failed in the udev rules, but then also tell the kernel that they were down, so that it would trigger a uevent when they were reinstated. However, this could lead to newly created multipath devices failing IO, simply because the path checkers hadn't returned yet. Having udev assume that the the device is up, like the kernel does, seems like the safer option. Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 3 ++- libmultipath/structs.c | 7 +++++++ libmultipath/structs.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index f597ff8b..126cd728 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -417,7 +417,8 @@ static uint16_t build_udev_flags(const struct multipath *mpp, int reload) /* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */ return (mpp->skip_kpartx == SKIP_KPARTX_ON ? MPATH_UDEV_NO_KPARTX_FLAG : 0) | - ((count_active_paths(mpp) == 0 || mpp->ghost_delay_tick > 0) ? + ((count_active_pending_paths(mpp) == 0 || + mpp->ghost_delay_tick > 0) ? MPATH_UDEV_NO_PATHS_FLAG : 0) | (reload && !mpp->force_udev_reload ? MPATH_UDEV_RELOAD_FLAG : 0); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 90874559..010deb47 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -503,6 +503,13 @@ int count_active_paths(const struct multipath *mpp) return count; } +int count_active_pending_paths(const struct multipath *mpp) +{ + int states[] = {PATH_UP, PATH_GHOST, PATH_PENDING}; + + return do_pathcount(mpp, states, 3); +} + int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) { int i, j; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 0c03e711..917e4083 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -448,6 +448,7 @@ struct path * first_path (const struct multipath *mpp); int pathcount (const struct multipath *, int); int count_active_paths(const struct multipath *); +int count_active_pending_paths(const struct multipath *); int pathcmp (const struct pathgroup *, const struct pathgroup *); int add_feature (char **, const char *); int remove_feature (char **, const char *); From patchwork Tue Aug 11 21:58:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709759 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98EE8618 for ; Tue, 11 Aug 2020 22:01:05 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53108206C3 for ; Tue, 11 Aug 2020 22:01:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Dil0upIS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53108206C3 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183264; 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=/QYgKsD2dgaA5qhiluATjPpFJtjqiAacy7WORxT2qD8=; b=Dil0upISAlmJF7/VpTZFTh7h0detgE8ydnqMiypuKZa7qpm/U6cjDZuO5Yc2aXyQb/NOiX SNfHzy6UoWGMCGl37CaeNK4kzJ1riBIHpTnZczgNYCHzas2SD5hI3FcmgbNvbFphBQeQoz 9ASzu4/t+IUbdUs3zUtnbOX9SMkyuOM= 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-374-VSDNe4FTPmuKv-NSMNDbcA-1; Tue, 11 Aug 2020 18:01:01 -0400 X-MC-Unique: VSDNe4FTPmuKv-NSMNDbcA-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 6397A1B18BCF; Tue, 11 Aug 2020 22:00:57 +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 478168BB04; Tue, 11 Aug 2020 22:00:57 +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 1D9251809554; Tue, 11 Aug 2020 22:00:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwrBl009164 for ; Tue, 11 Aug 2020 17:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF7BB5D9E8; Tue, 11 Aug 2020 21:58:53 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D4EA5D9DC; Tue, 11 Aug 2020 21:58:52 +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 07BLwol7015855; Tue, 11 Aug 2020 16:58:50 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwo1p015854; Tue, 11 Aug 2020 16:58:50 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:40 -0500 Message-Id: <1597183123-15797-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 5/8] libmultipath: deal with flushing no maps 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 dm_flush_maps() was failing if there were no device-mapper devices at all, instead of returning success, since there is nothing to do. Fixes: "libmultipath: make dm_flush_maps only return 0 on success" Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 126cd728..b8199cb5 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -1024,10 +1024,10 @@ int dm_flush_maps (int need_suspend, int retries) if (!(names = dm_task_get_names (dmt))) goto out; + r = 0; if (!names->dev) goto out; - r = 0; do { if (need_suspend) r |= dm_suspend_and_flush_map(names->name, retries); From patchwork Tue Aug 11 21:58:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709757 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB0AA109B for ; Tue, 11 Aug 2020 22:01:03 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98215206C3 for ; Tue, 11 Aug 2020 22:01:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VJH2FfWm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98215206C3 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183262; 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=L1dL20lGpdVGPZXsqEFmnkeUUR5mMHJtFoT6hsHAE7c=; b=VJH2FfWmSGDSayYJNJghNl0YrEQznjEe1BOv21HNRBJgDIYM+c8ZfxpQ+B1d95BtAABVaD 5UMZPrldPHectpaIj6ETfb21aGhqVUMDp8tdL3NNUf50EvB1b81NOg5VNI7+iWDDTtb8+x 5UK8VVFyGUPefxAFInQSLOGdID862xA= 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-182--kjZ_GlpPm6Rlwf7ItAQaw-1; Tue, 11 Aug 2020 18:01:00 -0400 X-MC-Unique: -kjZ_GlpPm6Rlwf7ItAQaw-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 913A0E92C; Tue, 11 Aug 2020 22:00:55 +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 6E92010016E8; Tue, 11 Aug 2020 22:00:55 +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 459DC97529; Tue, 11 Aug 2020 22:00:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwrHa009158 for ; Tue, 11 Aug 2020 17:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 986CB8AD05; Tue, 11 Aug 2020 21:58:53 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83D4C8BB04; Tue, 11 Aug 2020 21:58:53 +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 07BLwp4S015859; Tue, 11 Aug 2020 16:58:52 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwp8K015858; Tue, 11 Aug 2020 16:58:51 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:41 -0500 Message-Id: <1597183123-15797-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 6/8] multipath: deal with delegation failures correctly 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.84 on 10.5.11.22 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 delegate_to_multipathd() was returning success, even if the multipathd command failed. Also, if the command was set to fail with NOT_DELEGATED, it shouldn't print any errors, since multipath will try to issue the command itself. Fixes: "multipath: delegate flushing maps to multipathd" Reviewed-by: Martin Wilck Signed-off-by: Benjamin Marzinski --- multipath/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/multipath/main.c b/multipath/main.c index 4c43314e..3da692dc 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -861,9 +861,12 @@ int delegate_to_multipathd(enum mpath_cmds cmd, goto out; } - if (reply != NULL && *reply != '\0' && strcmp(reply, "ok\n")) - printf("%s", reply); - r = DELEGATE_OK; + if (reply != NULL && *reply != '\0') { + if (strcmp(reply, "fail\n")) + r = DELEGATE_OK; + if (r != NOT_DELEGATED && strcmp(reply, "ok\n")) + printf("%s", reply); + } out: FREE(reply); From patchwork Tue Aug 11 21:58:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709749 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28F10618 for ; Tue, 11 Aug 2020 22:00:31 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79FF5206C3 for ; Tue, 11 Aug 2020 22:00:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CwYMJFwR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79FF5206C3 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183229; 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=EClosdCfQpUgnI3qegGtuBLjOeAoVkZXNHphV7OBx8Y=; b=CwYMJFwRDZWMHqdghSDegmo5xJ6lZi2X6I1tBgpiLyjXZLSGq4Knk267V8KfGVhAj4xg// 3q69c17JOfCJqt5LVqd5GAeqI+M1vkY1lGmVS5ZgIn+1wBiGnydILH0TBaT939f5Fhebr1 xbgCjSEUvZcQ74+Mb6mg1Wt/Kh2hZi8= 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-406-FKY-kCCiNgqyhkbAl6fJcg-1; Tue, 11 Aug 2020 18:00:27 -0400 X-MC-Unique: FKY-kCCiNgqyhkbAl6fJcg-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 0A2F31800D41; Tue, 11 Aug 2020 22:00:22 +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 7D2DF5DA73; Tue, 11 Aug 2020 22:00:21 +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 7601195467; Tue, 11 Aug 2020 22:00:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BLwsqd009179 for ; Tue, 11 Aug 2020 17:58:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFF9B8AD0F; Tue, 11 Aug 2020 21:58:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB9768AD05; Tue, 11 Aug 2020 21:58: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 07BLwrGb015863; Tue, 11 Aug 2020 16:58:53 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLwqwn015862; Tue, 11 Aug 2020 16:58:52 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:42 -0500 Message-Id: <1597183123-15797-8-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH v2 7/8] multipathd: unset mpp->hwe when removing 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.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 If the map doesn't unset its hwe pointer before orphaning all the paths, multipathd will print a warning message in orphan_path() because of commit "libmultipath: warn if freeing path that holds mpp->hwe". Signed-off-by: Benjamin Marzinski --- libmultipath/structs_vec.c | 1 + multipathd/main.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index ede14297..103ea11e 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -129,6 +129,7 @@ remove_map(struct multipath * mpp, struct vectors * vecs, int purge_vec) /* * clear references to this map */ + mpp->hwe = NULL; orphan_paths(vecs->pathvec, mpp, "map removed internally"); if (purge_vec && diff --git a/multipathd/main.c b/multipathd/main.c index f014d2a1..2b0e2734 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -666,6 +666,7 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths) condlog(2, "%s: map flushed", mpp->alias); } + mpp->hwe = NULL; orphan_paths(vecs->pathvec, mpp, "map flushed"); remove_map_and_stop_waiter(mpp, vecs); From patchwork Tue Aug 11 21:58:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 11709763 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68A7C109B for ; Tue, 11 Aug 2020 22:01:59 +0000 (UTC) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25B912078B for ; Tue, 11 Aug 2020 22:01:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Snc1wWIq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25B912078B Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597183318; 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=FjJuOkucTbqOLTd+OyHtJuj7yRhocY1tt8vW8yTqSm8=; b=Snc1wWIqVQbMvLA90T8BmyxPkN6k976T/OpijNKthlIM/4JCXdw5Km9e3P8KwK0sqwjh8W ZGpteT5ol81fLcBg74pxrt4EGZVlOehlj6XPJOLlXcoqDZg2SOdsXEMgU1ZapZ0h0W+2dM Zg9a8LcBHOB6pnHJn6jPSDNVldSfRcQ= 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-535-0GEmNuMgOxejxOp0MCe5Ng-1; Tue, 11 Aug 2020 18:01:56 -0400 X-MC-Unique: 0GEmNuMgOxejxOp0MCe5Ng-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 D6E91800050; Tue, 11 Aug 2020 22:01:51 +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 BC49B5D9D7; Tue, 11 Aug 2020 22:01:51 +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 6890D95467; Tue, 11 Aug 2020 22:01:51 +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 07BLwx2h009206 for ; Tue, 11 Aug 2020 17:58:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6664887D63; Tue, 11 Aug 2020 21:58:59 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E63D5F1EF; Tue, 11 Aug 2020 21:58: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 07BLwswL015867; Tue, 11 Aug 2020 16:58:54 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 07BLws2L015866; Tue, 11 Aug 2020 16:58:54 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Tue, 11 Aug 2020 16:58:43 -0500 Message-Id: <1597183123-15797-9-git-send-email-bmarzins@redhat.com> In-Reply-To: <1597183123-15797-1-git-send-email-bmarzins@redhat.com> References: <1597183123-15797-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 8/8] multipathd: log reason for calling domap() 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 When multipathd calls domap(), it should also print the reason on log level 2, it already does this on every code path except when domap is called by the path_checker. Also, if __setup_multipath deletes the device, it should log that. Signed-off-by: Benjamin Marzinski --- multipathd/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/multipathd/main.c b/multipathd/main.c index 2b0e2734..ee44d0fe 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -414,7 +414,7 @@ int __setup_multipath(struct vectors *vecs, struct multipath *mpp, { if (dm_get_info(mpp->alias, &mpp->dmi)) { /* Error accessing table */ - condlog(3, "%s: cannot access table", mpp->alias); + condlog(2, "%s: cannot access table", mpp->alias); goto out; } @@ -2252,13 +2252,18 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks) */ condlog(4, "path prio refresh"); - if (marginal_changed) + if (marginal_changed) { + condlog(2, "%s: path is %s marginal", pp->dev, + (pp->marginal)? "now" : "no longer"); update_path_groups(pp->mpp, vecs, 1); + } else if (update_prio(pp, new_path_up) && (pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio) && - pp->mpp->pgfailback == -FAILBACK_IMMEDIATE) + pp->mpp->pgfailback == -FAILBACK_IMMEDIATE) { + condlog(2, "%s: path priorities changed. reloading", + pp->mpp->alias); update_path_groups(pp->mpp, vecs, !new_path_up); - else if (need_switch_pathgroup(pp->mpp, 0)) { + } else if (need_switch_pathgroup(pp->mpp, 0)) { if (pp->mpp->pgfailback > 0 && (new_path_up || pp->mpp->failback_tick <= 0)) pp->mpp->failback_tick =