From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
sagi@grimberg.me
Subject: [PATCH V3 02/11] nvmet: return uniform error for invalid ns
Date: Tue, 9 Feb 2021 21:47:53 -0800 [thread overview]
Message-ID: <20210210054802.34269-3-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20210210054802.34269-1-chaitanya.kulkarni@wdc.com>
For nvmet_find_namespace() error case we have inconsistent error code
mapping in the function nvmet_get_smart_log_nsid() and
nvmet_set_feat_write_protect().
There is no point in retrying for the invalid namesapce from the host
side. Set the error code to the NVME_SC_INVALID_NS | NVME_SC_DNR which
matches what we have in nvmet_execute_identify_desclist().
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/target/admin-cmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 5070ea5cf260..e938064254a5 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -82,7 +82,7 @@ static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
pr_err("Could not find namespace id : %d\n",
le32_to_cpu(req->cmd->get_log_page.nsid));
req->error_loc = offsetof(struct nvme_rw_command, nsid);
- return NVME_SC_INVALID_NS;
+ return NVME_SC_INVALID_NS | NVME_SC_DNR;
}
/* we don't have the right data for file backed ns */
@@ -697,7 +697,7 @@ static u16 nvmet_set_feat_write_protect(struct nvmet_req *req)
req->ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->rw.nsid);
if (unlikely(!req->ns)) {
req->error_loc = offsetof(struct nvme_common_command, nsid);
- return status;
+ return status = NVME_SC_INVALID_NS | NVME_SC_DNR;
}
mutex_lock(&subsys->lock);
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-02-10 5:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-10 5:47 [PATCH V3 00/11] nvmet: fixes and some cleanups Chaitanya Kulkarni
2021-02-10 5:47 ` [PATCH V3 01/11] nvmet: set status to 0 in case for invalid nsid Chaitanya Kulkarni
2021-02-10 5:47 ` Chaitanya Kulkarni [this message]
2021-02-10 5:47 ` [PATCH V3 03/11] nvmet: make nvmet_find_namespace() req based Chaitanya Kulkarni
2021-02-10 5:47 ` [PATCH V3 04/11] nvmet: remove extra variable in id-ns handler Chaitanya Kulkarni
2021-02-10 5:47 ` [PATCH V3 05/11] nvmet: add helper to report invalid opcode Chaitanya Kulkarni
2021-02-10 8:12 ` Christoph Hellwig
2021-02-10 5:47 ` [PATCH V3 06/11] nvmet: use invalid cmd opcode helper Chaitanya Kulkarni
2021-02-10 5:47 ` [PATCH V3 07/11] " Chaitanya Kulkarni
2021-02-10 5:47 ` [PATCH V3 08/11] nvmet: use min of device_path and disk len Chaitanya Kulkarni
2021-02-10 8:13 ` Christoph Hellwig
2021-02-10 5:48 ` [PATCH V3 09/11] nvme-loop: rename variable to get rid of the warn Chaitanya Kulkarni
2021-02-10 8:13 ` Christoph Hellwig
2021-02-10 8:18 ` Chaitanya Kulkarni
2021-02-10 8:23 ` Christoph Hellwig
2021-02-10 5:48 ` [PATCH V3 10/11] nvmet: add nvmet_req_subsys() helper Chaitanya Kulkarni
2021-02-10 5:48 ` [PATCH V3 11/11] nvmet: remove else at the end of the function Chaitanya Kulkarni
2021-02-10 8:11 ` [PATCH V3 00/11] nvmet: fixes and some cleanups Christoph Hellwig
2021-02-10 8:52 ` Chaitanya Kulkarni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210210054802.34269-3-chaitanya.kulkarni@wdc.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).