Commit edc1f543 authored by Damien Le Moal's avatar Damien Le Moal Committed by Martin K. Petersen

scsi: sd_zbc: Fix sd_zbc_complete()

The ILLEGAL REQUEST/INVALID FIELD IN CDB error generated by an attempt to
reset a conventional zone does not apply to the reset write pointer command
with the ALL bit set, that is, to REQ_OP_ZONE_RESET_ALL requests. Fix
sd_zbc_complete() to be quiet only in the case of REQ_OP_ZONE_RESET,
excluding REQ_OP_ZONE_RESET_ALL.

Since REQ_OP_ZONE_RESET is the only request handled by sd_zbc_complete(),
also simplify the code using a simple if statement.

[mkp: applied by hand]

Fixes: d81e9d49 ("scsi: implement REQ_OP_ZONE_RESET_ALL")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20191027140549.26272-4-damien.lemoal@wdc.comSigned-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent da0c9ea1
...@@ -263,25 +263,16 @@ void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes, ...@@ -263,25 +263,16 @@ void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
int result = cmd->result; int result = cmd->result;
struct request *rq = cmd->request; struct request *rq = cmd->request;
switch (req_op(rq)) { if (req_op(rq) == REQ_OP_ZONE_RESET &&
case REQ_OP_ZONE_RESET: result &&
case REQ_OP_ZONE_RESET_ALL:
if (result &&
sshdr->sense_key == ILLEGAL_REQUEST && sshdr->sense_key == ILLEGAL_REQUEST &&
sshdr->asc == 0x24) sshdr->asc == 0x24) {
/* /*
* INVALID FIELD IN CDB error: reset of a conventional * INVALID FIELD IN CDB error: reset of a conventional
* zone was attempted. Nothing to worry about, so be * zone was attempted. Nothing to worry about, so be
* quiet about the error. * quiet about the error.
*/ */
rq->rq_flags |= RQF_QUIET; rq->rq_flags |= RQF_QUIET;
break;
case REQ_OP_WRITE:
case REQ_OP_WRITE_ZEROES:
case REQ_OP_WRITE_SAME:
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment