From patchwork Thu Oct 11 22:27:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10637567 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AFF6157A for ; Thu, 11 Oct 2018 22:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EADAB2BBE8 for ; Thu, 11 Oct 2018 22:28:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF4782BBF3; Thu, 11 Oct 2018 22:28:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FC5D2BBE8 for ; Thu, 11 Oct 2018 22:28:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C778308404C; Thu, 11 Oct 2018 22:28:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5ACC27058F; Thu, 11 Oct 2018 22:28:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2024A180BADA; Thu, 11 Oct 2018 22:28:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9BMSDKd016895 for ; Thu, 11 Oct 2018 18:28:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 43202116D89; Thu, 11 Oct 2018 22:28:13 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 37AC9116D83; Thu, 11 Oct 2018 22:28:13 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35E543001384; Thu, 11 Oct 2018 22:28:12 +0000 (UTC) Received: from apollon.suse.de.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Thu, 11 Oct 2018 16:28:03 -0600 From: Martin Wilck To: Christophe Varoqui Date: Fri, 12 Oct 2018 00:27:01 +0200 Message-Id: <20181011222707.3631-16-mwilck@suse.com> In-Reply-To: <20181011222707.3631-1-mwilck@suse.com> References: <20181011222707.3631-1-mwilck@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 11 Oct 2018 22:28:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 11 Oct 2018 22:28:12 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Martin Wilck Subject: [dm-devel] [PATCH 15/21] libmultipath: rdac checker: leave unsupported paths alone X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 11 Oct 2018 22:28:24 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP A checker shouldn't set the path state to PATH_DOWN if it fails to obtain information about the path in the first place. Add logic to the checker to distinguish a failed path from an unsupported path. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/checkers/rdac.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/libmultipath/checkers/rdac.c b/libmultipath/checkers/rdac.c index 266f8e10..8a3b73ec 100644 --- a/libmultipath/checkers/rdac.c +++ b/libmultipath/checkers/rdac.c @@ -26,6 +26,7 @@ #define SCSI_COMMAND_TERMINATED 0x22 #define SG_ERR_DRIVER_SENSE 0x08 #define RECOVERED_ERROR 0x01 +#define ILLEGAL_REQUEST 0x05 #define CURRENT_PAGE_CODE_VALUES 0 @@ -162,14 +163,14 @@ retry: io_hdr.sbp = sense_b; io_hdr.timeout = timeout * 1000; - if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) - return 1; + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0 && errno == ENOTTY) + return PATH_WILD; /* treat SG_ERR here to get rid of sg_err.[ch] */ io_hdr.status &= 0x7e; if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && (0 == io_hdr.driver_status)) - return 0; + return PATH_UP; /* check if we need to retry this error */ if (io_hdr.info & SG_INFO_OK_MASK) { @@ -198,10 +199,14 @@ retry: else sense_key = sense_buffer[2] & 0xf; if (RECOVERED_ERROR == sense_key) - return 0; + return PATH_UP; + else if (ILLEGAL_REQUEST == sense_key) + return PATH_WILD; + condlog(1, "rdac checker: INQUIRY failed with sense key %02x", + sense_key); } } - return 1; + return PATH_DOWN; } struct volume_access_inq @@ -290,12 +295,14 @@ int libcheck_check(struct checker * c) inqfail = 0; memset(&inq, 0, sizeof(struct volume_access_inq)); - if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq), - c->timeout)) { - ret = PATH_DOWN; + ret = do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq), + c->timeout); + if (ret != PATH_UP) { inqfail = 1; goto done; - } else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) { + } + + if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) { /* LUN not connected*/ ret = PATH_DOWN; goto done; @@ -332,6 +339,9 @@ int libcheck_check(struct checker * c) done: switch (ret) { + case PATH_WILD: + c->msgid = CHECKER_MSGID_UNSUPPORTED; + break; case PATH_DOWN: c->msgid = (inqfail ? RDAC_MSGID_INQUIRY_FAILED : checker_msg_string(&inq));