tree 06bd36db635380e3ba5371b15c899b3b03c095a4
parent 443d089703ffa585aea1af47c68f1be5d0ec3115
author Albert Lee <[EMAIL PROTECTED]> Tue, 16 Aug 2005 14:25:38 +0800
committer Jeff Garzik <[EMAIL PROTECTED]> Tue, 23 Aug 2005 09:03:38 -0400

[PATCH] libata: Clear ATA_QCFLAG_ACTIVE flag before calling the completion 

  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.

   - 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 <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

 drivers/scsi/libata-core.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -3213,9 +3213,14 @@ void ata_qc_complete(struct ata_queued_c
        if (likely(qc->flags & ATA_QCFLAG_DMAMAP))
+       /* 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
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to