From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [patch amendment] ieee1394: survive a few seconds connection loss
Date: Fri, 10 Oct 2008 19:13:34 +0200 (CEST) [thread overview]
Message-ID: <tkrat.8c2b7db60bf8ee9c@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.51d4828de9d3aee3@s5r6.in-berlin.de>
On 19 Aug, Stefan Richter wrote:
> There are situations when nodes vanish from the bus and come back in
> quickly thereafter:
> - When certain bus-powered hubs are plugged in,
> - when certain disk enclosures are switched from self-power to bus
> power or vice versa and break the daisy chain during the transition,
> - when the user plugs a cable out and quickly plugs it back in, e.g.
> to reorder a daisy chain (works on Mac OS X if done quickly enough),
> - when certain hubs temporarily malfunction during high bus traffic.
>
> The ieee1394 driver's nodemgr already contained a function to set
> vanished nodes aside into "limbo"; i.e. they wouldn't actually be
> deleted right away. (In fact, only unloading the driver or writing into
> an obscure sysfs attribute would delete them eventually.) If nodes
> reappeared later, they would be resurrected out of limbo.
>
> Moving nodes into and out of limbo was accompanied with calling the
> .suspend() and .resume() driver methods of the drivers which were bound
> to a respective node's unit directories. Not only is this somewhat
> strange due to the primary use of these drivers for power management,
> also the sbp2 driver in particular does not implement .suspend() and
> .resume().
>
> Hence sbp2 would be disconnected from devices in situations as listed
> above.
>
> We now:
> - leave drivers bound when nodes go into limbo,
> - call the drivers' .update() when nodes come out of limbo,
> - automatically delete in-limbo nodes 5 seconds after the last
> bus reset and bus rescan.
> - Because of the automatic removal, the now obsolete bus attribute
> /sys/bus/ieee1394/destroy_node is removed.
>
> This especially lets sbp2 survive brief disconnections. You can for
> example yank a disk's cable and plug it back in while reading the
> respective disk with dd, but dd will happily continue as if nothing
> happened.
Amendment: Reduce timeout from 5 to 3 seconds. This is enough because
the timeout is restarted if another bus reset happened during the
timeout.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/ieee1394/nodemgr.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Index: linux/drivers/ieee1394/nodemgr.c
===================================================================
--- linux.orig/drivers/ieee1394/nodemgr.c
+++ linux/drivers/ieee1394/nodemgr.c
@@ -1726,18 +1726,17 @@ static int nodemgr_host_thread(void *dat
/* Update some of our sysfs symlinks */
nodemgr_update_host_dev_links(host);
- /* Sleep 5 seconds */
- for (i = 0; i < 5000/100 ; i++) {
- msleep_interruptible(100);
+ /* Sleep 3 seconds */
+ for (i = 3000/200; i; i--) {
+ msleep_interruptible(200);
if (kthread_should_stop())
goto exit;
if (generation != get_hpsb_generation(host))
break;
}
-
/* Remove nodes which are gone, unless a bus reset happened */
- if (i == 5000/100)
+ if (!i)
nodemgr_remove_nodes_in_limbo(host);
}
exit:
--
Stefan Richter
-=====-==--- =-=- -=-=-
http://arcgraph.de/sr/
prev parent reply other threads:[~2008-10-10 17:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <994096.81924.qm@web50505.mail.re2.yahoo.com>
[not found] ` <48A5A80A.90506@s5r6.in-berlin.de>
[not found] ` <48A6BA6F.2030000@s5r6.in-berlin.de>
2008-08-16 11:36 ` [patch 1/3] ieee1394: regression in 2.6.25: updates should happen before probes Stefan Richter
2008-08-16 11:38 ` [patch 2/3] ieee1394: don't drop nodes during bus reset series Stefan Richter
2008-08-16 11:39 ` [patch 3/3] ieee1394: sbp2: let nodemgr retry node updates " Stefan Richter
2008-08-19 19:28 ` [patch 2/3] ieee1394: don't drop nodes " Stefan Richter
2008-08-19 19:29 ` [patch 1/2] ieee1394: nodemgr clean up class iterators Stefan Richter
2008-08-19 19:30 ` [patch 2/2] ieee1394: survive a few seconds connection loss Stefan Richter
2008-10-10 17:13 ` Stefan Richter [this message]
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.8c2b7db60bf8ee9c@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®