From patchwork Fri Jan 19 11:55:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10175125 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.web.codeaurora.org (Postfix) with ESMTP id 816976055D for ; Fri, 19 Jan 2018 11:56:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F59628671 for ; Fri, 19 Jan 2018 11:56:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 628D828673; Fri, 19 Jan 2018 11:56:28 +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=-6.9 required=2.0 tests=BAYES_00,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 E6B9428671 for ; Fri, 19 Jan 2018 11:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E17B381DEB; Fri, 19 Jan 2018 11:56:26 +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 9CCFD5D6B4; Fri, 19 Jan 2018 11:56:26 +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 CDFD518033D9; Fri, 19 Jan 2018 11:56:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w0JBuOYg015093 for ; Fri, 19 Jan 2018 06:56:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 238C960F80; Fri, 19 Jan 2018 11:56:24 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6DAE60BE7; Fri, 19 Jan 2018 11:56:21 +0000 (UTC) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (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 46852859FA; Fri, 19 Jan 2018 11:56:19 +0000 (UTC) Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Fri, 19 Jan 2018 12:56:17 +0100 Received: from apollon.suse.de.de (nwb-a10-snat.microfocus.com [10.120.13.202]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Fri, 19 Jan 2018 11:55:47 +0000 From: Martin Wilck To: Christophe Varoqui Date: Fri, 19 Jan 2018 12:55:35 +0100 Message-Id: <20180119115535.4771-1-mwilck@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 19 Jan 2018 11:56:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 19 Jan 2018 11:56:21 +0000 (UTC) for IP:'195.135.221.5' DOMAIN:'smtp.nue.novell.com' HELO:'smtp.nue.novell.com' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 195.135.221.5 smtp.nue.novell.com 195.135.221.5 smtp.nue.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Xose Vazquez Perez Subject: [dm-devel] [PATCH] libmultipath: increase path product_id/rev field size for NVMe X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 19 Jan 2018 11:56:27 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP NVMe allows longer strings for the model (product) and firmware rev than SCSI. Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/config.c | 2 +- libmultipath/discovery.c | 12 ++++++------ libmultipath/structs.h | 10 ++++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/libmultipath/config.c b/libmultipath/config.c index 1461a17cddbe..2592990ecccd 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -319,7 +319,7 @@ set_param_str(char * str) static int merge_hwe (struct hwentry * dst, struct hwentry * src) { - char id[SCSI_VENDOR_SIZE+SCSI_PRODUCT_SIZE]; + char id[SCSI_VENDOR_SIZE+PATH_PRODUCT_SIZE]; merge_str(vendor); merge_str(product); merge_str(revision); diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 88fc8d732258..88e9f3b61510 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -1158,12 +1158,12 @@ scsi_sysfs_pathinfo (struct path * pp, vector hwtable) condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); - if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE) <= 0) + if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) return 1; condlog(3, "%s: product = %s", pp->dev, pp->product_id); - if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) < 0) + if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0) return 1; condlog(3, "%s: rev = %s", pp->dev, pp->rev); @@ -1223,11 +1223,11 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable) pp->sg_id.channel = attr ? atoi(attr) : 0; snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME"); - snprintf(pp->product_id, SCSI_PRODUCT_SIZE, "%s", + snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s", udev_device_get_sysattr_value(parent, "model")); snprintf(pp->serial, SERIAL_SIZE, "%s", udev_device_get_sysattr_value(parent, "serial")); - snprintf(pp->rev, SCSI_REV_SIZE, "%s", + snprintf(pp->rev, PATH_REV_SIZE, "%s", udev_device_get_sysattr_value(parent, "firmware_rev")); condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); @@ -1342,12 +1342,12 @@ cciss_sysfs_pathinfo (struct path * pp, vector hwtable) condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id); - if (sysfs_get_model(parent, pp->product_id, SCSI_PRODUCT_SIZE) <= 0) + if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) return 1; condlog(3, "%s: product = %s", pp->dev, pp->product_id); - if (sysfs_get_rev(parent, pp->rev, SCSI_REV_SIZE) <= 0) + if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) <= 0) return 1; condlog(3, "%s: rev = %s", pp->dev, pp->rev); diff --git a/libmultipath/structs.h b/libmultipath/structs.h index d132dfcebce4..b951c7b0e157 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -25,6 +25,12 @@ #define SCSI_PRODUCT_SIZE 17 #define SCSI_REV_SIZE 5 #define SCSI_STATE_SIZE 19 +#define NVME_MODEL_SIZE 41 +#define NVME_REV_SIZE 9 + +/* This must be the maximum of SCSI and NVME sizes */ +#define PATH_PRODUCT_SIZE NVME_MODEL_SIZE +#define PATH_REV_SIZE NVME_REV_SIZE #define NO_PATH_RETRY_UNDEF 0 #define NO_PATH_RETRY_FAIL -1 @@ -214,8 +220,8 @@ struct path { struct hd_geometry geom; char wwid[WWID_SIZE]; char vendor_id[SCSI_VENDOR_SIZE]; - char product_id[SCSI_PRODUCT_SIZE]; - char rev[SCSI_REV_SIZE]; + char product_id[PATH_PRODUCT_SIZE]; + char rev[PATH_REV_SIZE]; char serial[SERIAL_SIZE]; char tgt_node_name[NODE_NAME_SIZE]; unsigned long long size;