All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: Make scsi_vpd_lun_id() able to use T10 vendor ID based designators
@ 2016-05-04  6:58 Paul Mackerras
  2016-05-04 10:04 ` Hannes Reinecke
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Mackerras @ 2016-05-04  6:58 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: linux-scsi

This adds code to scsi_vpd_lun_id() to enable it to use T10 vendor ID
based designators.  This is needed to allow alua to work on disks that
don't have any designators of type 2, 3 or 8.  Commit 0047220c6c36
("scsi_dh_alua: use unique device id", 2016-02-19) added a requirement
that alua can only be used on disks for which scsi_vpd_lun_id() can
produce an identifying string.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 drivers/scsi/scsi_lib.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8106515..f4f69cc 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -3214,6 +3214,20 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len)
 			goto next_desig;
 
 		switch (d[1] & 0xf) {
+		case 0x1:
+			/* T10 vendor ID */
+			if (cur_id_size > d[3])
+				break;
+			/* Prefer EUI-64 or NAA IEEE Registered Extended */
+			if ((cur_id_type == 0x2 || cur_id_type == 0x3) &&
+			    cur_id_size == d[3])
+				break;
+			cur_id_size = d[3];
+			cur_id_str = d + 4;
+			cur_id_type = d[1] & 0xf;
+			id_size = snprintf(id, id_len, "%*phN", cur_id_size,
+					   cur_id_str);
+			break;
 		case 0x2:
 			/* EUI-64 */
 			if (cur_id_size > d[3])

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-06  9:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04  6:58 [PATCH] scsi: Make scsi_vpd_lun_id() able to use T10 vendor ID based designators Paul Mackerras
2016-05-04 10:04 ` Hannes Reinecke
2016-05-05  3:50   ` Paul Mackerras
2016-05-05  8:01     ` Hannes Reinecke
2016-05-05 12:41       ` Paul Mackerras
2016-05-06  9:46         ` Hannes Reinecke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.