[PATCH 3/6] nvmet: check and set the right err location
Christoph Hellwig
hch at lst.de
Wed Feb 24 11:31:16 EST 2021
On Tue, Feb 16, 2021 at 01:31:09PM -0800, Chaitanya Kulkarni wrote:
> 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 <chaitanya.kulkarni at wdc.com>
> ---
> 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?
More information about the Linux-nvme
mailing list