--- linux/drivers/scsi/libata-core.c.ori 2005-06-30 17:16:28.000000000 +0800 +++ linux/drivers/scsi/libata-core.c 2005-06-30 17:35:50.000000000 +0800 @@ -3086,9 +3086,14 @@ if (likely(qc->flags & ATA_QCFLAG_DMAMAP)) ata_sg_clean(qc); + /* atapi: inactivate qc to prevent the interrupt handler from + * completing the command twice, before the scsi error handler + * is called. + */ + qc->flags &= ~ATA_QCFLAG_ACTIVE; + /* call completion callback */ rc = qc->complete_fn(qc, drv_stat); - qc->flags &= ~ATA_QCFLAG_ACTIVE; /* if callback indicates not to complete command (non-zero), * return immediately