commit c31f571d9f42fa2e89148811730fe3dc64943a6e
tree 0b2be4fe17824d8dc89e9c838e9f8ff934472504
parent 2ea5814472c3c910aed5c5b60f1f3b1000e353f1
author Tejun Heo <[EMAIL PROTECTED]> 1164166783 +0900
committer Jeff Garzik <[EMAIL PROTECTED]> 1164703513 -0500

[PATCH] libata: don't schedule EH on wcache on/off if old EH

Do not schedule EH for revalidation on wcache on/off if old EH.  Old
EH cannot handle it and will result in WARN_ON()'s and oops.

This closes bug #7412.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

 drivers/ata/libata-scsi.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 5c1fc46..22643c0 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1451,6 +1451,7 @@ nothing_to_do:
 
 static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
 {
+       struct ata_port *ap = qc->ap;
        struct scsi_cmnd *cmd = qc->scsicmd;
        u8 *cdb = cmd->cmnd;
        int need_sense = (qc->err_mask != 0);
@@ -1459,11 +1460,12 @@ static void ata_scsi_qc_complete(struct
         * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
         * cache
         */
-       if (!need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) &&
+       if (ap->ops->error_handler &&
+           !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) &&
            ((qc->tf.feature == SETFEATURES_WC_ON) ||
             (qc->tf.feature == SETFEATURES_WC_OFF))) {
-               qc->ap->eh_info.action |= ATA_EH_REVALIDATE;
-               ata_port_schedule_eh(qc->ap);
+               ap->eh_info.action |= ATA_EH_REVALIDATE;
+               ata_port_schedule_eh(ap);
        }
 
        /* For ATA pass thru (SAT) commands, generate a sense block if
@@ -1490,8 +1492,8 @@ static void ata_scsi_qc_complete(struct
                }
        }
 
-       if (need_sense && !qc->ap->ops->error_handler)
-               ata_dump_status(qc->ap->id, &qc->result_tf);
+       if (need_sense && !ap->ops->error_handler)
+               ata_dump_status(ap->id, &qc->result_tf);
 
        qc->scsidone(cmd);
 
-
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  http://vger.kernel.org/majordomo-info.html

Reply via email to