[dm-devel] [PATCH 62/78] Skip USB devices during discovery

Hannes Reinecke hare at suse.de
Mon Mar 16 12:36:49 UTC 2015


Some USB devices even present VPD pages, but they still remain
USB devices, and we shouldn't run multipath on those.
So detect USB devices properly and skip them during discovery.

Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 libmultipath/discovery.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a9962d1..c4aee1c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -275,6 +275,19 @@ sysfs_get_tgt_nodename (struct path *pp, char * node)
 		}
 	}
 
+	/* Check for USB */
+	tgtdev = udev_device_get_parent(parent);
+	while (tgtdev) {
+		value = udev_device_get_subsystem(tgtdev);
+		if (value && !strcmp(value, "usb")) {
+			pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
+			tgtname = udev_device_get_sysname(tgtdev);
+			strncpy(node, tgtname, strlen(tgtname));
+			condlog(3, "%s: skip USB device %s", pp->dev, node);
+			return 1;
+		}
+		tgtdev = udev_device_get_parent(tgtdev);
+	}
 	parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "scsi", "scsi_target");
 	if (!parent)
 		return 1;
-- 
1.8.4.5




More information about the dm-devel mailing list