From patchwork Fri Jul 28 19:05:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13332587 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 BC18AC0015E for ; Fri, 28 Jul 2023 19:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690571179; 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=PSYAiZjvTlqfumFbctQcQJCLnyYycCWgl8WZjdGMLY8=; b=IqRl/J03OZ1Yu+C/eYmeOYD8CodhgGX9M4/V/w6rByU58Yd0SDBGyNH7wjaFwqvVkTIeqV cQUV0rsq9OvFsRar4xRDYe/R0/uBa/yV7nI/djj+NtmYs0FAoiRp1ltn1mX4M5ZWqjMTVD 79MH8w27kd7SLdeHLMPMC2B5oRGi988= 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-684-6y0-bxxsPYqgG865aAULLQ-1; Fri, 28 Jul 2023 15:06:15 -0400 X-MC-Unique: 6y0-bxxsPYqgG865aAULLQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32602185A7AE; Fri, 28 Jul 2023 19:06:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B93C145414F; Fri, 28 Jul 2023 19:06:08 +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 2EF3E19452D8; Fri, 28 Jul 2023 19:06:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 37B1B194658C for ; Fri, 28 Jul 2023 19:06:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 178BCC584E3; Fri, 28 Jul 2023 19:06: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 F2E9DC584E0; Fri, 28 Jul 2023 19:06: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 36SJ5xnT008325; Fri, 28 Jul 2023 14:05:59 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 36SJ5xeR008324; Fri, 28 Jul 2023 14:05:59 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Fri, 28 Jul 2023 14:05:52 -0500 Message-Id: <1690571155-8283-2-git-send-email-bmarzins@redhat.com> In-Reply-To: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> References: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Subject: [dm-devel] [RFC PATCH 1/4] libmultipath: don't bother to reset default timeout value 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 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com by the time get_state() is rechecking the sysfs timeout value, c->timeout has already been set. The only reason why this check exists is to deal with the possiblity that the sysfs value has changed. If the sysfs value doesn't exist (which likely means that the device is not a scsi device), then there's no reason to reset the default value, since that can't have changed. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/discovery.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 5626d48d..2b1a11d5 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1965,9 +1965,8 @@ get_state (struct path * pp, struct config *conf, int daemon, int oldstate) checker_set_async(c); else checker_set_sync(c); - if (!conf->checker_timeout && - sysfs_get_timeout(pp, &(c->timeout)) <= 0) - c->timeout = DEF_TIMEOUT; + if (!conf->checker_timeout) + sysfs_get_timeout(pp, &(c->timeout)); state = checker_check(c, oldstate); condlog(3, "%s: %s state = %s", pp->dev, checker_name(c), checker_state_name(state)); From patchwork Fri Jul 28 19:05:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13332588 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 22876C00528 for ; Fri, 28 Jul 2023 19:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690571180; 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=iKst4/zyJAcLIfiN2voAkIMi/OJYkFjox7JWDjUOYcc=; b=Rruh7+Y/E+O92emO03ilcgLKIl1K/yPnHqz+6SuMndPbAMbOktIj4v7f3WrpxiyEjVLunV TIxpXaYMmwEXqURYfrbag4Q1yYDtfrA0t6d9FZHRMd4frkYXJGNGXy3LjbVzq1pBKfbuF7 +1yBelbHApU+zY/Ai6JGgkGzmcmQkzQ= 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-641-ZdCh9XRGMCqIEGRTno-VkA-1; Fri, 28 Jul 2023 15:06:16 -0400 X-MC-Unique: ZdCh9XRGMCqIEGRTno-VkA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8466830DBD; Fri, 28 Jul 2023 19:06:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4C4EC584E8; Fri, 28 Jul 2023 19:06:08 +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 6F4A31946A6C; Fri, 28 Jul 2023 19:06:08 +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 3FE0F19451C6 for ; Fri, 28 Jul 2023 19:06:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2B77D40C2072; Fri, 28 Jul 2023 19:06: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 0B29740C2071; Fri, 28 Jul 2023 19:06: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 36SJ602C008329; Fri, 28 Jul 2023 14:06:00 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 36SJ605H008328; Fri, 28 Jul 2023 14:06:00 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Fri, 28 Jul 2023 14:05:53 -0500 Message-Id: <1690571155-8283-3-git-send-email-bmarzins@redhat.com> In-Reply-To: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> References: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Subject: [dm-devel] [RFC PATCH 2/4] libmultipath: make prioritizer timeouts work like checker timeouts 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 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Multipath's prioritizers previously didn't use the sysfs timeout for scsi devices, and used a prioritizer specific default timeout (although in practice, all the prioritizers except hds used 60 seconds). Now prioritizers deal with timeouts the same way as the checkers. They first use checker_time if set, then use the sysfs tiemout for scsi devices, or 30 seconds for non-scsi devices. Signed-off-by: Benjamin Marzinski --- libmultipath/prio.c | 14 +++++++++----- libmultipath/prio.h | 3 +-- libmultipath/prioritizers/alua.c | 2 +- libmultipath/prioritizers/alua_rtpg.c | 5 ++--- libmultipath/prioritizers/emc.c | 5 +++-- libmultipath/prioritizers/hds.c | 4 ++-- libmultipath/prioritizers/hp_sw.c | 4 ++-- libmultipath/prioritizers/ontap.c | 7 +++---- libmultipath/prioritizers/rdac.c | 4 ++-- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/libmultipath/prio.c b/libmultipath/prio.c index cdd37529..69b71578 100644 --- a/libmultipath/prio.c +++ b/libmultipath/prio.c @@ -3,20 +3,24 @@ #include #include #include +#include #include "debug.h" #include "util.h" #include "prio.h" +#include "structs.h" +#include "discovery.h" static const char * const prio_dir = MULTIPATH_DIR; static LIST_HEAD(prioritizers); -unsigned int get_prio_timeout(unsigned int timeout_ms, - unsigned int default_timeout) +unsigned int get_prio_timeout(struct path *pp, unsigned int timeout) { - if (timeout_ms) - return timeout_ms; - return default_timeout; + if (timeout) + return timeout; + timeout = DEF_TIMEOUT; + sysfs_get_timeout(pp, &timeout); + return timeout * 1000; } int init_prio(void) diff --git a/libmultipath/prio.h b/libmultipath/prio.h index 184bf65f..20808fd7 100644 --- a/libmultipath/prio.h +++ b/libmultipath/prio.h @@ -52,8 +52,7 @@ struct prio { int (*getprio)(struct path *, char *, unsigned int); }; -unsigned int get_prio_timeout(unsigned int checker_timeout, - unsigned int default_timeout); +unsigned int get_prio_timeout(struct path *pp, unsigned int checker_timeout); int init_prio(void); void cleanup_prio (void); struct prio * add_prio (const char *); diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c index a28bca05..d3ba367f 100644 --- a/libmultipath/prioritizers/alua.c +++ b/libmultipath/prioritizers/alua.c @@ -109,7 +109,7 @@ int getprio (struct path * pp, char * args, unsigned int timeout) return -ALUA_PRIO_NO_INFORMATION; exclusive_pref = get_exclusive_pref_arg(args); - rc = get_alua_info(pp, timeout); + rc = get_alua_info(pp, get_prio_timeout(pp, timeout)); if (rc >= 0) { aas = (rc & 0x0f); priopath = (rc & 0x80); diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c index 2db91536..49982545 100644 --- a/libmultipath/prioritizers/alua_rtpg.c +++ b/libmultipath/prioritizers/alua_rtpg.c @@ -31,7 +31,6 @@ #include "alua_rtpg.h" #define SENSE_BUFF_LEN 32 -#define SGIO_TIMEOUT 60000 #define PRINT_DEBUG(f, a...) \ condlog(4, "alua: " f, ##a) @@ -162,7 +161,7 @@ retry: hdr.dxfer_len = resplen; hdr.sbp = sense; hdr.mx_sb_len = sizeof(sense); - hdr.timeout = get_prio_timeout(timeout, SGIO_TIMEOUT); + hdr.timeout = timeout; if (ioctl(fd, SG_IO, &hdr) < 0) { PRINT_DEBUG("do_inquiry: IOCTL failed!"); @@ -316,7 +315,7 @@ retry: hdr.dxfer_len = resplen; hdr.mx_sb_len = sizeof(sense); hdr.sbp = sense; - hdr.timeout = get_prio_timeout(timeout, SGIO_TIMEOUT); + hdr.timeout = timeout; if (ioctl(fd, SG_IO, &hdr) < 0) { condlog(2, "%s: sg ioctl failed: %s", diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c index 3b63cca0..97fde31b 100644 --- a/libmultipath/prioritizers/emc.c +++ b/libmultipath/prioritizers/emc.c @@ -31,7 +31,7 @@ int emc_clariion_prio(const char *dev, int fd, unsigned int timeout) io_hdr.dxferp = sense_buffer; io_hdr.cmdp = inqCmdBlk; io_hdr.sbp = sb; - io_hdr.timeout = get_prio_timeout(timeout, 60000); + io_hdr.timeout = timeout; io_hdr.pack_id = 0; if (ioctl(fd, SG_IO, &io_hdr) < 0) { pp_emc_log(0, "sending query command failed"); @@ -84,5 +84,6 @@ out: int getprio (struct path *pp, __attribute__((unused)) char *args, unsigned int timeout) { - return emc_clariion_prio(pp->dev, pp->fd, timeout); + return emc_clariion_prio(pp->dev, pp->fd, + get_prio_timeout(pp, timeout)); } diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c index d569f2d7..13f497cc 100644 --- a/libmultipath/prioritizers/hds.c +++ b/libmultipath/prioritizers/hds.c @@ -114,7 +114,7 @@ int hds_modular_prio (const char *dev, int fd, unsigned int timeout) io_hdr.dxferp = inqBuff; io_hdr.cmdp = inqCmdBlk; io_hdr.sbp = sense_buffer; - io_hdr.timeout = get_prio_timeout(timeout, 2000); /* TimeOut = 2 seconds */ + io_hdr.timeout = timeout; if (ioctl (fd, SG_IO, &io_hdr) < 0) { pp_hds_log(0, "SG_IO error"); @@ -171,5 +171,5 @@ int hds_modular_prio (const char *dev, int fd, unsigned int timeout) int getprio (struct path * pp, __attribute__((unused)) char *args, unsigned int timeout) { - return hds_modular_prio(pp->dev, pp->fd, timeout); + return hds_modular_prio(pp->dev, pp->fd, get_prio_timeout(pp, timeout)); } diff --git a/libmultipath/prioritizers/hp_sw.c b/libmultipath/prioritizers/hp_sw.c index 5b85ad2e..b4cbc58f 100644 --- a/libmultipath/prioritizers/hp_sw.c +++ b/libmultipath/prioritizers/hp_sw.c @@ -46,7 +46,7 @@ int hp_sw_prio(const char *dev, int fd, unsigned int timeout) io_hdr.dxfer_direction = SG_DXFER_NONE; io_hdr.cmdp = turCmdBlk; io_hdr.sbp = sb; - io_hdr.timeout = get_prio_timeout(timeout, 60000); + io_hdr.timeout = timeout; io_hdr.pack_id = 0; retry: if (ioctl(fd, SG_IO, &io_hdr) < 0) { @@ -98,5 +98,5 @@ out: int getprio (struct path *pp, __attribute__((unused)) char *args, unsigned int timeout) { - return hp_sw_prio(pp->dev, pp->fd, timeout); + return hp_sw_prio(pp->dev, pp->fd, get_prio_timeout(pp, timeout)); } diff --git a/libmultipath/prioritizers/ontap.c b/libmultipath/prioritizers/ontap.c index 262e69d2..b9860974 100644 --- a/libmultipath/prioritizers/ontap.c +++ b/libmultipath/prioritizers/ontap.c @@ -28,7 +28,6 @@ #define INQUIRY_CMDLEN 6 #define DEFAULT_PRIOVAL 10 #define RESULTS_MAX 256 -#define SG_TIMEOUT 60000 #define pp_ontap_log(prio, fmt, args...) \ condlog(prio, "%s: ontap prio: " fmt, dev, ##args) @@ -90,7 +89,7 @@ static int send_gva(const char *dev, int fd, unsigned char pg, io_hdr.dxferp = results; io_hdr.cmdp = cdb; io_hdr.sbp = sb; - io_hdr.timeout = get_prio_timeout(timeout, SG_TIMEOUT); + io_hdr.timeout = timeout; io_hdr.pack_id = 0; if (ioctl(fd, SG_IO, &io_hdr) < 0) { pp_ontap_log(0, "SG_IO ioctl failed, errno=%d", errno); @@ -142,7 +141,7 @@ static int get_proxy(const char *dev, int fd, unsigned int timeout) io_hdr.dxferp = results; io_hdr.cmdp = cdb; io_hdr.sbp = sb; - io_hdr.timeout = get_prio_timeout(timeout, SG_TIMEOUT); + io_hdr.timeout = timeout; io_hdr.pack_id = 0; if (ioctl(fd, SG_IO, &io_hdr) < 0) { pp_ontap_log(0, "ioctl sending inquiry command failed, " @@ -244,5 +243,5 @@ prio_select: int getprio (struct path *pp, __attribute__((unused)) char *args, unsigned int timeout) { - return ontap_prio(pp->dev, pp->fd, timeout); + return ontap_prio(pp->dev, pp->fd, get_prio_timeout(pp, timeout)); } diff --git a/libmultipath/prioritizers/rdac.c b/libmultipath/prioritizers/rdac.c index 92a2fb85..0faa8155 100644 --- a/libmultipath/prioritizers/rdac.c +++ b/libmultipath/prioritizers/rdac.c @@ -31,7 +31,7 @@ int rdac_prio(const char *dev, int fd, unsigned int timeout) io_hdr.dxferp = sense_buffer; io_hdr.cmdp = inqCmdBlk; io_hdr.sbp = sb; - io_hdr.timeout = get_prio_timeout(timeout, 60000); + io_hdr.timeout = timeout; io_hdr.pack_id = 0; if (ioctl(fd, SG_IO, &io_hdr) < 0) { pp_rdac_log(0, "sending inquiry command failed"); @@ -94,5 +94,5 @@ out: int getprio (struct path *pp, __attribute__((unused)) char *args, unsigned int timeout) { - return rdac_prio(pp->dev, pp->fd, timeout); + return rdac_prio(pp->dev, pp->fd, get_prio_timeout(pp, timeout)); } From patchwork Fri Jul 28 19:05:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13332589 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 2AD20C0015E for ; Fri, 28 Jul 2023 19:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690571184; 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=rnH+TLPxKDAiM0cEW4rsbseIThH8OSmjZJ39BuExleI=; b=EndkQOn2DsWUoN1W2OQQmcWCzq4SfjhqLWyN+b38ErMrGCRYnO6D0UPEgfSpJ7a9tcP9Eg kRj5u1mu/AGS0HUD2lkUe4Egj2k3HJRVUbAJW2edDoUYM3VSGEffxXNm2Pi/ygVjw2z2h5 lieryXZgcfFXCSouW5vcl8mY43nsHDs= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-330-_P-uO-hOO3Okhpe8e-obdA-1; Fri, 28 Jul 2023 15:06:20 -0400 X-MC-Unique: _P-uO-hOO3Okhpe8e-obdA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1ABE13801BDD; Fri, 28 Jul 2023 19:06:13 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 030BD1454147; Fri, 28 Jul 2023 19:06: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 96C131946A6A; Fri, 28 Jul 2023 19:06:12 +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 3DF8C194658C for ; Fri, 28 Jul 2023 19:06:12 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2E2CA492B03; Fri, 28 Jul 2023 19:06:12 +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 15460492B02; Fri, 28 Jul 2023 19:06: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 36SJ61Gv008333; Fri, 28 Jul 2023 14:06:01 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 36SJ61XJ008332; Fri, 28 Jul 2023 14:06:01 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Fri, 28 Jul 2023 14:05:54 -0500 Message-Id: <1690571155-8283-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> References: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Subject: [dm-devel] [RFC PATCH 3/4] libmultipath: fix timeouts for detect_alua() 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 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com detect_alua calls prioritizer functions that expect the timeout to be in milliseconds instead of seconds. Fix this and also respect the checker_timeout setting. Signed-off-by: Benjamin Marzinski --- libmultipath/discovery.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 2b1a11d5..9392134f 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1016,15 +1016,17 @@ detect_alua(struct path * pp) int ret; int tpgs; unsigned int timeout; + struct config *conf; if (pp->bus != SYSFS_BUS_SCSI) { pp->tpgs = TPGS_NONE; return; } - - if (sysfs_get_timeout(pp, &timeout) <= 0) - timeout = DEF_TIMEOUT; + conf = get_multipath_config(); + timeout = conf->checker_timeout * 1000; + put_multipath_config(conf); + timeout = get_prio_timeout(pp, timeout); tpgs = get_target_port_group_support(pp, timeout); if (tpgs == -RTPG_INQUIRY_FAILED) From patchwork Fri Jul 28 19:05:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 13332590 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 E44B2C001DF for ; Fri, 28 Jul 2023 19:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690571191; 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=iV8fNpOGPvBWF8a6/XIbDja4eBnmqs4oEvhSzrLM0lo=; b=cAW+6ygo0fCHt0EFG/ulfwvDYoB6IJJpGcCMa6ngjor3ARu4Ul20P55mjgwSmDPdq0zz41 m3GYE8WKjBojC5KyReQ63fnr92/pxno50pjG6pZAOsZZIgFsuGeWBsegwV+udtrU8erEQ+ cdhfeCjBmRMKc5yWOfroL3JxmE8s2GM= 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-678-UL4x20y-PxWrEAXtmxFnew-1; Fri, 28 Jul 2023 15:06:27 -0400 X-MC-Unique: UL4x20y-PxWrEAXtmxFnew-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 7FD3B186E39D; Fri, 28 Jul 2023 19:06:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B99B4A9004; Fri, 28 Jul 2023 19:06:15 +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 364441946A6A; Fri, 28 Jul 2023 19:06:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 68180194658C for ; Fri, 28 Jul 2023 19:06:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 59BD1C584E0; Fri, 28 Jul 2023 19:06:13 +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 43BD2C584E8; Fri, 28 Jul 2023 19:06:13 +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 36SJ67Xw008338; Fri, 28 Jul 2023 14:06:07 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 36SJ670D008337; Fri, 28 Jul 2023 14:06:07 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Fri, 28 Jul 2023 14:05:55 -0500 Message-Id: <1690571155-8283-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> References: <1690571155-8283-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Subject: [dm-devel] [RFC PATCH 4/4] libmultipath: fix timeouts for path_latency prioritizer 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 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com The path_latency prioritizer didn't call get_prio_timeout, so that the timeout could possibly be 0. Also, it was assuming that the timeout was in seconds, instead of milliseconds. Signed-off-by: Benjamin Marzinski --- libmultipath/prioritizers/path_latency.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmultipath/prioritizers/path_latency.c b/libmultipath/prioritizers/path_latency.c index 2f5be9b9..d48535d2 100644 --- a/libmultipath/prioritizers/path_latency.c +++ b/libmultipath/prioritizers/path_latency.c @@ -107,7 +107,7 @@ static void cleanup_directio_read(int fd, char *buf, int restore_flags) static int do_directio_read(int fd, unsigned int timeout, char *buf, int sz) { fd_set read_fds; - struct timeval tm = { .tv_sec = timeout }; + struct timeval tm = { .tv_sec = timeout / 1000 }; int ret; int num_read; @@ -247,7 +247,8 @@ int getprio(struct path *pp, char *args, unsigned int timeout) (void)clock_gettime(CLOCK_MONOTONIC, &tv_before); - if (do_directio_read(pp->fd, timeout, buf, blksize)) { + if (do_directio_read(pp->fd, get_prio_timeout(pp, timeout), + buf, blksize)) { pp_pl_log(0, "%s: path down", pp->dev); cleanup_directio_read(pp->fd, buf, restore_flags); return -1;