Skip to content

Commit 79695dc

Browse files
puhouChristoph Hellwig
authored and
Christoph Hellwig
committed
nvmet: return proper error code from discovery ctrl
Return NVME_SC_INVALID_FIELD from discovery controller like normal controller when executing identify or get log page command. Signed-off-by: Hou Pu <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ed4a854 commit 79695dc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/nvme/target/discovery.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,14 @@ static void nvmet_execute_disc_get_log_page(struct nvmet_req *req)
178178
if (req->cmd->get_log_page.lid != NVME_LOG_DISC) {
179179
req->error_loc =
180180
offsetof(struct nvme_get_log_page_command, lid);
181-
status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
181+
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
182182
goto out;
183183
}
184184

185185
/* Spec requires dword aligned offsets */
186186
if (offset & 0x3) {
187+
req->error_loc =
188+
offsetof(struct nvme_get_log_page_command, lpo);
187189
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
188190
goto out;
189191
}
@@ -250,7 +252,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
250252

251253
if (req->cmd->identify.cns != NVME_ID_CNS_CTRL) {
252254
req->error_loc = offsetof(struct nvme_identify, cns);
253-
status = NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
255+
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
254256
goto out;
255257
}
256258

0 commit comments

Comments
 (0)