From patchwork Fri Jan 13 09:43:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13100384 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 0BEA8C54EBE for ; Fri, 13 Jan 2023 09:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673603027; 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=aH3IBnqat0rUyZXn4OeEt+8kYRVI7co78J3rB0yJbi0=; b=ZP0vD9ALNxvepTPTlfjTnBYaena7bTb+nXl59n8NM4K+jxYsT5uBngdDsfGQ9pLwZr8asK Uy/e59WXhKvqNfTFCujkRuW2yWjQxnED2xQ4UIM8BE0GKdl81MXB0Lj/wQgIh8Y8IputLl Mg1ZUdYrzbArJNxQLhts+k+ms63SWcM= 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-628-nixDTvsdNrqAm9DD5hXB-w-1; Fri, 13 Jan 2023 04:43:43 -0500 X-MC-Unique: nixDTvsdNrqAm9DD5hXB-w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78C2E101A52E; Fri, 13 Jan 2023 09:43:41 +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 672BD2026D68; Fri, 13 Jan 2023 09:43:41 +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 5A3491947055; Fri, 13 Jan 2023 09:43:41 +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 34DB81946A78 for ; Fri, 13 Jan 2023 09:43:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1850E492B06; Fri, 13 Jan 2023 09:43:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10C72492B05 for ; Fri, 13 Jan 2023 09:43:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB449857A84 for ; Fri, 13 Jan 2023 09:43:39 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-517-0LU14MtzN2CL-ZQQiHyRqg-1; Fri, 13 Jan 2023 04:43:38 -0500 X-MC-Unique: 0LU14MtzN2CL-ZQQiHyRqg-1 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E3FFD5D7AD; Fri, 13 Jan 2023 09:43:36 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B7DC81358A; Fri, 13 Jan 2023 09:43:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kA1aK8gnwWOafQAAMHmgww (envelope-from ); Fri, 13 Jan 2023 09:43:36 +0000 From: mwilck@suse.com To: Christophe Varoqui , Benjamin Marzinski Date: Fri, 13 Jan 2023 10:43:10 +0100 Message-Id: <20230113094310.20367-3-mwilck@suse.com> In-Reply-To: <20230113094310.20367-1-mwilck@suse.com> References: <20230113094310.20367-1-mwilck@suse.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Subject: [dm-devel] [PATCH 2/2] libmultipath: pathinfo: don't fail for devices lacking INQUIRY properties 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: dm-devel@redhat.com, Martin Wilck Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Martin Wilck Some SAS devices (e.g. Seagate factory recertified 'white label' drives) may come with the Vendor field blank. This causes Multipath to fail to complete the discovery of those devices. Such devices violate the SCSI Spec. From the SPC-6, ยง6.7.2: "The T10 VENDOR IDENTIFICATION field contains eight bytes of left-aligned ASCII data (see 4.3.1) identifying the manufacturer of the logical unit. The T10 vendor identification shall be one assigned by INCITS.". But as we don't identify WWIDs by vendor and product, we don't need to discard these devices right away. We can go ahead fingers crossed, and hope that the the other VPD pages for the device are correct. We obviously can't look up reasonable device properties for such devices in our hwtable. It would be up to the user to deal with that. Reported by: Allyn Malventano (github.com/opensvc/multipath-tools/issues/56) Signed-off-by: Martin Wilck --- libmultipath/discovery.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index d9ee2cb..67ac0e6 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1472,6 +1472,7 @@ scsi_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable) { struct udev_device *parent; const char *attr_path = NULL; + static const char unknown[] = "UNKNOWN"; parent = pp->udev; while (parent) { @@ -1492,19 +1493,22 @@ scsi_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable) if (!attr_path || pp->sg_id.host_no == -1) return PATHINFO_FAILED; - if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) - return PATHINFO_FAILED;; - + if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) { + condlog(1, "%s: broken device without vendor ID", pp->dev); + strlcpy(pp->vendor_id, unknown, SCSI_VENDOR_SIZE); + } condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); - if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) - return PATHINFO_FAILED;; - + if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) { + condlog(1, "%s: broken device without product ID", pp->dev); + strlcpy(pp->product_id, unknown, PATH_PRODUCT_SIZE); + } condlog(3, "%s: product = %s", pp->dev, pp->product_id); - if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0) - return PATHINFO_FAILED;; - + if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0) { + condlog(2, "%s: broken device without revision", pp->dev); + strlcpy(pp->rev, unknown, PATH_REV_SIZE); + } condlog(3, "%s: rev = %s", pp->dev, pp->rev); /*