linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Jianchao Wang <jianchao.w.wang@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/2] nvme: pci: guarantee EH can make progress
Date: Thu, 26 Apr 2018 10:24:43 -0600	[thread overview]
Message-ID: <20180426162442.GB2624@localhost.localdomain> (raw)
In-Reply-To: <20180426123956.26039-3-ming.lei@redhat.com>

On Thu, Apr 26, 2018 at 08:39:56PM +0800, Ming Lei wrote:
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 5d05a04f8e72..1e058deb4718 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1265,6 +1265,20 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
>  	struct nvme_command cmd;
>  	u32 csts = readl(dev->bar + NVME_REG_CSTS);
>  
> +	/*
> +	 * If error recovery is in-progress and this request needn't to
> +	 * be retried, return BLK_EH_HANDLED immediately, so that error
> +	 * handler kthread can always make progress since we still need
> +	 * to send FAILFAST request to admin queue for handling error.
> +	 */
> +	spin_lock(&dev->eh_lock);
> +	if (dev->eh_in_recovery && blk_noretry_request(req)) {
> +		spin_unlock(&dev->eh_lock);
> +		nvme_req(req)->status |= NVME_SC_DNR;
> +		return BLK_EH_HANDLED;
> +	}
> +	spin_unlock(&dev->eh_lock);

This doesn't really look safe. Even if a command times out, the
controller still owns that command, and calling it done while pci bus
master enable is still set can cause memory corruption.

  reply	other threads:[~2018-04-26 16:24 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 12:39 [PATCH 0/2] nvme: pci: fix & improve timeout handling Ming Lei
2018-04-26 12:39 ` [PATCH 1/2] nvme: pci: simplify " Ming Lei
2018-04-26 15:07   ` jianchao.wang
2018-04-26 15:57     ` Ming Lei
2018-04-26 16:16       ` Ming Lei
2018-04-27  1:37       ` jianchao.wang
2018-04-27 14:57         ` Ming Lei
2018-04-28 14:00           ` jianchao.wang
2018-04-28 21:57             ` Ming Lei
2018-04-28 22:27               ` Ming Lei
2018-04-29  1:36                 ` Ming Lei
2018-04-29  2:21                   ` jianchao.wang
2018-04-29 14:13                     ` Ming Lei
2018-04-27 17:51   ` Keith Busch
2018-04-28  3:50     ` Ming Lei
2018-04-28 13:35       ` Keith Busch
2018-04-28 14:31         ` jianchao.wang
2018-04-28 21:39         ` Ming Lei
2018-04-30 19:52           ` Keith Busch
2018-04-30 23:14             ` Ming Lei
2018-05-08 15:30       ` Keith Busch
2018-05-10 20:52         ` Ming Lei
2018-05-10 21:05           ` Keith Busch
2018-05-10 21:10             ` Ming Lei
2018-05-10 21:18               ` Keith Busch
2018-05-10 21:24                 ` Ming Lei
2018-05-10 21:44                   ` Keith Busch
2018-05-10 21:50                     ` Ming Lei
2018-05-10 21:53                     ` Ming Lei
2018-05-10 22:03                 ` Ming Lei
2018-05-10 22:43                   ` Keith Busch
2018-05-11  0:14                     ` Ming Lei
2018-05-11  2:10             ` Ming Lei
2018-04-26 12:39 ` [PATCH 2/2] nvme: pci: guarantee EH can make progress Ming Lei
2018-04-26 16:24   ` Keith Busch [this message]
2018-04-28  3:28     ` Ming Lei

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=20180426162442.GB2624@localhost.localdomain \
    --to=keith.busch@intel.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jianchao.w.wang@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=ming.lei@redhat.com \
    --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).