ANDROID: scsi: core: Limit zoned write retries

Decrement the command retry counter before retrying a zoned write.

This patch has not been posted on any Linux kernel mailing list since
there is agreement that another approach will be taken to preserve the
order of WRITE commands for zoned devices. However, the implementation
of that new approach is not yet available.

Bug: 197782466
Fixes: 33aea9741e ("ANDROID: scsi: Retry unaligned zoned writes")
Fixes: If89c1f0b4d382978c52382dd3634f39fc15bcaf0
Change-Id: Idec66e2f5a8ee7ab218cdbcdb308f0bf2e9802fe
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2023-02-22 11:29:15 -08:00
parent 513a00a71c
commit 3bfdcf06e4

View File

@@ -675,8 +675,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)
* Unaligned write command. This indicates that zoned writes got
* reordered. Retry after all pending commands have completed.
*/
if (sshdr.asc == 0x21 && sshdr.ascq == 0x04)
return NEEDS_DELAYED_RETRY;
if (sshdr.asc == 0x21 && sshdr.ascq == 0x04) {
return scsi_cmd_retry_allowed(scmd) &&
!scsi_noretry_cmd(scmd) ? NEEDS_DELAYED_RETRY :
SUCCESS;
}
if (sshdr.asc == 0x20 || /* Invalid command operation code */
sshdr.asc == 0x21 || /* Logical block address out of range */
sshdr.asc == 0x22 || /* Invalid function */