Skip to content

Commit 10f4a7c

Browse files
keithbuschChristoph Hellwig
authored andcommitted
nvme: fix command limits status code
The command specific status code, 0x183, was introduced in the NVMe 2.0 specification defined to "Command Size Limits Exceeded" and only ever applied to DSM and Copy commands. Fix the name and, remove the incorrect translation to error codes and special treatment in the target code for it. Fixes: 3b7c33b ("nvme.h: add Write Zeroes definitions") Cc: Chaitanya Kulkarni <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent a2f4c1a commit 10f4a7c

File tree

6 files changed

+4
-21
lines changed

6 files changed

+4
-21
lines changed

drivers/nvme/host/constants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static const char * const nvme_statuses[] = {
145145
[NVME_SC_BAD_ATTRIBUTES] = "Conflicting Attributes",
146146
[NVME_SC_INVALID_PI] = "Invalid Protection Information",
147147
[NVME_SC_READ_ONLY] = "Attempted Write to Read Only Range",
148-
[NVME_SC_ONCS_NOT_SUPPORTED] = "ONCS Not Supported",
148+
[NVME_SC_CMD_SIZE_LIM_EXCEEDED ] = "Command Size Limits Exceeded",
149149
[NVME_SC_ZONE_BOUNDARY_ERROR] = "Zoned Boundary Error",
150150
[NVME_SC_ZONE_FULL] = "Zone Is Full",
151151
[NVME_SC_ZONE_READ_ONLY] = "Zone Is Read Only",

drivers/nvme/host/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ static blk_status_t nvme_error_status(u16 status)
290290
case NVME_SC_NS_NOT_READY:
291291
return BLK_STS_TARGET;
292292
case NVME_SC_BAD_ATTRIBUTES:
293-
case NVME_SC_ONCS_NOT_SUPPORTED:
294293
case NVME_SC_INVALID_OPCODE:
295294
case NVME_SC_INVALID_FIELD:
296295
case NVME_SC_INVALID_NS:

drivers/nvme/host/pr.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ static int nvme_status_to_pr_err(int status)
8282
return PR_STS_SUCCESS;
8383
case NVME_SC_RESERVATION_CONFLICT:
8484
return PR_STS_RESERVATION_CONFLICT;
85-
case NVME_SC_ONCS_NOT_SUPPORTED:
86-
return -EOPNOTSUPP;
8785
case NVME_SC_BAD_ATTRIBUTES:
8886
case NVME_SC_INVALID_OPCODE:
8987
case NVME_SC_INVALID_FIELD:

drivers/nvme/target/core.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,7 @@ inline u16 errno_to_nvme_status(struct nvmet_req *req, int errno)
6262
return NVME_SC_LBA_RANGE | NVME_STATUS_DNR;
6363
case -EOPNOTSUPP:
6464
req->error_loc = offsetof(struct nvme_common_command, opcode);
65-
switch (req->cmd->common.opcode) {
66-
case nvme_cmd_dsm:
67-
case nvme_cmd_write_zeroes:
68-
return NVME_SC_ONCS_NOT_SUPPORTED | NVME_STATUS_DNR;
69-
default:
70-
return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
71-
}
72-
break;
65+
return NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
7366
case -ENODATA:
7467
req->error_loc = offsetof(struct nvme_rw_command, nsid);
7568
return NVME_SC_ACCESS_DENIED;

drivers/nvme/target/io-cmd-bdev.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,8 @@ u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts)
145145
req->error_loc = offsetof(struct nvme_rw_command, slba);
146146
break;
147147
case BLK_STS_NOTSUPP:
148+
status = NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
148149
req->error_loc = offsetof(struct nvme_common_command, opcode);
149-
switch (req->cmd->common.opcode) {
150-
case nvme_cmd_dsm:
151-
case nvme_cmd_write_zeroes:
152-
status = NVME_SC_ONCS_NOT_SUPPORTED | NVME_STATUS_DNR;
153-
break;
154-
default:
155-
status = NVME_SC_INVALID_OPCODE | NVME_STATUS_DNR;
156-
}
157150
break;
158151
case BLK_STS_MEDIUM:
159152
status = NVME_SC_ACCESS_DENIED;

include/linux/nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,7 @@ enum {
21712171
NVME_SC_BAD_ATTRIBUTES = 0x180,
21722172
NVME_SC_INVALID_PI = 0x181,
21732173
NVME_SC_READ_ONLY = 0x182,
2174-
NVME_SC_ONCS_NOT_SUPPORTED = 0x183,
2174+
NVME_SC_CMD_SIZE_LIM_EXCEEDED = 0x183,
21752175

21762176
/*
21772177
* I/O Command Set Specific - Fabrics commands:

0 commit comments

Comments
 (0)