LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 7/9] firewire: fw-sbp2: logout and login after failed reconnect
Date: Sun, 3 Feb 2008 23:11:39 +0100 (CET) [thread overview]
Message-ID: <tkrat.4988439f2c8906f5@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.f34e34fd91a0695f@s5r6.in-berlin.de>
If fw-sbp2 was too late with requesting the reconnect, the target would
reject this. In this case, log out before attempting the reconnect.
Else several firmwares will deny the re-login because they somehow
didn't invalidate the old login.
Also, don't retry reconnects in this situation. The retries won't
succeed either.
These changes improve chances for successful re-login and shorten the
period during which the logical unit is inaccessible.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/firewire/fw-sbp2.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: linux/drivers/firewire/fw-sbp2.c
===================================================================
--- linux.orig/drivers/firewire/fw-sbp2.c
+++ linux/drivers/firewire/fw-sbp2.c
@@ -710,6 +710,11 @@ static void sbp2_login(struct work_struc
node_id = device->node_id;
local_node_id = device->card->node_id;
+ /* If this is a re-login attempt, log out, or we might be rejected. */
+ if (lu->sdev)
+ sbp2_send_management_orb(lu, device->node_id, generation,
+ SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
+
if (sbp2_send_management_orb(lu, node_id, generation,
SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
if (lu->retries++ < 5)
@@ -1021,9 +1026,17 @@ static void sbp2_reconnect(struct work_s
if (sbp2_send_management_orb(lu, node_id, generation,
SBP2_RECONNECT_REQUEST,
lu->login_id, NULL) < 0) {
- if (lu->retries++ >= 5) {
+ /*
+ * If reconnect was impossible even though we are in the
+ * current generation, fall back and try to log in again.
+ *
+ * We could check for "Function rejected" status, but
+ * looking at the bus generation as simpler and more general.
+ */
+ smp_rmb(); /* get current card generation */
+ if (generation == device->card->generation ||
+ lu->retries++ >= 5) {
fw_error("%s: failed to reconnect\n", tgt->bus_id);
- /* Fall back and try to log in again. */
lu->retries = 0;
PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
}
--
Stefan Richter
-=====-==--- --=- ---==
http://arcgraph.de/sr/
next prev parent reply other threads:[~2008-02-03 22:11 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-03 22:00 [PATCH 0/9] firewire-sbp2: misc hotplug related patches Stefan Richter
2008-02-03 22:03 ` [PATCH 1/9] firewire: log GUID of new devices Stefan Richter
2008-02-04 8:14 ` Stefan Richter
2008-02-11 16:53 ` Jarod Wilson
2008-02-03 22:04 ` [PATCH 2/9] firewire: fw-sbp2: add INQUIRY delay workaround Stefan Richter
2008-02-11 17:01 ` Jarod Wilson
2008-02-03 22:07 ` [PATCH 3/9] ieee1394: sbp2: " Stefan Richter
2008-02-11 17:03 ` Jarod Wilson
2008-02-03 22:08 ` [PATCH 4/9] firewire: fw-sbp2: wait for completion of fetch agent reset Stefan Richter
2008-02-04 8:11 ` Stefan Richter
2008-02-03 22:09 ` [PATCH 5/9] firewire: fw-sbp2: log bus_id at management request failures Stefan Richter
2008-02-11 17:16 ` Jarod Wilson
2008-02-03 22:10 ` [PATCH 6/9] firewire: fw-sbp2: don't add scsi_device twice Stefan Richter
2008-02-11 17:19 ` Jarod Wilson
2008-02-11 19:42 ` Stefan Richter
2008-02-12 8:55 ` Stefan Richter
2008-02-03 22:11 ` Stefan Richter [this message]
2008-02-11 17:32 ` [PATCH 7/9] firewire: fw-sbp2: logout and login after failed reconnect Jarod Wilson
2008-02-03 22:12 ` [PATCH 8/9] firewire: fw-sbp2: sort includes Stefan Richter
2008-02-03 22:13 ` [PATCH 9/9] firewire: fw-sbp2: fix I/O errors during reconnect Stefan Richter
2008-02-11 18:09 ` Jarod Wilson
2008-02-11 20:21 ` Stefan Richter
2008-02-12 5:07 ` Jarod Wilson
2008-02-12 8:01 ` Stefan Richter
2008-02-16 15:37 ` Stefan Richter
2008-02-16 15:51 ` Stefan Richter
2008-02-04 15:54 ` [PATCH 0/9] firewire-sbp2: misc hotplug related patches John Stoffel
2008-02-04 17:48 ` Stefan Richter
2008-02-04 18:51 ` John Stoffel
2008-02-06 5:17 ` Jarod Wilson
2008-02-06 18:27 ` Stefan Richter
2008-02-06 21:09 ` [PATCH 11/9] firewire: fw-sbp2: enforce a retry of __scsi_add_device if bus generation changed Stefan Richter
2008-02-08 18:54 ` Jarod Wilson
2008-02-08 19:58 ` Stefan Richter
2008-02-08 21:33 ` [PATCH 11/9 update] " Stefan Richter
2008-02-10 18:36 ` Jarod Wilson
2008-02-16 15:01 ` Stefan Richter
2008-02-06 21:07 ` [PATCH 10/9] firewire: fw-sbp2: preemptively block sdev Stefan Richter
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=tkrat.4988439f2c8906f5@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--subject='Re: [PATCH 7/9] firewire: fw-sbp2: logout and login after failed reconnect' \
/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
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).