linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me
Subject: Re: [PATVH V2 1/3] nvmet: add ns tear down label for pt-cmd handling
Date: Thu, 6 Aug 2020 22:31:07 -0600	[thread overview]
Message-ID: <c40a3189-9417-9dd7-7ae6-7cc26815c90c@deltatee.com> (raw)
In-Reply-To: <20200807022032.48873-2-chaitanya.kulkarni@wdc.com>



On 2020-08-06 8:20 p.m., Chaitanya Kulkarni wrote:
> In the current implementation before submitting the passthru cmd we
> may come across error e.g. getting ns from passthru controller,
> allocating a request from passthru controller, etc. For all the failure
> cases it only uses single goto label fail_out.
> 
> In the target code, we follow the pattern to have a separate label for
> each error out the case when setting up multiple things before the actual
> action.
> 
> This patch follows the same pattern and renames generic fail_out label
> to out_put_ns and updates the error out cases in the
> nvmet_passthru_execute_cmd() where it is needed.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/nvme/target/passthru.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
> index 89d91dc999a6..e7dbca12785d 100644
> --- a/drivers/nvme/target/passthru.c
> +++ b/drivers/nvme/target/passthru.c
> @@ -230,7 +230,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
>  		if (unlikely(!ns)) {
>  			pr_err("failed to get passthru ns nsid:%u\n", nsid);
>  			status = NVME_SC_INVALID_NS | NVME_SC_DNR;
> -			goto fail_out;
> +			goto out;

Not sure it's necessary to have this extra label seeing "if (ns)" takes
care of things. But, I guess, it doesn't really hurt.

For both this patch and the next one:

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>

Logan

>  		}
>  
>  		q = ns->queue;
> @@ -240,14 +240,14 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
>  	if (IS_ERR(rq)) {
>  		rq = NULL;
>  		status = NVME_SC_INTERNAL;
> -		goto fail_out;
> +		goto out_put_ns;
>  	}
>  
>  	if (req->sg_cnt) {
>  		ret = nvmet_passthru_map_sg(req, rq);
>  		if (unlikely(ret)) {
>  			status = NVME_SC_INTERNAL;
> -			goto fail_out;
> +			goto out_put_ns;
>  		}
>  	}
>  
> @@ -274,9 +274,10 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
>  
>  	return;
>  
> -fail_out:
> +out_put_ns:
>  	if (ns)
>  		nvme_put_ns(ns);
> +out:
>  	nvmet_req_complete(req, status);
>  	blk_put_request(rq);
>  }
> 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-08-07  4:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  2:20 [PATVH V2 0/3] nvmet: passthru fixes Chaitanya Kulkarni
2020-08-07  2:20 ` [PATVH V2 1/3] nvmet: add ns tear down label for pt-cmd handling Chaitanya Kulkarni
2020-08-07  4:31   ` Logan Gunthorpe [this message]
2020-08-07 17:37   ` Sagi Grimberg
2020-08-07 18:28     ` Chaitanya Kulkarni
2020-08-10 12:36   ` Christoph Hellwig
2020-08-07  2:20 ` [PATVH V2 2/3] nvmet: fix oops in pt cmd execution Chaitanya Kulkarni
2020-08-10 12:36   ` Christoph Hellwig
2020-08-07  2:20 ` [PATVH V2 3/3] nvmet: call blk_mq_free_request() directly Chaitanya Kulkarni
2020-08-10 12:36   ` Christoph Hellwig
2020-08-07 19:30 [PATVH V2 0/3] nvmet: passthru fixes Chaitanya Kulkarni
2020-08-07 19:30 ` [PATVH V2 1/3] nvmet: add ns tear down label for pt-cmd handling Chaitanya Kulkarni
2020-08-07 23:29   ` Sagi Grimberg
2020-08-08  1:46     ` 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=c40a3189-9417-9dd7-7ae6-7cc26815c90c@deltatee.com \
    --to=logang@deltatee.com \
    --cc=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).