Skip to content

Commit

Permalink
libmultipath: pathinfo: don't fail for devices lacking INQUIRY proper…
Browse files Browse the repository at this point in the history
…ties

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//issues/56)
Signed-off-by: Martin Wilck <[email protected]>
Reviewed-by: Benjamin Marzinski <[email protected]>
  • Loading branch information
mwilck committed Jan 24, 2023
1 parent fa315e6 commit 88d46ea
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions libmultipath/discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

/*
Expand Down

0 comments on commit 88d46ea

Please sign in to comment.