libata: fix eh locking
The SCSI host eh_cmd_q should be protected by the host lock (not the port lock). This probably doesn't matter that much at the moment, since we try to serialise the add and eh pieces, but it might matter in future for more convenient error handling. Plus this switches libata to the standard eh pattern where you lock, remove from the cmd queue to a local list and unlock and then operate on the local list. Signed-off-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
This commit is contained in:
Родитель
a29b5dad46
Коммит
c34aeebc06
|
@ -589,9 +589,14 @@ void ata_scsi_error(struct Scsi_Host *host)
|
||||||
struct ata_port *ap = ata_shost_to_port(host);
|
struct ata_port *ap = ata_shost_to_port(host);
|
||||||
int i;
|
int i;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
LIST_HEAD(eh_work_q);
|
||||||
|
|
||||||
DPRINTK("ENTER\n");
|
DPRINTK("ENTER\n");
|
||||||
|
|
||||||
|
spin_lock_irqsave(host->host_lock, flags);
|
||||||
|
list_splice_init(&host->eh_cmd_q, &eh_work_q);
|
||||||
|
spin_unlock_irqrestore(host->host_lock, flags);
|
||||||
|
|
||||||
/* make sure sff pio task is not running */
|
/* make sure sff pio task is not running */
|
||||||
ata_sff_flush_pio_task(ap);
|
ata_sff_flush_pio_task(ap);
|
||||||
|
|
||||||
|
@ -627,7 +632,7 @@ void ata_scsi_error(struct Scsi_Host *host)
|
||||||
if (ap->ops->lost_interrupt)
|
if (ap->ops->lost_interrupt)
|
||||||
ap->ops->lost_interrupt(ap);
|
ap->ops->lost_interrupt(ap);
|
||||||
|
|
||||||
list_for_each_entry_safe(scmd, tmp, &host->eh_cmd_q, eh_entry) {
|
list_for_each_entry_safe(scmd, tmp, &eh_work_q, eh_entry) {
|
||||||
struct ata_queued_cmd *qc;
|
struct ata_queued_cmd *qc;
|
||||||
|
|
||||||
for (i = 0; i < ATA_MAX_QUEUE; i++) {
|
for (i = 0; i < ATA_MAX_QUEUE; i++) {
|
||||||
|
@ -762,7 +767,7 @@ void ata_scsi_error(struct Scsi_Host *host)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finish or retry handled scmd's and clean up */
|
/* finish or retry handled scmd's and clean up */
|
||||||
WARN_ON(host->host_failed || !list_empty(&host->eh_cmd_q));
|
WARN_ON(host->host_failed || !list_empty(&eh_work_q));
|
||||||
|
|
||||||
scsi_eh_flush_done_q(&ap->eh_done_q);
|
scsi_eh_flush_done_q(&ap->eh_done_q);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче