From patchwork Tue Apr 12 01:59:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809944 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 65405C433EF for ; Tue, 12 Apr 2022 02:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728811; 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=YYWR1hqMmF4oY+UrBJgTXYwWJ3+OQn4Yd1MolGHXGwE=; b=QTQA7dUS8VaiT6JZr9+zgsB1w44AiVO/N8qFfisnfNp9rmvJ2znMlb5xubpL30Ils33nv8 hdhZVAV+vvePsRtvUEpFPelcxKQ9sSO3Q8P0pTJnXFCXt3vhhwyRX12U06/HUvZVN4P5wE L2C8UVfQSBFkFTi+6Zs1SbN86as2lJE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-600-oi_3XfxyN4GS2UBIVG5U-A-1; Mon, 11 Apr 2022 22:00:08 -0400 X-MC-Unique: oi_3XfxyN4GS2UBIVG5U-A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54B9A805F0A; Tue, 12 Apr 2022 02:00:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4E2E407F78B; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6E4F5194037A; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E351E1947BBF for ; Tue, 12 Apr 2022 02:00:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D624540E80E0; Tue, 12 Apr 2022 02:00:02 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C600C40E80F3; Tue, 12 Apr 2022 02:00:02 +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 23C201lq011832; Mon, 11 Apr 2022 21:00:01 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C201IZ011831; Mon, 11 Apr 2022 21:00:01 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:51 -0500 Message-Id: <1649728799-11790-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Subject: [dm-devel] [PATCH 1/9] libmultipath: steal the src string pointer in merge_str() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 Instead of allocating a copy when the original string is going to be freed right after the merge, just steal the pointer. Also, merge_mpe() can't get called with NULL arguments. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/config.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libmultipath/config.c b/libmultipath/config.c index c595e768..612941b8 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -387,9 +387,9 @@ set_param_str(const char * str) } #define merge_str(s) \ - if (!dst->s && src->s) { \ - if (!(dst->s = set_param_str(src->s))) \ - return 1; \ + if (!dst->s && src->s && strlen(src->s)) { \ + dst->s = src->s; \ + src->s = NULL; \ } #define merge_num(s) \ @@ -397,7 +397,7 @@ set_param_str(const char * str) dst->s = src->s -static int +static void merge_hwe (struct hwentry * dst, struct hwentry * src) { char id[SCSI_VENDOR_SIZE+PATH_PRODUCT_SIZE]; @@ -449,15 +449,11 @@ merge_hwe (struct hwentry * dst, struct hwentry * src) reconcile_features_with_options(id, &dst->features, &dst->no_path_retry, &dst->retain_hwhandler); - return 0; } -static int +static void merge_mpe(struct mpentry *dst, struct mpentry *src) { - if (!dst || !src) - return 1; - merge_str(alias); merge_str(uid_attribute); merge_str(getuid); @@ -499,8 +495,6 @@ merge_mpe(struct mpentry *dst, struct mpentry *src) merge_num(uid); merge_num(gid); merge_num(mode); - - return 0; } void merge_mptable(vector mptable) From patchwork Tue Apr 12 01:59:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809947 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5DB2BC433FE for ; Tue, 12 Apr 2022 02:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728816; 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=WF+xCpckUiX1pfYBuey4OVEzw0WujRgnje+ujqIJzv0=; b=dq+8Z4hSn8hgI+5fRGd+6LLB4KIzZ2Jx5Rc4FB3SVriMhG/Mxab1r3+2zsFfgR5OcNo7gN K6S1NV3uNJ+mUb6cbeV3RetZrCQA19iQimUL69uUcUrJ01PrF3X096WNlQnN8vwZqOVHcY 4WBGZCgovjOOpE48oY/lQZQm/q08EQE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602--rtUgbnUOXCH5ZRBdgwXAg-1; Mon, 11 Apr 2022 22:00:08 -0400 X-MC-Unique: -rtUgbnUOXCH5ZRBdgwXAg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 56B7B1014A71; Tue, 12 Apr 2022 02:00:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84121401472; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3F8661940365; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3B8601949762 for ; Tue, 12 Apr 2022 02:00:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 186AD40E80F3; Tue, 12 Apr 2022 02:00:04 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09A0A40E80E0; Tue, 12 Apr 2022 02:00:04 +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 23C202Gh011836; Mon, 11 Apr 2022 21:00:02 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C2026V011835; Mon, 11 Apr 2022 21:00:02 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:52 -0500 Message-Id: <1649728799-11790-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Subject: [dm-devel] [PATCH 2/9] libmultipath: make protocol_name global X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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 Future patches will make use of this, so move it out of snprint_path_protocol() Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/print.c | 17 ----------------- libmultipath/structs.c | 18 ++++++++++++++++++ libmultipath/structs.h | 1 + 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index bf88f301..27c2cf1a 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -754,23 +754,6 @@ snprint_path_failures(struct strbuf *buff, const struct path * pp) int snprint_path_protocol(struct strbuf *buff, const struct path * pp) { - static const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = { - [SYSFS_BUS_UNDEF] = "undef", - [SYSFS_BUS_CCW] = "ccw", - [SYSFS_BUS_CCISS] = "cciss", - [SYSFS_BUS_NVME] = "nvme", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_FCP] = "scsi:fcp", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SPI] = "scsi:spi", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SSA] = "scsi:ssa", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SBP] = "scsi:sbp", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SRP] = "scsi:srp", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ISCSI] = "scsi:iscsi", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SAS] = "scsi:sas", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ADT] = "scsi:adt", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ATA] = "scsi:ata", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_USB] = "scsi:usb", - [SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC] = "scsi:unspec", - }; const char *pn = protocol_name[bus_protocol_id(pp)]; assert(pn != NULL); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 4b62da54..04cfdcdc 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -20,6 +20,24 @@ #include "dm-generic.h" #include "devmapper.h" +const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = { + [SYSFS_BUS_UNDEF] = "undef", + [SYSFS_BUS_CCW] = "ccw", + [SYSFS_BUS_CCISS] = "cciss", + [SYSFS_BUS_NVME] = "nvme", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_FCP] = "scsi:fcp", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SPI] = "scsi:spi", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SSA] = "scsi:ssa", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SBP] = "scsi:sbp", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SRP] = "scsi:srp", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ISCSI] = "scsi:iscsi", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_SAS] = "scsi:sas", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ADT] = "scsi:adt", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_ATA] = "scsi:ata", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_USB] = "scsi:usb", + [SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC] = "scsi:unspec", +}; + struct adapter_group * alloc_adaptergroup(void) { diff --git a/libmultipath/structs.h b/libmultipath/structs.h index d94f93a0..3722e31b 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -192,6 +192,7 @@ enum scsi_protocol { */ #define LAST_BUS_PROTOCOL_ID (SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC) unsigned int bus_protocol_id(const struct path *pp); +extern const char * const protocol_name[]; #define SCSI_INVALID_LUN ~0ULL From patchwork Tue Apr 12 01:59:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809949 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 87685C4332F for ; Tue, 12 Apr 2022 02:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728817; 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=o2q/vR2p8+Om+B3WC3QLRHaUHkKIR1579Msf0SOPbLk=; b=BJEgBWwFB6L//reFchGh3SFUE0lYR2bFKHIsYsxH4J2FEFtEtmkOmy3zwYp8+Hz9Pu/tGN 3alw7OiEpa+oiotIZhs5U9flLuj+VJ89UANVj84KE8Ya20LMIbzbFUTq1KgG/Qt2NfdHoQ wcBHRqtLngXGhROEeigEZUpXgrLJiBE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-614-E7LnlRQUNFyAjiJ7JpGdJg-1; Mon, 11 Apr 2022 22:00:09 -0400 X-MC-Unique: E7LnlRQUNFyAjiJ7JpGdJg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 409A53C02B67; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A574416384; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D80F01940366; Tue, 12 Apr 2022 02:00:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6BB2B1940378 for ; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5C0DF401E02; Tue, 12 Apr 2022 02:00:05 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 43128401DFF; Tue, 12 Apr 2022 02:00:05 +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 23C2042K011840; Mon, 11 Apr 2022 21:00:04 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C203jj011839; Mon, 11 Apr 2022 21:00:03 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:53 -0500 Message-Id: <1649728799-11790-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Subject: [dm-devel] [PATCH 3/9] libmultipath: add a protocol subsection to multipath.conf X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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 storage arrays can be accessed using multiple protocols at the same time. In these cases, users may want to set path attributes differently, depending on the protocol that the path is using. To allow this, add a protocol subsection to the device subsection in multipath.conf, which allows select path-specific options to be set. This commit simply adds the subsection, and handles merging matching entries, both within a hwentry, and when hwentries are merged. Future patches will make use of the section. Signed-off-by: Benjamin Marzinski --- libmultipath/config.c | 102 ++++++++++++++++++++++++++++++++++++++++++ libmultipath/config.h | 10 +++++ libmultipath/dict.c | 99 ++++++++++++++++++++++++++++++++++++++++ libmultipath/print.c | 44 ++++++++++++++++++ 4 files changed, 255 insertions(+) diff --git a/libmultipath/config.c b/libmultipath/config.c index 612941b8..61d3c182 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -237,6 +237,18 @@ const char *get_mpe_wwid(const struct _vector *mptable, const char *alias) return NULL; } +static void +free_pctable (vector pctable) +{ + int i; + struct pcentry *pce; + + vector_foreach_slot(pctable, pce, i) + free(pce); + + vector_free(pctable); +} + void free_hwe (struct hwentry * hwe) { @@ -282,6 +294,9 @@ free_hwe (struct hwentry * hwe) if (hwe->bl_product) free(hwe->bl_product); + if (hwe->pctable) + free_pctable(hwe->pctable); + free(hwe); } @@ -363,6 +378,15 @@ alloc_hwe (void) return hwe; } +struct pcentry * +alloc_pce (void) +{ + struct pcentry *pce = (struct pcentry *) + calloc(1, sizeof(struct pcentry)); + pce->type = -1; + return pce; +} + static char * set_param_str(const char * str) { @@ -396,6 +420,41 @@ set_param_str(const char * str) if (!dst->s && src->s) \ dst->s = src->s +static void +merge_pce(struct pcentry *dst, struct pcentry *src) +{ + merge_num(fast_io_fail); + merge_num(dev_loss); + merge_num(eh_deadline); +} + +static int +merge_pctable(vector d_pctable, vector s_pctable) +{ + struct pcentry *d_pce, *s_pce; + int i, j, start = 0; + + vector_foreach_slot_backwards(s_pctable, s_pce, i) { + bool found = false; + j = start; + vector_foreach_slot_after(d_pctable, d_pce, j) { + if (s_pce->type != d_pce->type) + continue; + found = true; + merge_pce(d_pce, s_pce); + vector_del_slot(s_pctable, i); + free(s_pce); + break; + } + if (found) + continue; + if (!vector_insert_slot(d_pctable, 0, s_pce)) + return 1; + vector_del_slot(s_pctable, i); + start++; + } + return 0; +} static void merge_hwe (struct hwentry * dst, struct hwentry * src) @@ -445,6 +504,13 @@ merge_hwe (struct hwentry * dst, struct hwentry * src) merge_num(marginal_path_err_recheck_gap_time); merge_num(marginal_path_double_failed_time); + if (src->pctable) { + if (!dst->pctable) + dst->pctable = steal_ptr(src->pctable); + else + merge_pctable(dst->pctable, src->pctable); + } + snprintf(id, sizeof(id), "%s/%s", dst->vendor, dst->product); reconcile_features_with_options(id, &dst->features, &dst->no_path_retry, @@ -602,6 +668,41 @@ out: return 1; } +static void +factorize_pctable(struct hwentry *hwe, const char *table_desc) +{ + struct pcentry *pce1, *pce2; + int i, j; + + if (!hwe->pctable) + return; + + vector_foreach_slot(hwe->pctable, pce1, i) { + if (pce1->type < 0) { + condlog(0, "protocol section from %s:%s in %s missing type", + hwe->vendor, hwe->product, table_desc); + vector_del_slot(hwe->pctable, i--); + free(pce1); + continue; + } + j = i + 1; + vector_foreach_slot_after(hwe->pctable, pce2, j) { + if (pce1->type != pce2->type) + continue; + merge_pce(pce2,pce1); + vector_del_slot(hwe->pctable, i--); + free(pce1); + break; + } + + } + + if (VECTOR_SIZE(hwe->pctable) == 0) { + vector_free(hwe->pctable); + hwe->pctable = NULL; + } +} + static void factorize_hwtable (vector hw, int n, const char *table_desc) { @@ -618,6 +719,7 @@ restart: free_hwe(hwe1); continue; } + factorize_pctable(hwe1, table_desc); j = n > i + 1 ? n : i + 1; vector_foreach_slot_after(hw, hwe2, j) { if (hwe_strmatch(hwe2, hwe1) == 0) { diff --git a/libmultipath/config.h b/libmultipath/config.h index c73389b5..b7bca9a8 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -40,6 +40,13 @@ enum force_reload_types { FORCE_RELOAD_WEAK, }; +struct pcentry { + int type; + int fast_io_fail; + unsigned int dev_loss; + int eh_deadline; +}; + struct hwentry { char * vendor; char * product; @@ -85,6 +92,8 @@ struct hwentry { int vpd_vendor_id; int recheck_wwid; char * bl_product; + + vector pctable; }; struct mpentry { @@ -284,6 +293,7 @@ const char *get_mpe_wwid (const struct _vector *mptable, const char *alias); struct hwentry * alloc_hwe (void); struct mpentry * alloc_mpe (void); +struct pcentry * alloc_pce (void); void free_hwe (struct hwentry * hwe); void free_hwtable (vector hwtable); diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 26cbe785..04d86ee3 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -417,6 +417,30 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \ return function(buff, mpe->option); \ } +#define declare_pc_handler(option, function) \ +static int \ +pc_ ## option ## _handler (struct config *conf, vector strvec, \ + const char *file, int line_nr) \ +{ \ + struct pcentry *pce; \ + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); \ + if (!hwe || !hwe->pctable) \ + return 1; \ + pce = VECTOR_LAST_SLOT(hwe->pctable); \ + if (!pce) \ + return 1; \ + return function (strvec, &pce->option, file, line_nr); \ +} + +#define declare_pc_snprint(option, function) \ +static int \ +snprint_pc_ ## option (struct config *conf, struct strbuf *buff, \ + const void *data) \ +{ \ + const struct pcentry *pce = (const struct pcentry *)data; \ + return function(buff, pce->option); \ +} + static int checkint_handler(struct config *conf, vector strvec, const char *file, int line_nr) { @@ -1046,6 +1070,8 @@ declare_ovr_handler(fast_io_fail, set_undef_off_zero) declare_ovr_snprint(fast_io_fail, print_undef_off_zero) declare_hw_handler(fast_io_fail, set_undef_off_zero) declare_hw_snprint(fast_io_fail, print_undef_off_zero) +declare_pc_handler(fast_io_fail, set_undef_off_zero) +declare_pc_snprint(fast_io_fail, print_undef_off_zero) static int set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr) @@ -1083,6 +1109,8 @@ declare_ovr_handler(dev_loss, set_dev_loss) declare_ovr_snprint(dev_loss, print_dev_loss) declare_hw_handler(dev_loss, set_dev_loss) declare_hw_snprint(dev_loss, print_dev_loss) +declare_pc_handler(dev_loss, set_dev_loss) +declare_pc_snprint(dev_loss, print_dev_loss) declare_def_handler(eh_deadline, set_undef_off_zero) declare_def_snprint(eh_deadline, print_undef_off_zero) @@ -1090,6 +1118,8 @@ declare_ovr_handler(eh_deadline, set_undef_off_zero) declare_ovr_snprint(eh_deadline, print_undef_off_zero) declare_hw_handler(eh_deadline, set_undef_off_zero) declare_hw_snprint(eh_deadline, print_undef_off_zero) +declare_pc_handler(eh_deadline, set_undef_off_zero) +declare_pc_snprint(eh_deadline, print_undef_off_zero) static int set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr) @@ -1897,6 +1927,68 @@ declare_mp_snprint(wwid, print_str) declare_mp_handler(alias, set_str_noslash) declare_mp_snprint(alias, print_str) + +static int +protocol_handler(struct config *conf, vector strvec, const char *file, + int line_nr) +{ + struct pcentry *pce; + struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); + if (!hwe) + return 1; + + if (!hwe->pctable && !(hwe->pctable = vector_alloc())) + return 1; + + if (!(pce = alloc_pce())) + return 1; + + if (!vector_alloc_slot(hwe->pctable)) { + free(pce); + return 1; + } + vector_set_slot(hwe->pctable, pce); + + return 0; +} + +static int +set_protocol_type(vector strvec, void *ptr, const char *file, int line_nr) +{ + int *int_ptr = (int *)ptr; + char *buff; + int i; + + buff = set_value(strvec); + + if (!buff) + return 1; + + for (i = 0; i <= LAST_BUS_PROTOCOL_ID; i++) { + if (protocol_name[i] && !strcmp(buff, protocol_name[i])) { + *int_ptr = i; + break; + } + } + if (i > LAST_BUS_PROTOCOL_ID) + condlog(1, "%s line %d, invalid value for type: \"%s\"", + file, line_nr, buff); + + free(buff); + return 0; +} + +static int +print_protocol_type(struct strbuf *buff, int type) +{ + if (type < 0) + return 0; + return append_strbuf_quoted(buff, protocol_name[type]); +} + +declare_pc_handler(type, set_protocol_type) +declare_pc_snprint(type, print_protocol_type) + /* * deprecated handlers */ @@ -2096,6 +2188,13 @@ init_keywords(vector keywords) install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt); install_keyword("vpd_vendor", &hw_vpd_vendor_handler, &snprint_hw_vpd_vendor); install_keyword("recheck_wwid", &hw_recheck_wwid_handler, &snprint_hw_recheck_wwid); + install_keyword_multi("protocol", &protocol_handler, NULL); + install_sublevel(); + install_keyword("type", &pc_type_handler, &snprint_pc_type); + install_keyword("fast_io_fail_tmo", &pc_fast_io_fail_handler, &snprint_pc_fast_io_fail); + install_keyword("dev_loss_tmo", &pc_dev_loss_handler, &snprint_pc_dev_loss); + install_keyword("eh_deadline", &pc_eh_deadline_handler, &snprint_pc_eh_deadline); + install_sublevel_end(); install_sublevel_end(); install_keyword_root("overrides", &overrides_handler); diff --git a/libmultipath/print.c b/libmultipath/print.c index 27c2cf1a..46d231ed 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -1406,6 +1406,45 @@ int snprint_multipath_topology_json (struct strbuf *buff, return get_strbuf_len(buff) - initial_len; } +static int +snprint_pcentry (struct strbuf *buff, const struct pcentry *pce, + const struct keyword *rootkw) +{ + int i, rc; + struct keyword *kw; + size_t initial_len = get_strbuf_len(buff); + + if ((rc = append_strbuf_str(buff, "\t\tprotocol {\n")) < 0) + return rc; + + iterate_sub_keywords(rootkw, kw, i) { + if ((rc = snprint_keyword(buff, "\t\t\t%k %v\n", kw, pce)) < 0) + return rc; + } + + if ((rc = append_strbuf_str(buff, "\t\t}\n")) < 0) + return rc; + return get_strbuf_len(buff) - initial_len; +} + +static int +snprint_pctable (const struct config *conf, struct strbuf *buff, + const struct _vector *pctable, const struct keyword *rootkw) +{ + int i, rc; + struct pcentry *pce; + size_t initial_len = get_strbuf_len(buff); + + rootkw = find_keyword(conf->keywords, rootkw->sub, "protocol"); + assert(rootkw); + + vector_foreach_slot(pctable, pce, i) { + if ((rc = snprint_pcentry(buff, pce, rootkw)) < 0) + return rc; + } + return get_strbuf_len(buff) - initial_len; +} + static int snprint_hwentry (const struct config *conf, struct strbuf *buff, const struct hwentry * hwe) @@ -1427,6 +1466,11 @@ snprint_hwentry (const struct config *conf, if ((rc = snprint_keyword(buff, "\t\t%k %v\n", kw, hwe)) < 0) return rc; } + + if (hwe->pctable && + (rc = snprint_pctable(conf, buff, hwe->pctable, rootkw)) < 0) + return rc; + if ((rc = append_strbuf_str(buff, "\t}\n")) < 0) return rc; return get_strbuf_len(buff) - initial_len; From patchwork Tue Apr 12 01:59:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809945 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2FEDC433FE for ; Tue, 12 Apr 2022 02:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728812; 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=399NikyeoYVAm31KoEhcPWR2w6c4J9fqtht4UlWAgao=; b=fihwPCKxLr6kvK8bSsmEw1LSZd6KAHkVwgTUW4NkGXIKuq9WFzmvusQgBW+hw4rd25jQ4i NqR0/1uMvLHS+dDCMr5b+rDd5BzIvWIJKWDVSs7p9YCuzxUADSiFPBCI/XY+W8K/c8wzwc kIqP7o1ZuFFGhKUmnhp6tc6DP5X6U7g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-OQ7twGMXNEmH8YzCDkIqQA-1; Mon, 11 Apr 2022 22:00:09 -0400 X-MC-Unique: OQ7twGMXNEmH8YzCDkIqQA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E5D1D1801391; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D015D40CFD13; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AA5501940365; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CE31F1947BBF for ; Tue, 12 Apr 2022 02:00:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9F49F400E873; Tue, 12 Apr 2022 02:00:06 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FC3240CF915; Tue, 12 Apr 2022 02:00:06 +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 23C205jG011844; Mon, 11 Apr 2022 21:00:05 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C204oq011843; Mon, 11 Apr 2022 21:00:04 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:54 -0500 Message-Id: <1649728799-11790-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Subject: [dm-devel] [PATCH 4/9] libmultipath: Set the scsi timeout parameters by path X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 Instead of dev_loss, fast_io_fail, and eh_deadline belonging to the multipath structure, have them belong to the path structure. This means that they are selected per path, and that sysfs_set_scsi_tmo() doesn't assume that all paths of a multipath device will have the same value. Currently they will all be the same, but a future patch will make it possible for paths to have different values based on their protocol. Signed-off-by: Benjamin Marzinski --- libmultipath/configure.c | 5 +- libmultipath/discovery.c | 174 ++++++++++++++++++++++----------------- libmultipath/discovery.h | 2 +- libmultipath/propsel.c | 42 +++++----- libmultipath/propsel.h | 6 +- libmultipath/structs.c | 1 - libmultipath/structs.h | 6 +- 7 files changed, 127 insertions(+), 109 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index eca11ba0..09ae708d 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -329,9 +329,6 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs) select_mode(conf, mpp); select_uid(conf, mpp); select_gid(conf, mpp); - select_fast_io_fail(conf, mpp); - select_dev_loss(conf, mpp); - select_eh_deadline(conf, mpp); select_reservation_key(conf, mpp); select_deferred_remove(conf, mpp); select_marginal_path_err_sample_time(conf, mpp); @@ -347,7 +344,7 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs) select_ghost_delay(conf, mpp); select_flush_on_last_del(conf, mpp); - sysfs_set_scsi_tmo(mpp, conf->checkint); + sysfs_set_scsi_tmo(conf, mpp); marginal_pathgroups = conf->marginal_pathgroups; pthread_cleanup_pop(1); diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index b969fba1..c6ba1967 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -598,13 +598,13 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen) } static int -sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp) +sysfs_set_eh_deadline(struct path *pp) { struct udev_device *hostdev; char host_name[HOST_NAME_LEN], value[16]; int ret, len; - if (mpp->eh_deadline == EH_DEADLINE_UNSET) + if (pp->eh_deadline == EH_DEADLINE_UNSET) return 0; sprintf(host_name, "host%d", pp->sg_id.host_no); @@ -613,12 +613,12 @@ sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp) if (!hostdev) return 1; - if (mpp->eh_deadline == EH_DEADLINE_OFF) + if (pp->eh_deadline == EH_DEADLINE_OFF) len = sprintf(value, "off"); - else if (mpp->eh_deadline == EH_DEADLINE_ZERO) + else if (pp->eh_deadline == EH_DEADLINE_ZERO) len = sprintf(value, "0"); else - len = sprintf(value, "%d", mpp->eh_deadline); + len = sprintf(value, "%d", pp->eh_deadline); ret = sysfs_attr_set_value(hostdev, "eh_deadline", value, len + 1); @@ -642,8 +642,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) unsigned int tmo; int ret; - if (mpp->dev_loss == DEV_LOSS_TMO_UNSET && - mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) + if (pp->dev_loss == DEV_LOSS_TMO_UNSET && + pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) return; sprintf(rport_id, "rport-%d:%d-%d", @@ -685,14 +685,14 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) * then set fast_io_fail, and _then_ set dev_loss_tmo * to the correct value. */ - if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET && - mpp->fast_io_fail != MP_FAST_IO_FAIL_ZERO && - mpp->fast_io_fail != MP_FAST_IO_FAIL_OFF) { + if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET && + pp->fast_io_fail != MP_FAST_IO_FAIL_ZERO && + pp->fast_io_fail != MP_FAST_IO_FAIL_OFF) { /* Check if we need to temporarily increase dev_loss_tmo */ - if ((unsigned int)mpp->fast_io_fail >= tmo) { + if ((unsigned int)pp->fast_io_fail >= tmo) { /* Increase dev_loss_tmo temporarily */ snprintf(value, sizeof(value), "%u", - (unsigned int)mpp->fast_io_fail + 1); + (unsigned int)pp->fast_io_fail + 1); ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, strlen(value)); if (ret <= 0) { @@ -706,20 +706,20 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) goto out; } } - } else if (mpp->dev_loss > DEFAULT_DEV_LOSS_TMO && - mpp->no_path_retry != NO_PATH_RETRY_QUEUE) { + } else if (pp->dev_loss > DEFAULT_DEV_LOSS_TMO && + mpp->no_path_retry != NO_PATH_RETRY_QUEUE) { condlog(2, "%s: limiting dev_loss_tmo to %d, since " "fast_io_fail is not set", rport_id, DEFAULT_DEV_LOSS_TMO); - mpp->dev_loss = DEFAULT_DEV_LOSS_TMO; + pp->dev_loss = DEFAULT_DEV_LOSS_TMO; } - if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) { - if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) + if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) { + if (pp->fast_io_fail == MP_FAST_IO_FAIL_OFF) sprintf(value, "off"); - else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) + else if (pp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) sprintf(value, "0"); else - snprintf(value, 16, "%u", mpp->fast_io_fail); + snprintf(value, 16, "%u", pp->fast_io_fail); ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo", value, strlen(value)); if (ret <= 0) { @@ -730,8 +730,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) rport_id, value, -ret); } } - if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) { - snprintf(value, 16, "%u", mpp->dev_loss); + if (pp->dev_loss != DEV_LOSS_TMO_UNSET) { + snprintf(value, 16, "%u", pp->dev_loss); ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, strlen(value)); if (ret <= 0) { @@ -747,15 +747,15 @@ out: } static void -sysfs_set_session_tmo(struct multipath *mpp, struct path *pp) +sysfs_set_session_tmo(struct path *pp) { struct udev_device *session_dev = NULL; char session_id[64]; char value[11]; - if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) + if (pp->dev_loss != DEV_LOSS_TMO_UNSET) condlog(3, "%s: ignoring dev_loss_tmo on iSCSI", pp->dev); - if (mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) + if (pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) return; sprintf(session_id, "session%d", pp->sg_id.transport_id); @@ -769,15 +769,15 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp) condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id, session_id); - if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) { - if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) { + if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) { + if (pp->fast_io_fail == MP_FAST_IO_FAIL_OFF) { condlog(3, "%s: can't switch off fast_io_fail_tmo " "on iSCSI", pp->dev); - } else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) { + } else if (pp->fast_io_fail == MP_FAST_IO_FAIL_ZERO) { condlog(3, "%s: can't set fast_io_fail_tmo to '0'" "on iSCSI", pp->dev); } else { - snprintf(value, 11, "%u", mpp->fast_io_fail); + snprintf(value, 11, "%u", pp->fast_io_fail); if (sysfs_attr_set_value(session_dev, "recovery_tmo", value, strlen(value)) <= 0) { condlog(3, "%s: Failed to set recovery_tmo, " @@ -790,14 +790,14 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp) } static void -sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp) +sysfs_set_nexus_loss_tmo(struct path *pp) { struct udev_device *parent, *sas_dev = NULL; const char *end_dev_id = NULL; char value[11]; static const char ed_str[] = "end_device-"; - if (!pp->udev || mpp->dev_loss == DEV_LOSS_TMO_UNSET) + if (!pp->udev || pp->dev_loss == DEV_LOSS_TMO_UNSET) return; for (parent = udev_device_get_parent(pp->udev); @@ -824,8 +824,8 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp) condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id); - if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) { - snprintf(value, 11, "%u", mpp->dev_loss); + if (pp->dev_loss != DEV_LOSS_TMO_UNSET) { + snprintf(value, 11, "%u", pp->dev_loss); if (sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout", value, strlen(value)) <= 0) condlog(3, "%s: failed to update " @@ -836,76 +836,98 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp) return; } +static void +scsi_tmo_error_msg(struct path *pp) +{ + STATIC_BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1); + STRBUF_ON_STACK(proto_buf); + unsigned int proto_id = bus_protocol_id(pp); + + snprint_path_protocol(&proto_buf, pp); + condlog(2, "%s: setting scsi timeouts is unsupported for protocol %s", + pp->dev, get_strbuf_str(&proto_buf)); + set_bit_in_bitfield(proto_id, bf); +} + int -sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint) +sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp) { struct path *pp; int i; - unsigned int dev_loss_tmo = mpp->dev_loss; - struct path *err_path = NULL; - STATIC_BITFIELD(bf, LAST_BUS_PROTOCOL_ID + 1); + unsigned int min_dev_loss = 0; + bool warn_dev_loss = false; + bool warn_fast_io_fail = false; if (mpp->no_path_retry > 0) { uint64_t no_path_retry_tmo = - (uint64_t)mpp->no_path_retry * checkint; + (uint64_t)mpp->no_path_retry * conf->checkint; if (no_path_retry_tmo > MAX_DEV_LOSS_TMO) - no_path_retry_tmo = MAX_DEV_LOSS_TMO; - if (no_path_retry_tmo > dev_loss_tmo) - dev_loss_tmo = no_path_retry_tmo; - } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE) { - dev_loss_tmo = MAX_DEV_LOSS_TMO; - } - if (mpp->dev_loss != DEV_LOSS_TMO_UNSET && - mpp->dev_loss != dev_loss_tmo) { - condlog(2, "%s: Using dev_loss_tmo=%u instead of %u because of no_path_retry setting", - mpp->alias, dev_loss_tmo, mpp->dev_loss); - mpp->dev_loss = dev_loss_tmo; - } - if (mpp->dev_loss != DEV_LOSS_TMO_UNSET && - mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET && - (unsigned int)mpp->fast_io_fail >= mpp->dev_loss) { - condlog(3, "%s: turning off fast_io_fail (%d is not smaller than dev_loss_tmo)", - mpp->alias, mpp->fast_io_fail); - mpp->fast_io_fail = MP_FAST_IO_FAIL_OFF; - } - if (mpp->dev_loss == DEV_LOSS_TMO_UNSET && - mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET && - mpp->eh_deadline == EH_DEADLINE_UNSET) - return 0; + min_dev_loss = MAX_DEV_LOSS_TMO; + else + min_dev_loss = no_path_retry_tmo; + } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE) + min_dev_loss = MAX_DEV_LOSS_TMO; vector_foreach_slot(mpp->paths, pp, i) { + select_fast_io_fail(conf, pp); + select_dev_loss(conf, pp); + select_eh_deadline(conf, pp); + + if (pp->dev_loss == DEV_LOSS_TMO_UNSET && + pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET && + pp->eh_deadline == EH_DEADLINE_UNSET) + continue; + if (pp->bus != SYSFS_BUS_SCSI) { - if (!err_path) - err_path = pp; + scsi_tmo_error_msg(pp); continue; } + sysfs_set_eh_deadline(pp); + + if (pp->dev_loss == DEV_LOSS_TMO_UNSET && + pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET) + continue; + + if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP && + pp->sg_id.proto_id != SCSI_PROTOCOL_ISCSI && + pp->sg_id.proto_id != SCSI_PROTOCOL_SAS) { + scsi_tmo_error_msg(pp); + continue; + } + + if (pp->dev_loss != DEV_LOSS_TMO_UNSET && + pp->dev_loss < min_dev_loss) { + warn_dev_loss = true; + pp->dev_loss = min_dev_loss; + } + if (pp->dev_loss != DEV_LOSS_TMO_UNSET && + pp->fast_io_fail > 0 && + (unsigned int)pp->fast_io_fail >= pp->dev_loss) { + warn_fast_io_fail = true; + pp->fast_io_fail = MP_FAST_IO_FAIL_OFF; + } switch (pp->sg_id.proto_id) { case SCSI_PROTOCOL_FCP: sysfs_set_rport_tmo(mpp, pp); break; case SCSI_PROTOCOL_ISCSI: - sysfs_set_session_tmo(mpp, pp); + sysfs_set_session_tmo(pp); break; case SCSI_PROTOCOL_SAS: - sysfs_set_nexus_loss_tmo(mpp, pp); + sysfs_set_nexus_loss_tmo(pp); break; default: - if (!err_path) - err_path = pp; + break; } - sysfs_set_eh_deadline(mpp, pp); - } - - if (err_path && !is_bit_set_in_bitfield(bus_protocol_id(pp), bf)) { - STRBUF_ON_STACK(proto_buf); - - snprint_path_protocol(&proto_buf, err_path); - condlog(2, "%s: setting dev_loss_tmo is unsupported for protocol %s", - mpp->alias, get_strbuf_str(&proto_buf)); - set_bit_in_bitfield(bus_protocol_id(pp), bf); } + if (warn_dev_loss) + condlog(2, "%s: Raising dev_loss_tmo to %u because of no_path_retry setting", + mpp->alias, min_dev_loss); + if (warn_fast_io_fail) + condlog(3, "%s: turning off fast_io_fail (not smaller than dev_loss_tmo)", + mpp->alias); return 0; } diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index 466af345..acd51792 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -42,7 +42,7 @@ int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice, int store_pathinfo (vector pathvec, struct config *conf, struct udev_device *udevice, int flag, struct path **pp_ptr); -int sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint); +int sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp); int sysfs_get_timeout(const struct path *pp, unsigned int *timeout); int sysfs_get_iscsi_ip_address(const struct path *pp, char *ip_address); int sysfs_get_host_adapter_name(const struct path *pp, diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 1419ec6f..d2d70090 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -769,53 +769,53 @@ int select_minio(struct config *conf, struct multipath *mp) return select_minio_bio(conf, mp); } -int select_fast_io_fail(struct config *conf, struct multipath *mp) +int select_fast_io_fail(struct config *conf, struct path *pp) { const char *origin; STRBUF_ON_STACK(buff); - mp_set_ovr(fast_io_fail); - mp_set_hwe(fast_io_fail); - mp_set_conf(fast_io_fail); - mp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL); + pp_set_ovr(fast_io_fail); + pp_set_hwe(fast_io_fail); + pp_set_conf(fast_io_fail); + pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL); out: - print_undef_off_zero(&buff, mp->fast_io_fail); - condlog(3, "%s: fast_io_fail_tmo = %s %s", mp->alias, + print_undef_off_zero(&buff, pp->fast_io_fail); + condlog(3, "%s: fast_io_fail_tmo = %s %s", pp->dev, get_strbuf_str(&buff), origin); return 0; } -int select_dev_loss(struct config *conf, struct multipath *mp) +int select_dev_loss(struct config *conf, struct path *pp) { const char *origin; STRBUF_ON_STACK(buff); - mp_set_ovr(dev_loss); - mp_set_hwe(dev_loss); - mp_set_conf(dev_loss); - mp->dev_loss = DEV_LOSS_TMO_UNSET; + pp_set_ovr(dev_loss); + pp_set_hwe(dev_loss); + pp_set_conf(dev_loss); + pp->dev_loss = DEV_LOSS_TMO_UNSET; return 0; out: - print_dev_loss(&buff, mp->dev_loss); - condlog(3, "%s: dev_loss_tmo = %s %s", mp->alias, + print_dev_loss(&buff, pp->dev_loss); + condlog(3, "%s: dev_loss_tmo = %s %s", pp->dev, get_strbuf_str(&buff), origin); return 0; } -int select_eh_deadline(struct config *conf, struct multipath *mp) +int select_eh_deadline(struct config *conf, struct path *pp) { const char *origin; STRBUF_ON_STACK(buff); - mp_set_ovr(eh_deadline); - mp_set_hwe(eh_deadline); - mp_set_conf(eh_deadline); - mp->eh_deadline = EH_DEADLINE_UNSET; + pp_set_ovr(eh_deadline); + pp_set_hwe(eh_deadline); + pp_set_conf(eh_deadline); + pp->eh_deadline = EH_DEADLINE_UNSET; /* not changing sysfs in default cause, so don't print anything */ return 0; out: - print_undef_off_zero(&buff, mp->eh_deadline); - condlog(3, "%s: eh_deadline = %s %s", mp->alias, + print_undef_off_zero(&buff, pp->eh_deadline); + condlog(3, "%s: eh_deadline = %s %s", pp->dev, get_strbuf_str(&buff), origin); return 0; } diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h index 72a7e33c..152ca44c 100644 --- a/libmultipath/propsel.h +++ b/libmultipath/propsel.h @@ -16,9 +16,9 @@ int select_minio(struct config *conf, struct multipath *mp); int select_mode(struct config *conf, struct multipath *mp); int select_uid(struct config *conf, struct multipath *mp); int select_gid(struct config *conf, struct multipath *mp); -int select_fast_io_fail(struct config *conf, struct multipath *mp); -int select_dev_loss(struct config *conf, struct multipath *mp); -int select_eh_deadline(struct config *conf, struct multipath *mp); +int select_fast_io_fail(struct config *conf, struct path *pp); +int select_dev_loss(struct config *conf, struct path *pp); +int select_eh_deadline(struct config *conf, struct path *pp); int select_reservation_key(struct config *conf, struct multipath *mp); int select_retain_hwhandler (struct config *conf, struct multipath * mp); int select_detect_prio(struct config *conf, struct path * pp); diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 04cfdcdc..2c9be041 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -246,7 +246,6 @@ alloc_multipath (void) mpp->bestpg = 1; mpp->mpcontext = NULL; mpp->no_path_retry = NO_PATH_RETRY_UNDEF; - mpp->fast_io_fail = MP_FAST_IO_FAIL_UNSET; dm_multipath_to_gen(mpp)->ops = &dm_gen_multipath_ops; } return mpp; diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 3722e31b..a6749367 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -349,6 +349,9 @@ struct path { int marginal; int vpd_vendor_id; int recheck_wwid; + int fast_io_fail; + unsigned int dev_loss; + int eh_deadline; /* configlet pointers */ vector hwe; struct gen_path generic_path; @@ -376,7 +379,6 @@ struct multipath { int minio; int flush_on_last_del; int attribute_flags; - int fast_io_fail; int retain_hwhandler; int deferred_remove; bool in_recovery; @@ -395,8 +397,6 @@ struct multipath { int needs_paths_uevent; int ghost_delay; int ghost_delay_tick; - unsigned int dev_loss; - int eh_deadline; uid_t uid; gid_t gid; mode_t mode; From patchwork Tue Apr 12 01:59:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809946 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A5356C433F5 for ; Tue, 12 Apr 2022 02:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728814; 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=rb7GtDs/9/B7qelGyrpgE7dCcuyEOZiMGe4s2V6AAtE=; b=gsphJLL154u86ObzwPQfvZU7fXdIeM/j2L8sLtUKXRcu+DINwZQDrQ3nlIHTTA6GZ3yGG3 5MDCMGBrZuUpsnNJxEa/jZjpNVg2p6jLyEw0QlbFtCxsCBYlySMNfH40yftEk0P+xAFBu0 j1ui2GnD8eHRwr4pruQM+srLemXDARs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-626-udAm6nkiPsWDMomnBlnPnQ-1; Mon, 11 Apr 2022 22:00:11 -0400 X-MC-Unique: udAm6nkiPsWDMomnBlnPnQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64CDF805F67; Tue, 12 Apr 2022 02:00:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 504FF407F77F; Tue, 12 Apr 2022 02:00:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 168FC1940365; Tue, 12 Apr 2022 02:00:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D98EE194037A for ; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C56A740E80E0; Tue, 12 Apr 2022 02:00:07 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B733740E80F0; Tue, 12 Apr 2022 02:00:07 +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 23C2065u011848; Mon, 11 Apr 2022 21:00:06 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C206di011847; Mon, 11 Apr 2022 21:00:06 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:55 -0500 Message-Id: <1649728799-11790-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Subject: [dm-devel] [PATCH 5/9] libmultipath: check the hwentry pctable for path variables X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 For the config values that exist in the proctol subsection of the device configs, paths will now also check the pctable when checking a hwentry for a value. Values in a matching pcentry will be used in preference to values in that hwentry. Signed-off-by: Benjamin Marzinski --- libmultipath/propsel.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index d2d70090..762b7fcb 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -73,6 +73,8 @@ do { \ static const char default_origin[] = "(setting: multipath internal)"; static const char hwe_origin[] = "(setting: storage device configuration)"; +static const char hwe_pce_origin[] = + "(setting: storage device procotol section)"; static const char multipaths_origin[] = "(setting: multipath.conf multipaths section)"; static const char conf_origin[] = @@ -146,6 +148,28 @@ do { \ } \ } while (0) +#define pp_set_hwe_pce(var) \ +do { \ + struct hwentry *_hwe; \ + struct pcentry *_pce; \ + int _i, _j; \ + \ + vector_foreach_slot(pp->hwe, _hwe, _i) { \ + vector_foreach_slot(_hwe->pctable, _pce, _j) { \ + if (_pce->type == (int)bus_protocol_id(pp) && _pce->var) { \ + pp->var = _pce->var; \ + origin = hwe_pce_origin; \ + goto out; \ + } \ + } \ + if (_hwe->var) { \ + pp->var = _hwe->var; \ + origin = hwe_origin; \ + goto out; \ + } \ + } \ +} while (0) + int select_mode(struct config *conf, struct multipath *mp) { const char *origin; @@ -775,7 +799,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp) STRBUF_ON_STACK(buff); pp_set_ovr(fast_io_fail); - pp_set_hwe(fast_io_fail); + pp_set_hwe_pce(fast_io_fail); pp_set_conf(fast_io_fail); pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL); out: @@ -791,7 +815,7 @@ int select_dev_loss(struct config *conf, struct path *pp) STRBUF_ON_STACK(buff); pp_set_ovr(dev_loss); - pp_set_hwe(dev_loss); + pp_set_hwe_pce(dev_loss); pp_set_conf(dev_loss); pp->dev_loss = DEV_LOSS_TMO_UNSET; return 0; @@ -808,7 +832,7 @@ int select_eh_deadline(struct config *conf, struct path *pp) STRBUF_ON_STACK(buff); pp_set_ovr(eh_deadline); - pp_set_hwe(eh_deadline); + pp_set_hwe_pce(eh_deadline); pp_set_conf(eh_deadline); pp->eh_deadline = EH_DEADLINE_UNSET; /* not changing sysfs in default cause, so don't print anything */ From patchwork Tue Apr 12 01:59:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809952 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B49ABC433EF for ; Tue, 12 Apr 2022 02:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728864; 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=T2AqUfWJVhozQhpajO/ccDhlwKYb5XAgyZ1NDfRYjkM=; b=bHa2LY0itilNfHiLX5hfx+RynCAhoF6agMdwm6N5xyz2bdzV3BpX0HrpKfXGsu2a5Sxyi6 Rbvmzp196kN8+/jDp6NSI1fFnPosQCZCdxESkyZ0JVFTLvlMbixtFCW53KV6suahFLTrKY XL/m47uvpy7n7YFx8xdHqBzt5CfCcMU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-190-5BBmXYnJORKIAf0JHPKYKQ-1; Mon, 11 Apr 2022 22:00:13 -0400 X-MC-Unique: 5BBmXYnJORKIAf0JHPKYKQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A528386B8AF; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9194740CFD13; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 499691949762; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 22AA91940369 for ; Tue, 12 Apr 2022 02:00:09 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0688740E80F3; Tue, 12 Apr 2022 02:00:09 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECEE440E80F0; Tue, 12 Apr 2022 02:00:08 +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 23C207xq011852; Mon, 11 Apr 2022 21:00:07 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C207Lk011851; Mon, 11 Apr 2022 21:00:07 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:56 -0500 Message-Id: <1649728799-11790-7-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Subject: [dm-devel] [PATCH 6/9] libmultipath: make snprint_pctable indent a variable amount X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 Instead of always indenting two tabs, which is what is needed in for the protocol subsection of the device subsection, indent a variable amount. This will be needed in a future patch. Signed-off-by: Benjamin Marzinski --- libmultipath/print.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/libmultipath/print.c b/libmultipath/print.c index 46d231ed..093e43aa 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -1407,28 +1407,42 @@ int snprint_multipath_topology_json (struct strbuf *buff, } static int -snprint_pcentry (struct strbuf *buff, const struct pcentry *pce, +snprint_pcentry (struct strbuf *buff, int indent, const struct pcentry *pce, const struct keyword *rootkw) { int i, rc; struct keyword *kw; size_t initial_len = get_strbuf_len(buff); + STRBUF_ON_STACK(fmt); - if ((rc = append_strbuf_str(buff, "\t\tprotocol {\n")) < 0) + for (i = 0; i < indent; i++) + if ((rc = append_strbuf_str(&fmt, "\t")) < 0) + return rc; + if ((rc = append_strbuf_str(&fmt, "\t%k %v\n")) < 0) + return rc; + + for (i = 0; i < indent; i++) + if ((rc = append_strbuf_str(buff, "\t")) < 0) + return rc; + if ((rc = append_strbuf_str(buff, "protocol {\n")) < 0) return rc; iterate_sub_keywords(rootkw, kw, i) { - if ((rc = snprint_keyword(buff, "\t\t\t%k %v\n", kw, pce)) < 0) + if ((rc = snprint_keyword(buff, get_strbuf_str(&fmt), kw, + pce)) < 0) return rc; } - if ((rc = append_strbuf_str(buff, "\t\t}\n")) < 0) + for (i = 0; i < indent; i++) + if ((rc = append_strbuf_str(buff, "\t")) < 0) + return rc; + if ((rc = append_strbuf_str(buff, "}\n")) < 0) return rc; return get_strbuf_len(buff) - initial_len; } static int -snprint_pctable (const struct config *conf, struct strbuf *buff, +snprint_pctable (const struct config *conf, struct strbuf *buff, int indent, const struct _vector *pctable, const struct keyword *rootkw) { int i, rc; @@ -1439,7 +1453,7 @@ snprint_pctable (const struct config *conf, struct strbuf *buff, assert(rootkw); vector_foreach_slot(pctable, pce, i) { - if ((rc = snprint_pcentry(buff, pce, rootkw)) < 0) + if ((rc = snprint_pcentry(buff, indent, pce, rootkw)) < 0) return rc; } return get_strbuf_len(buff) - initial_len; @@ -1468,7 +1482,7 @@ snprint_hwentry (const struct config *conf, } if (hwe->pctable && - (rc = snprint_pctable(conf, buff, hwe->pctable, rootkw)) < 0) + (rc = snprint_pctable(conf, buff, 2, hwe->pctable, rootkw)) < 0) return rc; if ((rc = append_strbuf_str(buff, "\t}\n")) < 0) From patchwork Tue Apr 12 01:59:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809948 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 953F1C433EF for ; Tue, 12 Apr 2022 02:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728816; 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=snhFHRKL0CNB8DiUWuLQV292ncchE8m/2Xmy4neNKgw=; b=FXPkrbbnnIw/8pLovvXc5PhL8j6jon2vFeSJ317HTGS9Ca0YChAvsT7gviLIuS6SKrs3Kc 5mDM4Y4ULD2Lx6qj5lC7j0fi3IbIegjcaXuEmg3+2xkZKt7o8yFGdpgfLx8tTPd1Xax4v7 etGfPL3pqzUE2Anfai52Wv8O1Rq5r1M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-ObAkHDM1O1-lTomz-4DZ3Q-1; Mon, 11 Apr 2022 22:00:13 -0400 X-MC-Unique: ObAkHDM1O1-lTomz-4DZ3Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B1D69180138A; Tue, 12 Apr 2022 02:00:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0019401472; Tue, 12 Apr 2022 02:00:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7FEF51949762; Tue, 12 Apr 2022 02:00:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6872C1940373 for ; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4BFED401E02; Tue, 12 Apr 2022 02:00:10 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 36083401DFF; Tue, 12 Apr 2022 02:00:10 +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 23C2087h011856; Mon, 11 Apr 2022 21:00:09 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C208vR011855; Mon, 11 Apr 2022 21:00:08 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:57 -0500 Message-Id: <1649728799-11790-8-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Subject: [dm-devel] [PATCH 7/9] libmultipath: add procotol subsection to overrides X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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 Add a procotol subsection to the overrides section, just like the one in the device subsection. This allows users to a protocol specific parameters to all device configurations. Signed-off-by: Benjamin Marzinski --- libmultipath/dict.c | 76 ++++++++++++++++++++++++++++++++---------- libmultipath/print.c | 5 +++ libmultipath/propsel.c | 29 ++++++++++++++-- 3 files changed, 90 insertions(+), 20 deletions(-) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 04d86ee3..4923b8d2 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -386,6 +386,20 @@ snprint_ovr_ ## option (struct config *conf, struct strbuf *buff, \ return function (buff, conf->overrides->option); \ } +#define declare_ovr_pc_handler(option, function) \ +static int \ +ovr_pc_ ## option ## _handler (struct config *conf, vector strvec, \ + const char *file, int line_nr) \ +{ \ + struct pcentry *pce; \ + if (!conf->overrides || !conf->overrides->pctable) \ + return 1; \ + pce = VECTOR_LAST_SLOT(conf->overrides->pctable); \ + if (!pce) \ + return 1; \ + return function (strvec, &pce->option, file, line_nr); \ +} + #define declare_mp_handler(option, function) \ static int \ mp_ ## option ## _handler (struct config *conf, vector strvec, \ @@ -417,10 +431,10 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \ return function(buff, mpe->option); \ } -#define declare_pc_handler(option, function) \ +#define declare_hw_pc_handler(option, function) \ static int \ -pc_ ## option ## _handler (struct config *conf, vector strvec, \ - const char *file, int line_nr) \ +hw_pc_ ## option ## _handler (struct config *conf, vector strvec, \ + const char *file, int line_nr) \ { \ struct pcentry *pce; \ struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); \ @@ -1070,7 +1084,8 @@ declare_ovr_handler(fast_io_fail, set_undef_off_zero) declare_ovr_snprint(fast_io_fail, print_undef_off_zero) declare_hw_handler(fast_io_fail, set_undef_off_zero) declare_hw_snprint(fast_io_fail, print_undef_off_zero) -declare_pc_handler(fast_io_fail, set_undef_off_zero) +declare_hw_pc_handler(fast_io_fail, set_undef_off_zero) +declare_ovr_pc_handler(fast_io_fail, set_undef_off_zero) declare_pc_snprint(fast_io_fail, print_undef_off_zero) static int @@ -1109,7 +1124,8 @@ declare_ovr_handler(dev_loss, set_dev_loss) declare_ovr_snprint(dev_loss, print_dev_loss) declare_hw_handler(dev_loss, set_dev_loss) declare_hw_snprint(dev_loss, print_dev_loss) -declare_pc_handler(dev_loss, set_dev_loss) +declare_hw_pc_handler(dev_loss, set_dev_loss) +declare_ovr_pc_handler(dev_loss, set_dev_loss) declare_pc_snprint(dev_loss, print_dev_loss) declare_def_handler(eh_deadline, set_undef_off_zero) @@ -1118,7 +1134,8 @@ declare_ovr_handler(eh_deadline, set_undef_off_zero) declare_ovr_snprint(eh_deadline, print_undef_off_zero) declare_hw_handler(eh_deadline, set_undef_off_zero) declare_hw_snprint(eh_deadline, print_undef_off_zero) -declare_pc_handler(eh_deadline, set_undef_off_zero) +declare_hw_pc_handler(eh_deadline, set_undef_off_zero) +declare_ovr_pc_handler(eh_deadline, set_undef_off_zero) declare_pc_snprint(eh_deadline, print_undef_off_zero) static int @@ -1929,13 +1946,9 @@ declare_mp_snprint(alias, print_str) static int -protocol_handler(struct config *conf, vector strvec, const char *file, - int line_nr) +_protocol_handler(struct hwentry *hwe) { struct pcentry *pce; - struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); - if (!hwe) - return 1; if (!hwe->pctable && !(hwe->pctable = vector_alloc())) return 1; @@ -1952,6 +1965,27 @@ protocol_handler(struct config *conf, vector strvec, const char *file, return 0; } +static int +hw_protocol_handler(struct config *conf, vector strvec, const char *file, + int line_nr) +{ + struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable); + if (!hwe) + return 1; + + return _protocol_handler(hwe); +} + +static int +ovr_protocol_handler(struct config *conf, vector strvec, const char *file, + int line_nr) +{ + if (!conf->overrides) + return 1; + + return _protocol_handler(conf->overrides); +} + static int set_protocol_type(vector strvec, void *ptr, const char *file, int line_nr) { @@ -1986,7 +2020,8 @@ print_protocol_type(struct strbuf *buff, int type) return append_strbuf_quoted(buff, protocol_name[type]); } -declare_pc_handler(type, set_protocol_type) +declare_hw_pc_handler(type, set_protocol_type) +declare_ovr_pc_handler(type, set_protocol_type) declare_pc_snprint(type, print_protocol_type) /* @@ -2188,12 +2223,12 @@ init_keywords(vector keywords) install_keyword("all_tg_pt", &hw_all_tg_pt_handler, &snprint_hw_all_tg_pt); install_keyword("vpd_vendor", &hw_vpd_vendor_handler, &snprint_hw_vpd_vendor); install_keyword("recheck_wwid", &hw_recheck_wwid_handler, &snprint_hw_recheck_wwid); - install_keyword_multi("protocol", &protocol_handler, NULL); + install_keyword_multi("protocol", &hw_protocol_handler, NULL); install_sublevel(); - install_keyword("type", &pc_type_handler, &snprint_pc_type); - install_keyword("fast_io_fail_tmo", &pc_fast_io_fail_handler, &snprint_pc_fast_io_fail); - install_keyword("dev_loss_tmo", &pc_dev_loss_handler, &snprint_pc_dev_loss); - install_keyword("eh_deadline", &pc_eh_deadline_handler, &snprint_pc_eh_deadline); + install_keyword("type", &hw_pc_type_handler, &snprint_pc_type); + install_keyword("fast_io_fail_tmo", &hw_pc_fast_io_fail_handler, &snprint_pc_fast_io_fail); + install_keyword("dev_loss_tmo", &hw_pc_dev_loss_handler, &snprint_pc_dev_loss); + install_keyword("eh_deadline", &hw_pc_eh_deadline_handler, &snprint_pc_eh_deadline); install_sublevel_end(); install_sublevel_end(); @@ -2237,6 +2272,13 @@ init_keywords(vector keywords) install_keyword("ghost_delay", &ovr_ghost_delay_handler, &snprint_ovr_ghost_delay); install_keyword("all_tg_pt", &ovr_all_tg_pt_handler, &snprint_ovr_all_tg_pt); install_keyword("recheck_wwid", &ovr_recheck_wwid_handler, &snprint_ovr_recheck_wwid); + install_keyword_multi("protocol", &ovr_protocol_handler, NULL); + install_sublevel(); + install_keyword("type", &ovr_pc_type_handler, &snprint_pc_type); + install_keyword("fast_io_fail_tmo", &ovr_pc_fast_io_fail_handler, &snprint_pc_fast_io_fail); + install_keyword("dev_loss_tmo", &ovr_pc_dev_loss_handler, &snprint_pc_dev_loss); + install_keyword("eh_deadline", &ovr_pc_eh_deadline_handler, &snprint_pc_eh_deadline); + install_sublevel_end(); install_keyword_root("multipaths", &multipaths_handler); install_keyword_multi("multipath", &multipath_handler, NULL); diff --git a/libmultipath/print.c b/libmultipath/print.c index 093e43aa..93df0b0c 100644 --- a/libmultipath/print.c +++ b/libmultipath/print.c @@ -1618,6 +1618,11 @@ static int snprint_overrides(const struct config *conf, struct strbuf *buff, if ((rc = snprint_keyword(buff, "\t%k %v\n", kw, NULL)) < 0) return rc; } + + if (overrides->pctable && + (rc = snprint_pctable(conf, buff, 1, overrides->pctable, + rootkw)) < 0) + return rc; out: if ((rc = append_strbuf_str(buff, "}\n")) < 0) return rc; diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 762b7fcb..90a160f1 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -81,6 +81,8 @@ static const char conf_origin[] = "(setting: multipath.conf defaults/devices section)"; static const char overrides_origin[] = "(setting: multipath.conf overrides section)"; +static const char overrides_pce_origin[] = + "(setting: multipath.conf overrides protocol section)"; static const char cmdline_origin[] = "(setting: multipath command line [-p] flag)"; static const char autodetect_origin[] = @@ -170,6 +172,27 @@ do { \ } \ } while (0) +#define pp_set_ovr_pce(var) \ +do { \ + struct pcentry *_pce; \ + int _i; \ + \ + if (conf->overrides) { \ + vector_foreach_slot(conf->overrides->pctable, _pce, _i) { \ + if (_pce->type == (int)bus_protocol_id(pp) && _pce->var) { \ + pp->var = _pce->var; \ + origin = overrides_pce_origin; \ + goto out; \ + } \ + } \ + if (conf->overrides->var) { \ + pp->var = conf->overrides->var; \ + origin = overrides_origin; \ + goto out; \ + } \ + } \ +} while (0) + int select_mode(struct config *conf, struct multipath *mp) { const char *origin; @@ -798,7 +821,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp) const char *origin; STRBUF_ON_STACK(buff); - pp_set_ovr(fast_io_fail); + pp_set_ovr_pce(fast_io_fail); pp_set_hwe_pce(fast_io_fail); pp_set_conf(fast_io_fail); pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL); @@ -814,7 +837,7 @@ int select_dev_loss(struct config *conf, struct path *pp) const char *origin; STRBUF_ON_STACK(buff); - pp_set_ovr(dev_loss); + pp_set_ovr_pce(dev_loss); pp_set_hwe_pce(dev_loss); pp_set_conf(dev_loss); pp->dev_loss = DEV_LOSS_TMO_UNSET; @@ -831,7 +854,7 @@ int select_eh_deadline(struct config *conf, struct path *pp) const char *origin; STRBUF_ON_STACK(buff); - pp_set_ovr(eh_deadline); + pp_set_ovr_pce(eh_deadline); pp_set_hwe_pce(eh_deadline); pp_set_conf(eh_deadline); pp->eh_deadline = EH_DEADLINE_UNSET; From patchwork Tue Apr 12 01:59:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809950 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 394A8C433FE for ; Tue, 12 Apr 2022 02:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728818; 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=V1Rw4ur07OthX2qkJZ6vxx6QSVNv3QzhXk38Dz88XxE=; b=aK6UUGi6CKcGEgZcCcbmSLfVffVQxsmLntcgCK/pLrROnM2cVnRe9vojKQUodVVClLEq+C UuvWQe9jpdnHOQOxpQjtfVrFGILAycMTykUKL5SDhmDMCWSQYxNN9YyrZKrbaJNp0L9iUz A/8c8YBwLQ1FdcMT61+n1Z9ZothXCE4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-197-PlbZ14FhM_qI5STW3g2L5g-1; Mon, 11 Apr 2022 22:00:15 -0400 X-MC-Unique: PlbZ14FhM_qI5STW3g2L5g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 34822811E81; Tue, 12 Apr 2022 02:00:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22328401DFF; Tue, 12 Apr 2022 02:00:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E2F751949762; Tue, 12 Apr 2022 02:00:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 85F5D1940366 for ; Tue, 12 Apr 2022 02:00:11 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 79D3940E80F0; Tue, 12 Apr 2022 02:00:11 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B48040E80E0; Tue, 12 Apr 2022 02:00:11 +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 23C20A4E011860; Mon, 11 Apr 2022 21:00:10 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C209fv011859; Mon, 11 Apr 2022 21:00:09 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:58 -0500 Message-Id: <1649728799-11790-9-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Subject: [dm-devel] [PATCH 8/9] libmultipath: fix eh_deadline documentation X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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 Signed-off-by: Benjamin Marzinski --- multipath/multipath.conf.5 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 605b46e0..97695da4 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -1636,6 +1636,8 @@ section: .TP .B dev_loss_tmo .TP +.B eh_deadline +.TP .B flush_on_last_del .TP .B user_friendly_names @@ -1722,6 +1724,8 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections: .TP .B dev_loss_tmo .TP +.B eh_deadline +.TP .B user_friendly_names .TP .B retain_attached_hw_handler From patchwork Tue Apr 12 01:59:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12809951 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D561EC433EF for ; Tue, 12 Apr 2022 02:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649728828; 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=F6HgnrNRVqmQ9Y/j3CEGkJla3u5XCY/IsBqixFua+lE=; b=JhWG5OX6wzohqKmIToVs21rWrn49VLnNZUbjYh5cKliCDM+CrRZLASxaydfqu1TJ2scFZB cXxI9n5PW11LChQ83gDTrspIpoeudWvHcZSj45bVo+sYNON2Cqu9dc/hCg+67cSLp2TTjL KDJhedYBrp/V5oPV0242QhRCs65Cb6Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-TnoDk_KoNUq6twSSzrODAw-1; Mon, 11 Apr 2022 22:00:27 -0400 X-MC-Unique: TnoDk_KoNUq6twSSzrODAw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2644D8038E3; Tue, 12 Apr 2022 02:00:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12CC92166B5D; Tue, 12 Apr 2022 02:00:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF9511940365; Tue, 12 Apr 2022 02:00:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6EA751947BBF for ; Tue, 12 Apr 2022 02:00:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3F2717C2F; Tue, 12 Apr 2022 02:00:24 +0000 (UTC) Received: from octiron.msp.redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC0587C2B; Tue, 12 Apr 2022 02:00:12 +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 23C20BGs011864; Mon, 11 Apr 2022 21:00:11 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 23C20B2D011863; Mon, 11 Apr 2022 21:00:11 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 11 Apr 2022 20:59:59 -0500 Message-Id: <1649728799-11790-10-git-send-email-bmarzins@redhat.com> In-Reply-To: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> References: <1649728799-11790-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Subject: [dm-devel] [PATCH 9/9] libmultipath: Add documentation for the protocol subsection X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: device-mapper development , Martin Wilck MIME-Version: 1.0 Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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 Signed-off-by: Benjamin Marzinski --- multipath/multipath.conf.5 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 97695da4..dab1d58f 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -1678,6 +1678,41 @@ section: .RE .PD .LP +The device subsection also recognizes the optional \fIprotocol\fR subsection. A +single device subsection can contain multiple protocol subsections. Devices are +matched against the protocol subsection using the mandatory \fItype\fR +attribute. Attributes in a matching protocol subsection take precedence over +attributes in the containing device subsection. If there are multiple matching +protocol subsections within a device subsection, later entries take precedence. +If there are multiple matching device subsections, attributes in later device +subsections still take precedence over attributes in a protocol subsection of +an earlier device subsection. +.TP +.B protocol subsection +The protocol subsection recognizes the following mandatory attribute: +.RS +.TP +.B type +The protocol string of the path device. The possible values are \fIscsi:fcp\fR, +\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR, +\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR, +\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR. This is +\fBnot\fR a regular expression. the path device protcol string must match +exactly. The protocol that a path is using can be viewed by running +\fBmultipathd show paths format "%d %P"\fR +.LP +The following attributes are optional; if not set, the default values are taken +from the containing \fIdevice\fR subsection: +.sp 1 +.PD .1v +.RS +.TP +.B fast_io_fail_tmo +.TP +.B dev_loss_tmo +.TP +.B eh_deadline +.PD . . .\" ---------------------------------------------------------------------------- @@ -1764,6 +1799,9 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections: .RE .PD .LP +The overrides section also recognizes the optional \fIprotocol\fR subsection +and can contain multiple protocol subsections. For a full description of this +subsection please see its description in the \fIdevices\fR section. . . .\" ----------------------------------------------------------------------------