Commit f89b8d67 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: libfc: don't advance state machine for incoming FLOGI

When we receive an FLOGI but have already sent our own we should
not advance the state machine but rather wait for our FLOGI to
return before continuing with PLOGI.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Acked-by: default avatarJohannes Thumshirn <jth@kernel.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 06ee2571
...@@ -765,8 +765,10 @@ static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -765,8 +765,10 @@ static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
goto bad; goto bad;
flogi = fc_frame_payload_get(fp, sizeof(*flogi)); flogi = fc_frame_payload_get(fp, sizeof(*flogi));
if (!flogi) if (!flogi) {
FC_RPORT_DBG(rdata, "Bad FLOGI response\n");
goto bad; goto bad;
}
r_a_tov = ntohl(flogi->fl_csp.sp_r_a_tov); r_a_tov = ntohl(flogi->fl_csp.sp_r_a_tov);
if (r_a_tov > rdata->r_a_tov) if (r_a_tov > rdata->r_a_tov)
rdata->r_a_tov = r_a_tov; rdata->r_a_tov = r_a_tov;
...@@ -783,7 +785,6 @@ static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, ...@@ -783,7 +785,6 @@ static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, lport->tt.rport_destroy);
return; return;
bad: bad:
FC_RPORT_DBG(rdata, "Bad FLOGI response\n");
fc_rport_error_retry(rdata, fp); fc_rport_error_retry(rdata, fp);
goto out; goto out;
} }
...@@ -925,10 +926,17 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport, ...@@ -925,10 +926,17 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport,
fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0); fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_ELS_REP, 0);
lport->tt.frame_send(lport, fp); lport->tt.frame_send(lport, fp);
/*
* Do not proceed with the state machine if our
* FLOGI has crossed with an FLOGI from the
* remote port; wait for the FLOGI response instead.
*/
if (rdata->rp_state != RPORT_ST_FLOGI) {
if (rdata->ids.port_name < lport->wwpn) if (rdata->ids.port_name < lport->wwpn)
fc_rport_enter_plogi(rdata); fc_rport_enter_plogi(rdata);
else else
fc_rport_state_enter(rdata, RPORT_ST_PLOGI_WAIT); fc_rport_state_enter(rdata, RPORT_ST_PLOGI_WAIT);
}
out: out:
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
kref_put(&rdata->kref, lport->tt.rport_destroy); kref_put(&rdata->kref, lport->tt.rport_destroy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment