libmultipath: increase path product_id/rev field size for NVMe
authorMartin Wilck <mwilck@suse.com>
Fri, 19 Jan 2018 11:55:35 +0000 (12:55 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 7 Mar 2018 08:56:42 +0000 (09:56 +0100)
NVMe allows longer strings for the model (product) and firmware rev
than SCSI.

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/config.c
libmultipath/discovery.c
libmultipath/structs.h

index 3d6a24c..085a3e1 100644 (file)
@@ -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);
index 88fc8d7..88e9f3b 100644 (file)
@@ -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);
index d132dfc..b951c7b 100644 (file)
 #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;