aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 914170bb50a8..80ab65161750 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -710,6 +710,11 @@ static void sbp2_login(struct work_struct *work)
710 node_id = device->node_id; 710 node_id = device->node_id;
711 local_node_id = device->card->node_id; 711 local_node_id = device->card->node_id;
712 712
713 /* If this is a re-login attempt, log out, or we might be rejected. */
714 if (lu->sdev)
715 sbp2_send_management_orb(lu, device->node_id, generation,
716 SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
717
713 if (sbp2_send_management_orb(lu, node_id, generation, 718 if (sbp2_send_management_orb(lu, node_id, generation,
714 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { 719 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
715 if (lu->retries++ < 5) 720 if (lu->retries++ < 5)
@@ -997,9 +1002,17 @@ static void sbp2_reconnect(struct work_struct *work)
997 if (sbp2_send_management_orb(lu, node_id, generation, 1002 if (sbp2_send_management_orb(lu, node_id, generation,
998 SBP2_RECONNECT_REQUEST, 1003 SBP2_RECONNECT_REQUEST,
999 lu->login_id, NULL) < 0) { 1004 lu->login_id, NULL) < 0) {
1000 if (lu->retries++ >= 5) { 1005 /*
1006 * If reconnect was impossible even though we are in the
1007 * current generation, fall back and try to log in again.
1008 *
1009 * We could check for "Function rejected" status, but
1010 * looking at the bus generation as simpler and more general.
1011 */
1012 smp_rmb(); /* get current card generation */
1013 if (generation == device->card->generation ||
1014 lu->retries++ >= 5) {
1001 fw_error("%s: failed to reconnect\n", tgt->bus_id); 1015 fw_error("%s: failed to reconnect\n", tgt->bus_id);
1002 /* Fall back and try to log in again. */
1003 lu->retries = 0; 1016 lu->retries = 0;
1004 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 1017 PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
1005 } 1018 }