diff options
author | Robert Love <robert.w.love@intel.com> | 2009-08-25 17:02:59 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-10 13:07:57 -0400 |
commit | 9737e6a7b5b8af48f983cd565df93493597c565b (patch) | |
tree | 2bb3e50171af1fbc18d0f739d760b6218031fb31 /drivers/scsi/libfc/fc_disc.c | |
parent | 935d0fce44b906268b8a29de4e72ebb57a3a06d8 (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_disc.c')
-rw-r--r-- | drivers/scsi/libfc/fc_disc.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 1a699f484c85..4242894cce7c 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c | |||
@@ -137,10 +137,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | dp->lp = lport; | 139 | dp->lp = lport; |
140 | dp->ids.port_id = ntoh24(pp->rscn_fid); | 140 | dp->port_id = ntoh24(pp->rscn_fid); |
141 | dp->ids.port_name = -1; | ||
142 | dp->ids.node_name = -1; | ||
143 | dp->ids.roles = FC_RPORT_ROLE_UNKNOWN; | ||
144 | list_add_tail(&dp->peers, &disc_ports); | 141 | list_add_tail(&dp->peers, &disc_ports); |
145 | break; | 142 | break; |
146 | case ELS_ADDR_FMT_AREA: | 143 | case ELS_ADDR_FMT_AREA: |
@@ -162,7 +159,7 @@ static void fc_disc_recv_rscn_req(struct fc_seq *sp, struct fc_frame *fp, | |||
162 | redisc, lport->state, disc->pending); | 159 | redisc, lport->state, disc->pending); |
163 | list_for_each_entry_safe(dp, next, &disc_ports, peers) { | 160 | list_for_each_entry_safe(dp, next, &disc_ports, peers) { |
164 | list_del(&dp->peers); | 161 | list_del(&dp->peers); |
165 | rdata = lport->tt.rport_lookup(lport, dp->ids.port_id); | 162 | rdata = lport->tt.rport_lookup(lport, dp->port_id); |
166 | if (rdata) { | 163 | if (rdata) { |
167 | lport->tt.rport_logoff(rdata); | 164 | lport->tt.rport_logoff(rdata); |
168 | } | 165 | } |
@@ -435,15 +432,14 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len) | |||
435 | while (plen >= sizeof(*np)) { | 432 | while (plen >= sizeof(*np)) { |
436 | ids.port_id = ntoh24(np->fp_fid); | 433 | ids.port_id = ntoh24(np->fp_fid); |
437 | ids.port_name = ntohll(np->fp_wwpn); | 434 | ids.port_name = ntohll(np->fp_wwpn); |
438 | ids.node_name = -1; | ||
439 | ids.roles = FC_RPORT_ROLE_UNKNOWN; | ||
440 | 435 | ||
441 | if (ids.port_id != fc_host_port_id(lport->host) && | 436 | if (ids.port_id != fc_host_port_id(lport->host) && |
442 | ids.port_name != lport->wwpn) { | 437 | ids.port_name != lport->wwpn) { |
443 | rdata = lport->tt.rport_create(lport, &ids); | 438 | rdata = lport->tt.rport_create(lport, ids.port_id); |
444 | if (rdata) | 439 | if (rdata) { |
440 | rdata->ids.port_name = ids.port_name; | ||
445 | rdata->disc_id = disc->disc_id; | 441 | rdata->disc_id = disc->disc_id; |
446 | else { | 442 | } else { |
447 | printk(KERN_WARNING "libfc: Failed to allocate " | 443 | printk(KERN_WARNING "libfc: Failed to allocate " |
448 | "memory for the newly discovered port " | 444 | "memory for the newly discovered port " |
449 | "(%6x)\n", ids.port_id); | 445 | "(%6x)\n", ids.port_id); |
@@ -580,10 +576,10 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp) | |||
580 | 576 | ||
581 | lport = disc->lport; | 577 | lport = disc->lport; |
582 | 578 | ||
583 | if (dp->ids.port_id == fc_host_port_id(lport->host)) | 579 | if (dp->port_id == fc_host_port_id(lport->host)) |
584 | goto out; | 580 | goto out; |
585 | 581 | ||
586 | rdata = lport->tt.rport_create(lport, &dp->ids); | 582 | rdata = lport->tt.rport_create(lport, dp->port_id); |
587 | if (rdata) { | 583 | if (rdata) { |
588 | rdata->disc_id = disc->disc_id; | 584 | rdata->disc_id = disc->disc_id; |
589 | kfree(dp); | 585 | kfree(dp); |