Skip to content

Commit

Permalink
[PATCH] libata: Clear ATA_QCFLAG_ACTIVE flag before calling the compl…
Browse files Browse the repository at this point in the history
…etion callback

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

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
  • Loading branch information
Albert Lee authored and Jeff Garzik committed Aug 23, 2005
1 parent 443d089 commit 3f3791d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3213,9 +3213,14 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
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
Expand Down

0 comments on commit 3f3791d

Please sign in to comment.