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>,
	Keith Busch <kbusch@kernel.org>
Cc: "sagi@grimberg.me" <sagi@grimberg.me>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"hch@lst.de" <hch@lst.de>
Subject: Re: [PATCH 1/2] nvmet: fix oops in nvmet_execute_passthru_cmd()
Date: Thu, 6 Aug 2020 13:45:55 -0600	[thread overview]
Message-ID: <5dd8cdbf-8864-ecd4-928e-daa74a9cd166@deltatee.com> (raw)
In-Reply-To: <BYAPR04MB49654162034AA3CBA2F4E49B86480@BYAPR04MB4965.namprd04.prod.outlook.com>



On 2020-08-06 1:40 p.m., Chaitanya Kulkarni wrote:
> Logan,
> 
>>> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
>>> index a260c09b5ab2..96bc9aa11ddb 100644
>>> --- a/drivers/nvme/target/passthru.c
>>> +++ b/drivers/nvme/target/passthru.c
>>> @@ -239,7 +239,6 @@ static void nvmet_passthru_execute_cmd(struct
>>> nvmet_req *req)
>>>
>>>   	rq = nvme_alloc_request(q, req->cmd, BLK_MQ_REQ_NOWAIT, NVME_QID_ANY);
>>>   	if (IS_ERR(rq)) {
>>> -		rq = NULL;
>>>   		status = NVME_SC_INTERNAL;
>>>   		goto fail_out;
>>>   	}
>>> @@ -248,7 +247,7 @@ static void nvmet_passthru_execute_cmd(struct
>>> nvmet_req *req)
>>>   		ret = nvmet_passthru_map_sg(req, rq);
>>>   		if (unlikely(ret)) {
>>>   			status = NVME_SC_INTERNAL;
>>> -			goto fail_out;
>>> +			goto fail_put_req;
>>>   		}
>>>   	}
>>>
>>> @@ -275,11 +274,12 @@ static void nvmet_passthru_execute_cmd(struct
>>> nvmet_req *req)
>>>
>>>   	return;
>>>
>>> +fail_put_req:
>>> +	blk_put_request(rq);
>>>   fail_out:
>>>   	if (ns)
>>>   		nvme_put_ns(ns);
>>>   	nvmet_req_complete(req, status);
>>> -	blk_put_request(rq);
>>>   }
>>>
>>>   /*
>>
> 
> This adds an extra label. Also I don't understand why we should change 
> the order of nvmet_req_complete() and blk_put_request() in 
> nvmet_passthru_execute_cmd() and make is inconsistent with in 
> nvmet_passthru_req_done() ?

I don't know why an extra label is an issue and I don't think the
inconsistency is important. This follows the common pattern where things
are cleaned up in the reverse order of their creation and labels are
used to control which cleanups happen based on how far it got:

rc = setup1();
if (rc)
     return -1;

rc = setup2();
if (rc)
   goto out_teardown1;


rc = setup3();
if (rc)
   goto teardown2;

return;

out_teradown2:
    teardown2();
out_teardown1:
    teardown1();
    return -1;

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

  reply	other threads:[~2020-08-06 19:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06  7:31 [PATCH 0/2] nvmet: couple of passthru fixes Chaitanya Kulkarni
2020-08-06  7:31 ` [PATCH 1/2] nvmet: fix oops in nvmet_execute_passthru_cmd() Chaitanya Kulkarni
2020-08-06 15:42   ` Keith Busch
2020-08-06 16:12     ` Logan Gunthorpe
2020-08-06 16:26       ` Keith Busch
2020-08-06 19:40         ` Chaitanya Kulkarni
2020-08-06 19:45           ` Logan Gunthorpe [this message]
2020-08-06 19:54             ` Sagi Grimberg
2020-08-06 19:55               ` Logan Gunthorpe
2020-08-06 19:57                 ` Chaitanya Kulkarni
2020-08-06 20:03                   ` Sagi Grimberg
2020-08-06 20:06                     ` Chaitanya Kulkarni
2020-08-06 19:55               ` Chaitanya Kulkarni
2020-08-06 19:18       ` Sagi Grimberg
2020-08-06 19:31       ` Chaitanya Kulkarni
2020-08-06 19:41         ` Sagi Grimberg
2020-08-06 19:44           ` Chaitanya Kulkarni
2020-08-06 19:29     ` Chaitanya Kulkarni
2020-08-06  7:31 ` [PATCH 2/2] nvmet: call blk_mq_free_request() directly Chaitanya Kulkarni
2020-08-06 15:45   ` Keith Busch
2020-08-06 16:14   ` Logan Gunthorpe
2020-08-06 19:19   ` Sagi Grimberg

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=5dd8cdbf-8864-ecd4-928e-daa74a9cd166@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --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).