Thread (10 messages) 10 messages, 2 authors, 2021-02-24

Re: [PATCH 3/6] nvmet: check and set the right err location

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-24 16:31:32

On Tue, Feb 16, 2021 at 01:31:09PM -0800, Chaitanya Kulkarni wrote:
quoted hunk ↗ jump to hunk
The function nvmet_execute_admin_connect() doesn't check for the right
error status value that is return from the nvmet_alloc_ctrl().

Check for NVME_SC_CONNECT_INVALID_PARAM & NVME_SC_CONNECT_INVALID_HOST
before we update the error log.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 drivers/nvme/target/fabrics-cmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index 42bd12b8bf00..cf0baa911db2 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -191,9 +191,10 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
 	status = nvmet_alloc_ctrl(d->subsysnqn, d->hostnqn, req,
 				  le32_to_cpu(c->kato), &ctrl);
 	if (status) {
-		if (status == (NVME_SC_INVALID_FIELD | NVME_SC_DNR))
+		if (status == (NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR) ||
+		    status == (NVME_SC_CONNECT_INVALID_HOST | NVME_SC_DNR))
 			req->error_loc =
-				offsetof(struct nvme_common_command, opcode);
+				offsetof(struct nvme_common_command, dptr);
Can we just set req->error_loc inside of nvmet_alloc_ctrl?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help