aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-sbp2.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-01-27 13:14:44 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2008-02-16 09:40:33 -0500
commitbe6f48b0174584c9c415012ca14803c7e941e27e (patch)
treecb9d0ee9363ee2782cc17dac772c767d77ab8c8e /drivers/firewire/fw-sbp2.c
parent96b19062e741b715cf399312c30e0672d8889569 (diff)
firewire: fw-sbp2: don't retry login or reconnect after unplug
If a device is being unplugged while fw-sbp2 had a login or reconnect on schedule, it would take about half a minute to shut the fw_unit down: Jan 27 18:34:54 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries) <unplug> Jan 27 18:34:59 stein firewire_sbp2: sbp2_scsi_abort Jan 27 18:34:59 stein scsi 25:0:0:0: Device offlined - not ready after error recovery Jan 27 18:35:01 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:06 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:12 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:17 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:22 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:27 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:32 stein firewire_sbp2: orb reply timed out, rcode=0x11 Jan 27 18:35:32 stein firewire_sbp2: failed to login to fw2.0 LUN 0000 Jan 27 18:35:32 stein firewire_sbp2: released fw2.0 After this patch, typically only a few seconds spent in __scsi_add_device remain: Jan 27 19:05:50 stein firewire_sbp2: logged in to fw2.0 LUN 0000 (0 retries) <unplug> Jan 27 19:05:56 stein firewire_sbp2: sbp2_scsi_abort Jan 27 19:05:56 stein scsi 33:0:0:0: Device offlined - not ready after error recovery Jan 27 19:05:56 stein firewire_sbp2: released fw2.0 The benefit of this is less noise in the syslog. It furthermore avoids a few wasted CPU cycles and needlessly prolonged lifetime of a few driver objects. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r--drivers/firewire/fw-sbp2.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index a15e3c7d21d3..72fddf5a12a3 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -499,6 +499,9 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
499 unsigned int timeout; 499 unsigned int timeout;
500 int retval = -ENOMEM; 500 int retval = -ENOMEM;
501 501
502 if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device))
503 return 0;
504
502 orb = kzalloc(sizeof(*orb), GFP_ATOMIC); 505 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
503 if (orb == NULL) 506 if (orb == NULL)
504 return -ENOMEM; 507 return -ENOMEM;
@@ -619,16 +622,13 @@ static void sbp2_release_target(struct kref *kref)
619 struct sbp2_logical_unit *lu, *next; 622 struct sbp2_logical_unit *lu, *next;
620 struct Scsi_Host *shost = 623 struct Scsi_Host *shost =
621 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 624 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
622 struct fw_device *device = fw_device(tgt->unit->device.parent);
623 625
624 list_for_each_entry_safe(lu, next, &tgt->lu_list, link) { 626 list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
625 if (lu->sdev) 627 if (lu->sdev)
626 scsi_remove_device(lu->sdev); 628 scsi_remove_device(lu->sdev);
627 629
628 if (!fw_device_is_shutdown(device)) 630 sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
629 sbp2_send_management_orb(lu, tgt->node_id, 631 SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
630 lu->generation, SBP2_LOGOUT_REQUEST,
631 lu->login_id, NULL);
632 632
633 fw_core_remove_address_handler(&lu->address_handler); 633 fw_core_remove_address_handler(&lu->address_handler);
634 list_del(&lu->link); 634 list_del(&lu->link);
@@ -673,6 +673,9 @@ static void sbp2_login(struct work_struct *work)
673 struct sbp2_login_response response; 673 struct sbp2_login_response response;
674 int generation, node_id, local_node_id; 674 int generation, node_id, local_node_id;
675 675
676 if (fw_device_is_shutdown(device))
677 goto out;
678
676 generation = device->generation; 679 generation = device->generation;
677 smp_rmb(); /* node_id must not be older than generation */ 680 smp_rmb(); /* node_id must not be older than generation */
678 node_id = device->node_id; 681 node_id = device->node_id;
@@ -944,6 +947,9 @@ static void sbp2_reconnect(struct work_struct *work)
944 struct fw_device *device = fw_device(unit->device.parent); 947 struct fw_device *device = fw_device(unit->device.parent);
945 int generation, node_id, local_node_id; 948 int generation, node_id, local_node_id;
946 949
950 if (fw_device_is_shutdown(device))
951 goto out;
952
947 generation = device->generation; 953 generation = device->generation;
948 smp_rmb(); /* node_id must not be older than generation */ 954 smp_rmb(); /* node_id must not be older than generation */
949 node_id = device->node_id; 955 node_id = device->node_id;