aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_rport.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-08-25 17:01:50 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:46 -0400
commit48f00902ba40d3e4467782a42258b952437a89f9 (patch)
tree9559e9a92cadd9988ff32940358c8b6d9dee5140 /drivers/scsi/libfc/fc_rport.c
parentb5cbf083736e14911c32fca2a93c540a92e8413d (diff)
[SCSI] libfc: make rport module maintain the rport list
The list of remote ports (struct fc_rport_priv) has been maintained by the discovery module. In preparation for having lport->tt.rport_create() do a lookup first, maintain the rports list in the rport module. It will still be protected by the disc_mutex. The DNS rport is an exception for until after further patches. For now, do not add it to the list. The point-to-point rport will be in the discovery list. So at shutdown, it doesn't need to be separately logged out. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc/fc_rport.c')
-rw-r--r--drivers/scsi/libfc/fc_rport.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 6ecf36d4708c..a9087b31bce9 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -91,8 +91,7 @@ static const char *fc_rport_state_names[] = {
91 * @lport: local port. 91 * @lport: local port.
92 * @ids: remote port identifiers. 92 * @ids: remote port identifiers.
93 * 93 *
94 * Locking note: this may be called without locks held, but 94 * Locking note: must be called with the disc_mutex held.
95 * is usually called from discovery with the disc_mutex held.
96 */ 95 */
97static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, 96static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
98 struct fc_rport_identifiers *ids) 97 struct fc_rport_identifiers *ids)
@@ -115,6 +114,8 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
115 rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; 114 rdata->maxframe_size = FC_MIN_MAX_PAYLOAD;
116 INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); 115 INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout);
117 INIT_WORK(&rdata->event_work, fc_rport_work); 116 INIT_WORK(&rdata->event_work, fc_rport_work);
117 if (ids->port_id != FC_FID_DIR_SERV)
118 list_add(&rdata->peers, &lport->disc.rports);
118 return rdata; 119 return rdata;
119} 120}
120 121
@@ -258,6 +259,12 @@ static void fc_rport_work(struct work_struct *work)
258 port_id = rdata->ids.port_id; 259 port_id = rdata->ids.port_id;
259 mutex_unlock(&rdata->rp_mutex); 260 mutex_unlock(&rdata->rp_mutex);
260 261
262 if (port_id != FC_FID_DIR_SERV) {
263 mutex_lock(&lport->disc.disc_mutex);
264 list_del(&rdata->peers);
265 mutex_unlock(&lport->disc.disc_mutex);
266 }
267
261 if (rport_ops->event_callback) { 268 if (rport_ops->event_callback) {
262 FC_RPORT_DBG(rdata, "callback ev %d\n", event); 269 FC_RPORT_DBG(rdata, "callback ev %d\n", event);
263 rport_ops->event_callback(lport, rdata, event); 270 rport_ops->event_callback(lport, rdata, event);