Skip to contentSkip to conversation

ibmvscsi: Fix SCSI scanning

PATCH In review Bart Van Assche 3 participants 5 messages Jun 19, 2011 – Jun 20, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ibmvscsi: Fix SCSI scanning

Avoid that SCSI scanning triggers creation of targets with a non-zero channel number.

---
 drivers/scsi/ibmvscsi/ibmvscsi.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Note: this patch hasn't been tested yet.

drivers/scsi/ibmvscsi/ibmvscsi.c +6 -0
index 3d391dc..c31adf5 100644
@@ -498,6 +498,11 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 	spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 }
 
+static int ibmvscsi_target_alloc(struct scsi_target *starget)
+{
+	return starget->channel == 0 ? 0 : -ENODEV;
+}
+
 /**
  * ibmvscsi_reset_host - Reset the connection to the server
  * @hostdata:	struct ibmvscsi_host_data to reset
@@ -1803,6 +1808,7 @@ static struct scsi_host_template driver_template = {
 	.module = THIS_MODULE,
 	.name = "IBM POWER Virtual SCSI Adapter " IBMVSCSI_VERSION,
 	.proc_name = "ibmvscsi",
+	.target_alloc = ibmvscsi_target_alloc,
 	.queuecommand = ibmvscsi_queuecommand,
 	.eh_abort_handler = ibmvscsi_eh_abort_handler,
 	.eh_device_reset_handler = ibmvscsi_eh_device_reset_handler,
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 2 lines · Bart Van Assche

Avoid that SCSI scanning triggers creation of targets with a non-zero channel number.

Same comment as for the SRP one applies here as well.

#2 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Bart Van Assche

Avoid that SCSI scanning triggers creation of targets with a non-zero channel number.

Same comment as for the SRP one applies here as well.

If no kernel module parameters have been specified, max_channel is set to three in the ibmvscsi driver. It's not clear to me why.

Bart.

#4 lore raw
In reply to Bart Van Assche

drivers/scsi/ibmvscsi/ibmvscsi.c static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code) · line 505

Quoted 13 lines · Bart Van Assche
drivers/scsi/ibmvscsi/ibmvscsi.c +5 -0
index 3d391dc..c31adf5 100644
@@ -498,6 +498,11 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 	spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 }
 
+static int ibmvscsi_target_alloc(struct scsi_target *starget)
+{
+	return starget->channel == 0 ? 0 : -ENODEV;
+}
+

This will break existing IBM Power users who have more than 64 virtual disks assigned to a single virtual scsi adapter. The IBM VSCSI target uses Logical Unit Addressing (10b) and does bus/id/lun -> vscsi LUN mapping as defined in SAM. The 65'th virtual scsi disk would show up on bus 1 as target 0.

Thanks,

Brian

Signature · 3 lines
Brian King
Linux on Power Virtualization
IBM Linux Technology Center
#3 lore raw
In reply to Bart Van Assche
Quoted 9 lines · Bart Van Assche
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Bart Van Assche

Avoid that SCSI scanning triggers creation of targets with a non-zero channel number.

Same comment as for the SRP one applies here as well.

If no kernel module parameters have been specified, max_channel is set to three in the ibmvscsi driver. It's not clear to me why.

It could be set as high as 16 in order to support the full 3 bits worth of bus values as defined in Logical Unit Addressing model in SAM, but 3 is generally sufficient for most users as it allows for 64 targets * 3 buses = 192 virtual scsi targets.

Thanks,

Brian

Signature · 3 lines
Brian King
Linux on Power Virtualization
IBM Linux Technology Center