Skip to content

Commit d8f53b0

Browse files
damien-lemoalaxboe
authored andcommitted
scsi: handle zone resources errors
ZBC or ZAC disks that have a limit on the number of open zones may fail a zone open command or a write to a zone that is not already implicitly or explicitly open if the total number of open zones is already at the maximum allowed. For these operations, instead of returning the generic BLK_STS_IOERR, return BLK_STS_ZONE_OPEN_RESOURCE which is returned as -ETOOMANYREFS to the I/O issuer, allowing the device user to act appropriately on these relatively benign zone resource errors. Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent afaf5c6 commit d8f53b0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/scsi/scsi_lib.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,15 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
758758
/* See SSC3rXX or current. */
759759
action = ACTION_FAIL;
760760
break;
761+
case DATA_PROTECT:
762+
action = ACTION_FAIL;
763+
if ((sshdr.asc == 0x0C && sshdr.ascq == 0x12) ||
764+
(sshdr.asc == 0x55 &&
765+
(sshdr.ascq == 0x0E || sshdr.ascq == 0x0F))) {
766+
/* Insufficient zone resources */
767+
blk_stat = BLK_STS_ZONE_OPEN_RESOURCE;
768+
}
769+
break;
761770
default:
762771
action = ACTION_FAIL;
763772
break;

0 commit comments

Comments
 (0)