Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi_dh_alua: do not fail for unknown VPD identification

Not every device will return a useable VPD identification, but still
might support ALUA. Rather than disable ALUA support we should be
allowing the device identification to be empty and attach individual
ALUA device handler to each devices.

[mkp: Fixed typo reported by Bart]

Reported-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Tested-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
fe8b9534 1b37bd60

+17 -8
+17 -8
drivers/scsi/device_handler/scsi_dh_alua.c
··· 195 195 { 196 196 struct alua_port_group *pg; 197 197 198 + if (!id_str || !id_size || !strlen(id_str)) 199 + return NULL; 200 + 198 201 list_for_each_entry(pg, &port_group_list, node) { 199 202 if (pg->group_id != group_id) 200 203 continue; 201 - if (pg->device_id_len != id_size) 204 + if (!pg->device_id_len || pg->device_id_len != id_size) 202 205 continue; 203 206 if (strncmp(pg->device_id_str, id_str, id_size)) 204 207 continue; ··· 235 232 sizeof(pg->device_id_str)); 236 233 if (pg->device_id_len <= 0) { 237 234 /* 238 - * Internal error: TPGS supported but no device 239 - * identifcation found. Disable ALUA support. 235 + * TPGS supported but no device identification found. 236 + * Generate private device identification. 240 237 */ 241 - kfree(pg); 242 238 sdev_printk(KERN_INFO, sdev, 243 239 "%s: No device descriptors found\n", 244 240 ALUA_DH_NAME); 245 - return ERR_PTR(-ENXIO); 241 + pg->device_id_str[0] = '\0'; 242 + pg->device_id_len = 0; 246 243 } 247 244 pg->group_id = group_id; 248 245 pg->tpgs = tpgs; ··· 357 354 return SCSI_DH_NOMEM; 358 355 return SCSI_DH_DEV_UNSUPP; 359 356 } 360 - sdev_printk(KERN_INFO, sdev, 361 - "%s: device %s port group %x rel port %x\n", 362 - ALUA_DH_NAME, pg->device_id_str, group_id, rel_port); 357 + if (pg->device_id_len) 358 + sdev_printk(KERN_INFO, sdev, 359 + "%s: device %s port group %x rel port %x\n", 360 + ALUA_DH_NAME, pg->device_id_str, 361 + group_id, rel_port); 362 + else 363 + sdev_printk(KERN_INFO, sdev, 364 + "%s: port group %x rel port %x\n", 365 + ALUA_DH_NAME, group_id, rel_port); 363 366 364 367 /* Check for existing port group references */ 365 368 spin_lock(&h->pg_lock);