aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-01-26 11:43:23 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2008-02-16 09:40:32 -0500
commit1b9c12ba2fdf802a23630f70eddb0e821296634e (patch)
treef581394b4d7b297619f4f0a62c490e57480fd3ec /drivers
parent05cca7381429e12d66c5b5c8b5c5848055b88bf7 (diff)
firewire: fw-sbp2: fix logout before login retry
This fixes a "can't recognize device" kind of bug. If the SCSI INQUIRY failed and hence __scsi_add_device failed due to a bus reset, we tried a logout and then waited for the already scheduled login work to happen. So far so good, but the generation used for the logout was outdated, hence the logout never reached the target. The target might therefore deny the subsequent relogin attempt, which would also leave the target inaccessible. Therefore fetch a fresh device->generation for the logout. Use memory barriers to prevent our plan being foiled by compiler or hardware optimizations. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/fw-sbp2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index f2a9a33b47a1..a15e3c7d21d3 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -716,7 +716,11 @@ static void sbp2_login(struct work_struct *work)
716 sdev = __scsi_add_device(shost, 0, 0, 716 sdev = __scsi_add_device(shost, 0, 0,
717 scsilun_to_int(&eight_bytes_lun), lu); 717 scsilun_to_int(&eight_bytes_lun), lu);
718 if (IS_ERR(sdev)) { 718 if (IS_ERR(sdev)) {
719 sbp2_send_management_orb(lu, node_id, generation, 719 smp_rmb(); /* generation may have changed */
720 generation = device->generation;
721 smp_rmb(); /* node_id must not be older than generation */
722
723 sbp2_send_management_orb(lu, device->node_id, generation,
720 SBP2_LOGOUT_REQUEST, lu->login_id, NULL); 724 SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
721 /* 725 /*
722 * Set this back to sbp2_login so we fall back and 726 * Set this back to sbp2_login so we fall back and