All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, Keith Busch <keith.busch@intel.com>,
	Bart Van Assche <bart.vanassche@wdc.com>,
	Josef Bacik <josef@toxicpanda.com>, Tejun Heo <tj@kernel.org>,
	Lee Duncan <lduncan@suse.com>, Chris Leech <cleech@redhat.com>,
	Rafael David Tinoco <rafael.tinoco@canonical.com>,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 03/14] nvme: return BLK_EH_DONE from ->timeout
Date: Thu, 24 May 2018 12:45:15 +0800	[thread overview]
Message-ID: <20180524044510.GA22751@ming.t460p> (raw)
In-Reply-To: <20180523121941.8632-4-hch@lst.de>

On Wed, May 23, 2018 at 02:19:30PM +0200, Christoph Hellwig wrote:
> NVMe always completes the request before returning from ->timeout, either
> by polling for it, or by disabling the controller.  Return BLK_EH_DONE so
> that the block layer doesn't even try to complete it again.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/nvme/host/pci.c    | 14 +++++---------
>  drivers/nvme/host/rdma.c   |  2 +-
>  drivers/nvme/target/loop.c |  2 +-
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 917e1714f7d9..31525324b79f 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1205,7 +1205,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
>  		nvme_warn_reset(dev, csts);
>  		nvme_dev_disable(dev, false);
>  		nvme_reset_ctrl(&dev->ctrl);
> -		return BLK_EH_HANDLED;
> +		return BLK_EH_DONE;
>  	}
>  
>  	/*
> @@ -1215,14 +1215,14 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
>  		dev_warn(dev->ctrl.device,
>  			 "I/O %d QID %d timeout, completion polled\n",
>  			 req->tag, nvmeq->qid);
> -		return BLK_EH_HANDLED;
> +		return BLK_EH_DONE;
>  	}
>  
>  	/*
>  	 * Shutdown immediately if controller times out while starting. The
>  	 * reset work will see the pci device disabled when it gets the forced
>  	 * cancellation error. All outstanding requests are completed on
> -	 * shutdown, so we return BLK_EH_HANDLED.
> +	 * shutdown, so we return BLK_EH_DONE.
>  	 */
>  	switch (dev->ctrl.state) {
>  	case NVME_CTRL_CONNECTING:
> @@ -1232,7 +1232,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
>  			 req->tag, nvmeq->qid);
>  		nvme_dev_disable(dev, false);
>  		nvme_req(req)->flags |= NVME_REQ_CANCELLED;
> -		return BLK_EH_HANDLED;
> +		return BLK_EH_DONE;
>  	default:
>  		break;
>  	}
> @@ -1249,12 +1249,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
>  		nvme_dev_disable(dev, false);
>  		nvme_reset_ctrl(&dev->ctrl);
>  
> -		/*
> -		 * Mark the request as handled, since the inline shutdown
> -		 * forces all outstanding requests to complete.
> -		 */
>  		nvme_req(req)->flags |= NVME_REQ_CANCELLED;
> -		return BLK_EH_HANDLED;
> +		return BLK_EH_DONE;
>  	}
>  
>  	if (atomic_dec_return(&dev->ctrl.abort_limit) < 0) {
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 1eb4438a8763..ac7462cd7f0f 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1598,7 +1598,7 @@ nvme_rdma_timeout(struct request *rq, bool reserved)
>  	/* fail with DNR on cmd timeout */
>  	nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
>  
> -	return BLK_EH_HANDLED;
> +	return BLK_EH_DONE;
>  }
>  
>  static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
> diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
> index 27a8561c0cb9..22e3627bf16b 100644
> --- a/drivers/nvme/target/loop.c
> +++ b/drivers/nvme/target/loop.c
> @@ -146,7 +146,7 @@ nvme_loop_timeout(struct request *rq, bool reserved)
>  	/* fail with DNR on admin cmd timeout */
>  	nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR;
>  
> -	return BLK_EH_HANDLED;
> +	return BLK_EH_DONE;
>  }
>  
>  static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx,
> -- 
> 2.17.0
> 

This change should have been done after '[PATCH 13/14] blk-mq: Remove
generation seqeunce', otherwise the timed-out request won't be completed
by nvme_cancel_request() at all because we always marked this request as
'COMPLETE' before calling .timeout().

Thanks,
Ming

  parent reply	other threads:[~2018-05-24  4:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 12:19 BLK_EH_HANDLED Christoph Hellwig
2018-05-23 12:19 ` [PATCH 01/14] libata: remove ata_scsi_timed_out Christoph Hellwig
2018-05-23 13:21   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 02/14] block: rename BLK_EH_NOT_HANDLED to BLK_EH_DONE Christoph Hellwig
2018-05-23 12:41   ` Johannes Thumshirn
2018-05-23 13:22   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 03/14] nvme: return BLK_EH_DONE from ->timeout Christoph Hellwig
2018-05-23 12:42   ` Johannes Thumshirn
2018-05-23 13:27   ` Hannes Reinecke
2018-05-28 15:24     ` Christoph Hellwig
2018-05-24  4:45   ` Ming Lei [this message]
2018-05-28 11:44     ` Christoph Hellwig
2018-05-29  0:50       ` Ming Lei
2018-05-23 12:19 ` [PATCH 04/14] nbd: complete requests " Christoph Hellwig
2018-05-23 13:28   ` Hannes Reinecke
2018-05-28 15:25     ` Christoph Hellwig
2018-05-23 12:19 ` [PATCH 05/14] mtip32xx: " Christoph Hellwig
2018-05-23 12:46   ` Johannes Thumshirn
2018-05-23 13:29   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 06/14] null_blk: " Christoph Hellwig
2018-05-23 12:46   ` Johannes Thumshirn
2018-05-23 13:29   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 07/14] scsi_transport_fc: " Christoph Hellwig
2018-05-23 12:48   ` Johannes Thumshirn
2018-05-23 13:30   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 08/14] mmc: " Christoph Hellwig
2018-05-23 13:31   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 09/14] libiscsi: don't try to bypass SCSI EH Christoph Hellwig
2018-05-23 13:35   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 10/14] block: remove BLK_EH_HANDLED Christoph Hellwig
2018-05-23 13:36   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 11/14] block: document the blk_eh_timer_return values Christoph Hellwig
2018-05-23 13:36   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 12/14] blk-mq: Fix timeout and state order Christoph Hellwig
2018-05-23 13:37   ` Hannes Reinecke
2018-05-23 12:19 ` [PATCH 13/14] blk-mq: Remove generation seqeunce Christoph Hellwig
2018-05-23 14:24   ` Keith Busch
2018-05-23 12:19 ` [PATCH 14/14] blk-mq: simplify blk_mq_rq_timed_out Christoph Hellwig
2018-05-23 13:20 ` BLK_EH_HANDLED Hannes Reinecke

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=20180524044510.GA22751@ming.t460p \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@wdc.com \
    --cc=cleech@redhat.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=keith.busch@intel.com \
    --cc=lduncan@suse.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rafael.tinoco@canonical.com \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.