aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_rport.c
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2009-08-25 17:02:59 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-10 13:07:57 -0400
commit9737e6a7b5b8af48f983cd565df93493597c565b (patch)
tree2bb3e50171af1fbc18d0f739d760b6218031fb31 /drivers/scsi/libfc/fc_rport.c
parent935d0fce44b906268b8a29de4e72ebb57a3a06d8 (diff)
[SCSI] libfc: Initialize fc_rport_identifiers inside fc_rport_create
Currently these values are initialized by the callers. This was exposed by a later patch that adds PLOGI request support. The patch failed to initialize the new remote port's roles and it caused problems. This patch has the rport_create routine initialize the identifiers and then the callers can override them with real values. 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.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 99ac056293f5..c667be879be6 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -104,18 +104,18 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
104} 104}
105 105
106/** 106/**
107 * fc_rport_create() - create remote port in INIT state. 107 * fc_rport_create() - Create a new remote port
108 * @lport: local port. 108 * @lport: The local port that the new remote port is for
109 * @ids: remote port identifiers. 109 * @port_id: The port ID for the new remote port
110 * 110 *
111 * Locking note: must be called with the disc_mutex held. 111 * Locking note: must be called with the disc_mutex held.
112 */ 112 */
113static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, 113static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
114 struct fc_rport_identifiers *ids) 114 u32 port_id)
115{ 115{
116 struct fc_rport_priv *rdata; 116 struct fc_rport_priv *rdata;
117 117
118 rdata = lport->tt.rport_lookup(lport, ids->port_id); 118 rdata = lport->tt.rport_lookup(lport, port_id);
119 if (rdata) 119 if (rdata)
120 return rdata; 120 return rdata;
121 121
@@ -123,7 +123,11 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
123 if (!rdata) 123 if (!rdata)
124 return NULL; 124 return NULL;
125 125
126 rdata->ids = *ids; 126 rdata->ids.node_name = -1;
127 rdata->ids.port_name = -1;
128 rdata->ids.port_id = port_id;
129 rdata->ids.roles = FC_RPORT_ROLE_UNKNOWN;
130
127 kref_init(&rdata->kref); 131 kref_init(&rdata->kref);
128 mutex_init(&rdata->rp_mutex); 132 mutex_init(&rdata->rp_mutex);
129 rdata->local_port = lport; 133 rdata->local_port = lport;
@@ -135,7 +139,7 @@ static struct fc_rport_priv *fc_rport_create(struct fc_lport *lport,
135 rdata->maxframe_size = FC_MIN_MAX_PAYLOAD; 139 rdata->maxframe_size = FC_MIN_MAX_PAYLOAD;
136 INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout); 140 INIT_DELAYED_WORK(&rdata->retry_work, fc_rport_timeout);
137 INIT_WORK(&rdata->event_work, fc_rport_work); 141 INIT_WORK(&rdata->event_work, fc_rport_work);
138 if (ids->port_id != FC_FID_DIR_SERV) 142 if (port_id != FC_FID_DIR_SERV)
139 list_add(&rdata->peers, &lport->disc.rports); 143 list_add(&rdata->peers, &lport->disc.rports);
140 return rdata; 144 return rdata;
141} 145}