aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ahci.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-08-25 22:01:20 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-25 22:01:20 -0400
commitb8f6153ee421014f42b620238f4203a4106db309 (patch)
treeebc9eac4517325be0a91a4e2b2cb38f08d36812e /drivers/scsi/ahci.c
parent617e44fdfd7ee3d53388ab295d9411b826437ce9 (diff)
libata: fix EH locking
Wrap ata_qc_complete() calls in EH context in spinlocks, to prevent races (mainly in ATAPI code paths).
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r--drivers/scsi/ahci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 348493982b56..841f4e2cfe08 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -586,12 +586,16 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
586 586
587static void ahci_eng_timeout(struct ata_port *ap) 587static void ahci_eng_timeout(struct ata_port *ap)
588{ 588{
589 void *mmio = ap->host_set->mmio_base; 589 struct ata_host_set *host_set = ap->host_set;
590 void *mmio = host_set->mmio_base;
590 void *port_mmio = ahci_port_base(mmio, ap->port_no); 591 void *port_mmio = ahci_port_base(mmio, ap->port_no);
591 struct ata_queued_cmd *qc; 592 struct ata_queued_cmd *qc;
593 unsigned long flags;
592 594
593 DPRINTK("ENTER\n"); 595 DPRINTK("ENTER\n");
594 596
597 spin_lock_irqsave(&host_set->lock, flags);
598
595 ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); 599 ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT));
596 600
597 qc = ata_qc_from_tag(ap, ap->active_tag); 601 qc = ata_qc_from_tag(ap, ap->active_tag);
@@ -609,6 +613,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
609 ata_qc_complete(qc, ATA_ERR); 613 ata_qc_complete(qc, ATA_ERR);
610 } 614 }
611 615
616 spin_unlock_irqrestore(&host_set->lock, flags);
612} 617}
613 618
614static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) 619static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)