Skip to content

Commit

Permalink
[SCSI] aacraid: Better handling of in-flight events on thread stop
Browse files Browse the repository at this point in the history
When an error occured that would shut down the driver, some in-flight
events were getting caught up, deadlocking a CPU or two.

Signed-off-by: Ben Collins <[email protected]>
Acked-by: Achim Leubner <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
benmcollins authored and James Bottomley committed Jul 20, 2012
1 parent ff08784 commit 361ee9c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/scsi/aacraid/linit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,8 +1089,17 @@ static struct scsi_host_template aac_driver_template = {

static void __aac_shutdown(struct aac_dev * aac)
{
if (aac->aif_thread)
if (aac->aif_thread) {
int i;
/* Clear out events first */
for (i = 0; i < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++) {
struct fib *fib = &aac->fibs[i];
if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) &&
(fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected)))
up(&fib->event_wait);
}
kthread_stop(aac->thread);
}
aac_send_shutdown(aac);
aac_adapter_disable_int(aac);
free_irq(aac->pdev->irq, aac);
Expand Down Expand Up @@ -1191,6 +1200,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
if (IS_ERR(aac->thread)) {
printk(KERN_ERR "aacraid: Unable to create command thread.\n");
error = PTR_ERR(aac->thread);
aac->thread = NULL;
goto out_deinit;
}

Expand Down

0 comments on commit 361ee9c

Please sign in to comment.