From: Tejun Heo Date: Sun, 2 Apr 2006 09:51:53 +0000 (+0900) Subject: [PATCH] libata: dec scmd->retries for qcs with zero err_mask X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=35e86b53b1a38e78ff0d70dae4aeb25f4572e433;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] libata: dec scmd->retries for qcs with zero err_mask qcs might get retried because of unrelated failure. e.g. NCQ command failure causes the whole command set to be aborted. Decrement scmd->retries for such retrials to avoid unnecessarily failing commands. Note that scmd->retries will be incremented the first time. Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 28706521773c..44008150d310 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c @@ -831,11 +831,14 @@ void ata_eh_qc_complete(struct ata_queued_cmd *qc) * should be retried. To be used from EH. * * SCSI midlayer limits the number of retries to scmd->allowed. - * This function might need to adjust scmd->retries for commands - * which get retried due to unrelated NCQ failures. + * scmd->retries is decremented for commands which get retried + * due to unrelated failures (qc->err_mask is zero). */ void ata_eh_qc_retry(struct ata_queued_cmd *qc) { + struct scsi_cmnd *scmd = qc->scsicmd; + if (!qc->err_mask && scmd->retries) + scmd->retries--; __ata_eh_qc_complete(qc); }