[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ide
Subject:    [PATCH] libata: Fix failed assertion in ata_qc_complete()
From:       Albert Lee <albertcc () tw ! ibm ! com>
Date:       2005-06-30 9:56:16
Message-ID: 42C3C1C0.2040501 () tw ! ibm ! com
[Download RAW message or body]

Hi Jeff,

(This is the patch #4 in the summary.)
Problem:
    'assert(qc->flags & ATA_QCFLAG_ACTIVE)' assertion failed in ata_pio_complete().

Root cause:
  Please see the detailed dmesg log in the follow-up mail.

Change:
- Reorder the clearing of the 'qc->flags &= ~ATA_QCFLAG_ACTIVE' flag to
   be _before_ 'qc->complete_fn(qc, drv_stat)' instead of _after_.
- Add a comment per Tejun's advice.

Attached please find the patch against the linux-2.6.git tree
(HEAD 9b4311eedb17fa88f02e4876cd6aa9a08e383cd6) for your review. Thanks.

Albert

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>


["patch.diff" (text/plain)]

--- 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

-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic