[PATCH v4] blkmapd: Skip the SCSI ID if data length is zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In vmware linux, the iscsi device contains more than one SCSI ID,
and the second one's data length is zero.

If there are two iSCSI devices with the second SCSI ID's data length
is zero, the first iSCSI device will record with an invalid SCSI ID
as zero length, the second one will be treat as the first one for
the SCSI ID is zero length too.

It means the only the first iSCSI device is exist in blkmapd's cache,
the request for the second iSCSI device will failed as,

"blkmapd: Could not find disk for device" and,
"bl_resolve_deviceid failed to decode device: 2".

v2, update comments
v3, add a comment in the code
v4, update comment as Christoph's suggestion

Signed-off-by: Kinglong Mee <kinglongmee@xxxxxxxxx>
---
 utils/blkmapd/device-inq.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 6b56b67..5c258bd 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -198,6 +198,13 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
 		dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
 		pos += (dev_id->len + devid_len);
 
+		/* Some buggy targets (e.g. VMWare) export zero length
+		 * EVPD pages, skip them to not confuse the device id
+		 * cache.
+		 */
+		if (!dev_id->len)
+			continue;
+
 		if ((dev_id->ids & 0xf) < current_id)
 			continue;
 		switch (dev_id->ids & 0xf) {
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux