Skip to content

Commit edc1f54

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
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: d81e9d4 ("scsi: implement REQ_OP_ZONE_RESET_ALL") Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent da0c9ea commit edc1f54

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

drivers/scsi/sd_zbc.c

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -263,25 +263,16 @@ void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
263263
int result = cmd->result;
264264
struct request *rq = cmd->request;
265265

266-
switch (req_op(rq)) {
267-
case REQ_OP_ZONE_RESET:
268-
case REQ_OP_ZONE_RESET_ALL:
269-
270-
if (result &&
271-
sshdr->sense_key == ILLEGAL_REQUEST &&
272-
sshdr->asc == 0x24)
273-
/*
274-
* INVALID FIELD IN CDB error: reset of a conventional
275-
* zone was attempted. Nothing to worry about, so be
276-
* quiet about the error.
277-
*/
278-
rq->rq_flags |= RQF_QUIET;
279-
break;
280-
281-
case REQ_OP_WRITE:
282-
case REQ_OP_WRITE_ZEROES:
283-
case REQ_OP_WRITE_SAME:
284-
break;
266+
if (req_op(rq) == REQ_OP_ZONE_RESET &&
267+
result &&
268+
sshdr->sense_key == ILLEGAL_REQUEST &&
269+
sshdr->asc == 0x24) {
270+
/*
271+
* INVALID FIELD IN CDB error: reset of a conventional
272+
* zone was attempted. Nothing to worry about, so be
273+
* quiet about the error.
274+
*/
275+
rq->rq_flags |= RQF_QUIET;
285276
}
286277
}
287278

0 commit comments

Comments
 (0)