Skip to content

Commit 6584b79

Browse files
ipylypivgregkh
authored andcommitted
ata: libata-scsi: fix requeue of deferred ATA PASS-THROUGH commands
[ Upstream commit 8ebf408 ] Commit 0ea8408 ("ata: libata-scsi: avoid Non-NCQ command starvation") introduced ata_scsi_requeue_deferred_qc() to handle commands deferred during resets or NCQ failures. This deferral logic completed commands with DID_SOFT_ERROR to trigger a retry in the SCSI mid-layer. However, DID_SOFT_ERROR is subject to scsi_cmd_retry_allowed() checks. ATA PASS-THROUGH commands sent via SG_IO ioctl have scmd->allowed set to zero. This causes the mid-layer to fail the command immediately instead of retrying, even though the command was never actually issued to the hardware. Switch to DID_REQUEUE to ensure these commands are inserted back into the request queue regardless of retry limits. Fixes: 0ea8408 ("ata: libata-scsi: avoid Non-NCQ command starvation") Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Igor Pylypiv <ipylypiv@google.com> Signed-off-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 86bc4b1 commit 6584b79

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/ata/libata-scsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ void ata_scsi_requeue_deferred_qc(struct ata_port *ap)
17051705
/*
17061706
* If we have a deferred qc when a reset occurs or NCQ commands fail,
17071707
* do not try to be smart about what to do with this deferred command
1708-
* and simply retry it by completing it with DID_SOFT_ERROR.
1708+
* and simply requeue it by completing it with DID_REQUEUE.
17091709
*/
17101710
if (!qc)
17111711
return;
@@ -1714,7 +1714,7 @@ void ata_scsi_requeue_deferred_qc(struct ata_port *ap)
17141714
ap->deferred_qc = NULL;
17151715
cancel_work(&ap->deferred_qc_work);
17161716
ata_qc_free(qc);
1717-
scmd->result = (DID_SOFT_ERROR << 16);
1717+
scmd->result = (DID_REQUEUE << 16);
17181718
scsi_done(scmd);
17191719
}
17201720

0 commit comments

Comments
 (0)