aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-13 13:04:00 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:55:05 -0500
commite02f3f59225d8c3b2a0ad0dc941a09865e27da61 (patch)
tree37d2931f5d24dc063d9606ec6b5e8db359b439c7 /drivers/scsi/scsi_transport_fc.c
parent6d5b0c315e0c14f8a0fe274eda7676d62cbd8584 (diff)
[SCSI] remove target parent limitiation
When James Smart fixed the issue of the userspace scan atributes crashing the system with the FC transport class he added a patch to let the transport class check if the parent is valid for a given transport class. When adding support for the integrated raid of fusion sas devices we ran into a problem with that, as it didn't allow adding virtual raid volumes without the transport class knowing about it. So this patch adds a user_scan attribute instead, that takes over from scsi_scan_host_selected if the transport class sets it and thus lets the transport class control the user-initiated scanning. As this plugs the hole about user-initiated scanning the target_parent hook goes away and we rely on callers of the scanning routines to do something sensible. For SAS this meant I had to switch from a spinlock to a mutex to synchronize the topology linked lists, in FC they were completely unsynchronized which seems wrong. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r--drivers/scsi/scsi_transport_fc.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 625f4a664d06..f2c9acf11bd0 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1093,17 +1093,23 @@ static int fc_rport_match(struct attribute_container *cont,
1093/* 1093/*
1094 * Must be called with shost->host_lock held 1094 * Must be called with shost->host_lock held
1095 */ 1095 */
1096static struct device *fc_target_parent(struct Scsi_Host *shost, 1096static int fc_user_scan(struct Scsi_Host *shost, uint channel,
1097 int channel, uint id) 1097 uint id, uint lun)
1098{ 1098{
1099 struct fc_rport *rport; 1099 struct fc_rport *rport;
1100 1100
1101 list_for_each_entry(rport, &fc_host_rports(shost), peers) 1101 list_for_each_entry(rport, &fc_host_rports(shost), peers) {
1102 if ((rport->channel == channel) && 1102 if (rport->scsi_target_id == -1)
1103 (rport->scsi_target_id == id)) 1103 continue;
1104 return &rport->dev;
1105 1104
1106 return NULL; 1105 if ((channel == SCAN_WILD_CARD || channel == rport->channel) &&
1106 (id == SCAN_WILD_CARD || id == rport->scsi_target_id)) {
1107 scsi_scan_target(&rport->dev, rport->channel,
1108 rport->scsi_target_id, lun, 1);
1109 }
1110 }
1111
1112 return 0;
1107} 1113}
1108 1114
1109struct scsi_transport_template * 1115struct scsi_transport_template *
@@ -1142,7 +1148,7 @@ fc_attach_transport(struct fc_function_template *ft)
1142 /* Transport uses the shost workq for scsi scanning */ 1148 /* Transport uses the shost workq for scsi scanning */
1143 i->t.create_work_queue = 1; 1149 i->t.create_work_queue = 1;
1144 1150
1145 i->t.target_parent = fc_target_parent; 1151 i->t.user_scan = fc_user_scan;
1146 1152
1147 /* 1153 /*
1148 * Setup SCSI Target Attributes. 1154 * Setup SCSI Target Attributes.