From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>,
Johannes Thumshirn <jth@kernel.org>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Chad Dupuis <chad.dupuis@cavium.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH 6/7] libfc: don't advance state machine for incoming FLOGI
Date: Fri, 30 Sep 2016 09:04:13 +0200 [thread overview]
Message-ID: <1475219054-31241-7-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1475219054-31241-1-git-send-email-hare@suse.de>
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: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
---
drivers/scsi/libfc/fc_rport.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 72a7183..4b9bb6d 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -765,8 +765,10 @@ static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
goto bad;
flogi = fc_frame_payload_get(fp, sizeof(*flogi));
- if (!flogi)
+ if (!flogi) {
+ FC_RPORT_DBG(rdata, "Bad FLOGI response\n");
goto bad;
+ }
r_a_tov = ntohl(flogi->fl_csp.sp_r_a_tov);
if (r_a_tov > rdata->r_a_tov)
rdata->r_a_tov = r_a_tov;
@@ -783,7 +785,6 @@ put:
kref_put(&rdata->kref, lport->tt.rport_destroy);
return;
bad:
- FC_RPORT_DBG(rdata, "Bad FLOGI response\n");
fc_rport_error_retry(rdata, fp);
goto out;
}
@@ -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);
lport->tt.frame_send(lport, fp);
- if (rdata->ids.port_name < lport->wwpn)
- fc_rport_enter_plogi(rdata);
- else
- fc_rport_state_enter(rdata, RPORT_ST_PLOGI_WAIT);
+ /*
+ * 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)
+ fc_rport_enter_plogi(rdata);
+ else
+ fc_rport_state_enter(rdata, RPORT_ST_PLOGI_WAIT);
+ }
out:
mutex_unlock(&rdata->rp_mutex);
kref_put(&rdata->kref, lport->tt.rport_destroy);
--
1.8.5.6
next prev parent reply other threads:[~2016-09-30 7:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-30 7:04 [PATCH 0/7] libfc: sanitize kref and state machine fixes Hannes Reinecke
2016-09-30 7:04 ` [PATCH 1/7] libfc: Revisit kref handling Hannes Reinecke
2016-09-30 7:23 ` Johannes Thumshirn
2016-09-30 7:04 ` [PATCH 2/7] libfc: Fixup disc_mutex handling Hannes Reinecke
2016-09-30 7:25 ` Johannes Thumshirn
2016-09-30 7:04 ` [PATCH 3/7] libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS response Hannes Reinecke
2016-09-30 7:26 ` Johannes Thumshirn
2016-09-30 7:04 ` [PATCH 4/7] libfc: Do not drop down to FLOGI for fc_rport_login() Hannes Reinecke
2016-09-30 7:26 ` Johannes Thumshirn
2016-09-30 7:04 ` [PATCH 5/7] libfc: Do not login if the port is already started Hannes Reinecke
2016-09-30 7:04 ` Hannes Reinecke [this message]
2016-09-30 7:04 ` [PATCH 7/7] fcoe: Harden CVL handling when we have not logged into the fabric Hannes Reinecke
2016-09-30 7:27 ` Johannes Thumshirn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1475219054-31241-7-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=chad.dupuis@cavium.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jth@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).