Skip to content

Commit

Permalink
[PATCH] libata: don't schedule EH on wcache on/off if old EH
Browse files Browse the repository at this point in the history
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 <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Nov 28, 2006
1 parent 2ea5814 commit c31f571
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm

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);
Expand All @@ -1459,11 +1460,12 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
* 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
Expand All @@ -1490,8 +1492,8 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
}
}

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

Expand Down

0 comments on commit c31f571

Please sign in to comment.