linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Max Gurtovoy <maxg@mellanox.com>
Cc: sagi@grimberg.me, israelr@mellanox.com, james.smart@broadcom.com,
	linux-nvme@lists.infradead.org, shlomin@mellanox.com,
	kbusch@kernel.org, hch@lst.de
Subject: Re: [PATCH 6/8] nvme: move common call to nvme_cleanup_cmd to core layer
Date: Thu, 10 Oct 2019 15:56:22 +0200	[thread overview]
Message-ID: <20191010135622.GE31487@lst.de> (raw)
In-Reply-To: <1570714100-15520-7-git-send-email-maxg@mellanox.com>

On Thu, Oct 10, 2019 at 04:28:18PM +0300, Max Gurtovoy wrote:
> nvme_cleanup_cmd should be called for each call to nvme_setup_cmd
> (symmetrical functions). Move the call for nvme_cleanup_cmd to the common
> core layer and call it during nvme_complete_rq for the good flow. For
> error flow, each transport will call nvme_cleanup_cmd independently. Also
> take care of a special case of path failure, where we call
> nvme_complete_rq without doing nvme_setup_cmd.
> 
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> ---
>  drivers/nvme/host/core.c   |  4 ++++
>  drivers/nvme/host/fc.c     |  3 +--
>  drivers/nvme/host/pci.c    |  1 -
>  drivers/nvme/host/rdma.c   | 12 +++++-------
>  drivers/nvme/target/loop.c |  1 -
>  5 files changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 2203309..46acdba 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -268,6 +268,10 @@ void nvme_complete_rq(struct request *req)
>  
>  	trace_nvme_complete_rq(req);
>  
> +	/* In case of NVME_SC_HOST_PATH_ERROR we don't call nvme_setup_cmd */
> +	if (likely(nvme_req(req)->status != NVME_SC_HOST_PATH_ERROR))
> +		nvme_cleanup_cmd(req);

Hmm.  I don't really like that special case.  Especially given that
nvme_cleanup_cmd checks for RQF_SPECIAL_PAYLOAD and thus is a no-op if
nvme_setup_cmd wasn't called.  So I'd rather remove this check.

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

  reply	other threads:[~2019-10-10 13:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 13:28 [PATCH 0/8] small NVMe cleanups/fixes Max Gurtovoy
2019-10-10 13:28 ` [PATCH 1/8] nvme: Introduce nvme_is_aen_req function Max Gurtovoy
2019-10-10 13:51   ` Christoph Hellwig
2019-10-10 13:28 ` [PATCH 2/8] nvmet: use bio_io_error instead of duplicating it Max Gurtovoy
2019-10-10 13:51   ` Christoph Hellwig
2019-10-10 13:28 ` [PATCH 3/8] nvmet: add unlikely check at nvmet_req_alloc_sgl Max Gurtovoy
2019-10-10 13:51   ` Christoph Hellwig
2019-10-10 15:27     ` Max Gurtovoy
2019-10-10 13:28 ` [PATCH 4/8] nvmet-rdma: add unlikely check at nvmet_rdma_map_sgl_keyed Max Gurtovoy
2019-10-10 13:28 ` [PATCH 5/8] nvme: introduce "Command Aborted By host" status code Max Gurtovoy
2019-10-10 13:53   ` Christoph Hellwig
2019-10-10 13:28 ` [PATCH 6/8] nvme: move common call to nvme_cleanup_cmd to core layer Max Gurtovoy
2019-10-10 13:56   ` Christoph Hellwig [this message]
2019-10-10 13:28 ` [PATCH 7/8] nvmet-loop: fix possible leakage during error flow Max Gurtovoy
2019-10-10 13:28 ` [PATCH 8/8] nvme-tcp: " Max Gurtovoy
2019-10-10 13:56   ` Christoph Hellwig
2019-10-13 16:57 [PATCH v2 0/8] small NVMe cleanups/fixes Max Gurtovoy
2019-10-13 16:57 ` [PATCH 6/8] nvme: move common call to nvme_cleanup_cmd to core layer Max Gurtovoy

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=20191010135622.GE31487@lst.de \
    --to=hch@lst.de \
    --cc=israelr@mellanox.com \
    --cc=james.smart@broadcom.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.me \
    --cc=shlomin@mellanox.com \
    /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).