diff mbox series

[2/2] libmultipath: pathinfo: don't fail for devices lacking INQUIRY properties

Message ID 20230113094310.20367-3-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools fixes for GitHub reported issues | expand

Commit Message

Martin Wilck Jan. 13, 2023, 9:43 a.m. UTC
From: Martin Wilck <mwilck@suse.com>

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 <mwilck@suse.com>
---
 libmultipath/discovery.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
diff mbox series

Patch

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);
 
 	/*