linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCHv2-4.5 08/10] NVMe: Move error handling to failed reset handler
Date: Sat, 13 Feb 2016 01:46:34 -0800	[thread overview]
Message-ID: <20160213094634.GB15318@infradead.org> (raw)
In-Reply-To: <1455221147-24228-9-git-send-email-keith.busch@intel.com>

On Thu, Feb 11, 2016@01:05:45PM -0700, Keith Busch wrote:
> This moves failed queue handling out of the namespace removal path and into
> the reset failure path, fixing a deadlock condition if the controller
> fails or link down during del_gendisk. Previously the driver had to see
> the controller as degraded prior to calling del_gendisk to setup the
> queues to fail. If the controller happened to fail after this though,
> there was no task to end the request_queue.
> 
> On failure, all namespace states are set to 'dead'. This has capacity
> revalidate to 0, and ends all new requests with error status.

I like this a lot, but a few comments below:

> +/**
> + * nvme_kill_ns_queues(): Ends all namespace queues
> + * @ctrl: the dead controller that needs to end
> + *
> + * Call this function when the driver determines it is unable to get the
> + * controller in a state capable of servicing IO.
> + */
> +void nvme_kill_ns_queues(struct nvme_ctrl *ctrl)

Why do we have a separate function for this instead of driving this
from nvme_remove_namespaces?

> @@ -678,7 +678,9 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
>  
>  	spin_lock_irq(&nvmeq->q_lock);
>  	if (unlikely(nvmeq->cq_vector < 0)) {
> -		ret = BLK_MQ_RQ_QUEUE_BUSY;
> +		ret = test_bit(NVME_NS_DEAD, &ns->flags) ?
> +					BLK_MQ_RQ_QUEUE_ERROR :
> +					BLK_MQ_RQ_QUEUE_BUSY;

This would be easier to read with a good old 'if'.

  reply	other threads:[~2016-02-13  9:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 20:05 [PATCHv2-4.5 00/10] NVMe fixes Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 01/10] blk-mq: End unstarted requests on dying queue Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 02/10] NVMe: Fix io incapable return values Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 03/10] NVMe: Allow request merges Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 04/10] NVMe: Fix namespace removal deadlock Keith Busch
2016-02-13  9:44   ` Christoph Hellwig
2016-02-11 20:05 ` [PATCHv2-4.5 05/10] NVMe: Requeue requests on suspended queues Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 06/10] NVMe: Poll device while still active during remove Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 07/10] NVMe: Simplify device reset failure Keith Busch
2016-02-13  9:21   ` Christoph Hellwig
2016-02-11 20:05 ` [PATCHv2-4.5 08/10] NVMe: Move error handling to failed reset handler Keith Busch
2016-02-13  9:46   ` Christoph Hellwig [this message]
2016-02-16 21:57     ` Keith Busch
2016-02-17  8:06       ` Christoph Hellwig
2016-02-11 20:05 ` [PATCHv2-4.5 09/10] NVMe: Mark queues as dead on degraded controller Keith Busch
2016-02-11 20:05 ` [PATCHv2-4.5 10/10] NVMe: Rate limit nvme IO warnings Keith Busch
2016-02-12  8:16   ` Johannes Thumshirn
2016-02-11 22:28 ` [PATCHv2-4.5 00/10] NVMe fixes Keith Busch
2016-02-11 22:38   ` Jens Axboe
2016-02-12  8:35     ` Christoph Hellwig
2016-02-12 15:09       ` Jens Axboe
2016-02-12 15:24       ` Keith Busch
2016-02-13  9:49         ` Christoph Hellwig

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=20160213094634.GB15318@infradead.org \
    --to=hch@infradead.org \
    /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).