libata: Clear ATA_QCFLAG_ACTIVE flag before calling the completion callback
PATCH 1/1 libata: Clear ATA_QCFLAG_ACTIVE flag before calling the completion callback
Jeff,
Description:
After calling the completion callback, the libata error handler might be
running and getting atapi sense data. Clearing the ATA_QCFLAG_ACTIVE flag at this point might interfere with the libata error handler.
Changes:
- Clear the ATA_QCFLAG_ACTIVE flag before calling the completion callback (and also before the error handler)
- Add some comment
Resend for 2.6.13-rc6(3edea4833a1efcd43e1dff082bc8001fdfe74b34). For your review, thanks.
Albert
Signed-off-by Albert Lee <[email protected]>
drivers/scsi/libata-core.c +6 -1
@@ -3086,9 +3086,14 @@if (likely (qc->flags &ATA_QCFLAG_DMAMAP ))ata_sg_clean (qc); +/* atapi: mark qc as inactive to prevent the interrupt handler +* from completing the command twice later, before the error handler +* is called. (when rc != 0 and atapi request sense is needed) +*/ + 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
Jeff Garzik
Appliedapplied