From: Saurav Kashyap <skashyap@marvell.com>
To: <martin.petersen@oracle.com>
Cc: <gbasrur@marvell.com>, <svernekar@marvell.com>,
<linux-scsi@vger.kernel.org>
Subject: [PATCH 12/14] qedf: Use discovery list to traverse rports
Date: Fri, 23 Aug 2019 02:52:42 -0700 [thread overview]
Message-ID: <20190823095244.7830-13-skashyap@marvell.com> (raw)
In-Reply-To: <20190823095244.7830-1-skashyap@marvell.com>
From: Hannes Reinecke <hare@suse.com>
The list of rports might become stale, so we should rather traverse
the discovery list when trying relogin.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
---
drivers/scsi/qedf/qedf_main.c | 39 +++++++--------------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 8845873..0856d13 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -343,11 +343,6 @@ int qedf_send_flogi(struct qedf_ctx *qedf)
return 0;
}
-struct qedf_tmp_rdata_item {
- struct fc_rport_priv *rdata;
- struct list_head list;
-};
-
/*
* This function is called if link_down_tmo is in use. If we get a link up and
* link_down_tmo has not expired then use just FLOGI/ADISC to recover our
@@ -357,9 +352,8 @@ static void qedf_link_recovery(struct work_struct *work)
{
struct qedf_ctx *qedf =
container_of(work, struct qedf_ctx, link_recovery.work);
- struct qedf_rport *fcport;
+ struct fc_lport *lport = qedf->lport;
struct fc_rport_priv *rdata;
- struct qedf_tmp_rdata_item *rdata_item, *tmp_rdata_item;
bool rc;
int retries = 30;
int rval, i;
@@ -426,33 +420,14 @@ static void qedf_link_recovery(struct work_struct *work)
* Call lport->tt.rport_login which will cause libfc to send an
* ADISC since the rport is in state ready.
*/
- rcu_read_lock();
- list_for_each_entry_rcu(fcport, &qedf->fcports, peers) {
- rdata = fcport->rdata;
- if (rdata == NULL)
- continue;
- rdata_item = kzalloc(sizeof(struct qedf_tmp_rdata_item),
- GFP_ATOMIC);
- if (!rdata_item)
- continue;
+ mutex_lock(&lport->disc.disc_mutex);
+ list_for_each_entry_rcu(rdata, &lport->disc.rports, peers) {
if (kref_get_unless_zero(&rdata->kref)) {
- rdata_item->rdata = rdata;
- list_add(&rdata_item->list, &rdata_login_list);
- } else
- kfree(rdata_item);
- }
- rcu_read_unlock();
- /*
- * Do the fc_rport_login outside of the rcu lock so we don't take a
- * mutex in an atomic context.
- */
- list_for_each_entry_safe(rdata_item, tmp_rdata_item, &rdata_login_list,
- list) {
- list_del(&rdata_item->list);
- fc_rport_login(rdata_item->rdata);
- kref_put(&rdata_item->rdata->kref, fc_rport_destroy);
- kfree(rdata_item);
+ fc_rport_login(rdata);
+ kref_put(&rdata->kref, fc_rport_destroy);
+ }
}
+ mutex_unlock(&lport->disc.disc_mutex);
}
static void qedf_update_link_speed(struct qedf_ctx *qedf,
--
1.8.3.1
next prev parent reply other threads:[~2019-08-23 9:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 9:52 [PATCH 00/14] qedf: Miscellaneous fixes Saurav Kashyap
2019-08-23 9:52 ` [PATCH 01/14] qedf: Print message during bailout conditions Saurav Kashyap
2019-08-23 9:52 ` [PATCH 02/14] qedf: Stop sending fipvlan request on unload Saurav Kashyap
2019-08-23 9:52 ` [PATCH 03/14] qedf: Fix crash during sg_reset Saurav Kashyap
2019-08-23 9:52 ` [PATCH 04/14] qedf: Update module description string Saurav Kashyap
2019-08-23 9:52 ` [PATCH 05/14] qedf: Add shutdown callback handler Saurav Kashyap
2019-08-23 9:52 ` [PATCH 06/14] qedf: Interpret supported caps value correctly Saurav Kashyap
2019-08-23 9:52 ` [PATCH 07/14] qedf: Add support for 20 Gbps speed Saurav Kashyap
2019-08-23 9:52 ` [PATCH 08/14] qedf: Add debug information for unsolicited processing Saurav Kashyap
2019-08-23 9:52 ` [PATCH 09/14] qedf: Initiator fails to re-login to switch after link down Saurav Kashyap
2019-08-23 9:52 ` [PATCH 10/14] qedf: Check for module unloading bit before processing link update AEN Saurav Kashyap
2019-08-23 9:52 ` [PATCH 11/14] qedf: Decrease the LL2 MTU size to 2500 Saurav Kashyap
2019-08-23 9:52 ` Saurav Kashyap [this message]
2019-08-23 9:52 ` [PATCH 13/14] qedf: Fix race betwen fipvlan request and response path Saurav Kashyap
2019-08-23 9:52 ` [PATCH 14/14] qedf: Update the version to 8.42.3.0 Saurav Kashyap
2019-08-29 22:52 ` [PATCH 00/14] qedf: Miscellaneous fixes Martin K. Petersen
2019-08-30 6:43 ` Saurav Kashyap
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=20190823095244.7830-13-skashyap@marvell.com \
--to=skashyap@marvell.com \
--cc=gbasrur@marvell.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=svernekar@marvell.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).