diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-08-16 07:39:26 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-08-19 12:47:56 -0400 |
commit | a3384067fb0df9c58e112ac6a5ec9beb7d169482 (patch) | |
tree | 10000f577653a879154ee9a1eee632990980b0b8 | |
parent | c921a9745705ed62a949192ef9128c60d6c63874 (diff) |
ieee1394: sbp2: let nodemgr retry node updates during bus reset series
sbp2 was too quick to report .update() to the ieee1394 core as failed.
(Logged as "Failed to reconnect to sbp2 device!".) The core would then
unbind sbp2 from the device.
This is not justified if the .update() failed because another bus reset
happened. We check this and tell the ieee1394 that .update() succeeded,
and the core will call sbp2's .update() for the new bus reset as well.
This improves reconnection/re-login especially on buses with several
disks as they may issue bus resets in close succession when they come
online.
Tested by Damien Benoist.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | drivers/ieee1394/sbp2.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 9cbf3154d243..1d6ad3435537 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -731,15 +731,26 @@ static int sbp2_update(struct unit_directory *ud) | |||
731 | { | 731 | { |
732 | struct sbp2_lu *lu = ud->device.driver_data; | 732 | struct sbp2_lu *lu = ud->device.driver_data; |
733 | 733 | ||
734 | if (sbp2_reconnect_device(lu)) { | 734 | if (sbp2_reconnect_device(lu) != 0) { |
735 | /* Reconnect has failed. Perhaps we didn't reconnect fast | 735 | /* |
736 | * enough. Try a regular login, but first log out just in | 736 | * Reconnect failed. If another bus reset happened, |
737 | * case of any weirdness. */ | 737 | * let nodemgr proceed and call sbp2_update again later |
738 | * (or sbp2_remove if this node went away). | ||
739 | */ | ||
740 | if (!hpsb_node_entry_valid(lu->ne)) | ||
741 | return 0; | ||
742 | /* | ||
743 | * Or the target rejected the reconnect because we weren't | ||
744 | * fast enough. Try a regular login, but first log out | ||
745 | * just in case of any weirdness. | ||
746 | */ | ||
738 | sbp2_logout_device(lu); | 747 | sbp2_logout_device(lu); |
739 | 748 | ||
740 | if (sbp2_login_device(lu)) { | 749 | if (sbp2_login_device(lu) != 0) { |
741 | /* Login failed too, just fail, and the backend | 750 | if (!hpsb_node_entry_valid(lu->ne)) |
742 | * will call our sbp2_remove for us */ | 751 | return 0; |
752 | |||
753 | /* Maybe another initiator won the login. */ | ||
743 | SBP2_ERR("Failed to reconnect to sbp2 device!"); | 754 | SBP2_ERR("Failed to reconnect to sbp2 device!"); |
744 | return -EBUSY; | 755 | return -EBUSY; |
745 | } | 756 | } |