Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Mike Snitzer <snitzer@redhat.com>, Christoph Hellwig <hch@lst.de>,
	Jens Axboe <axboe@kernel.dk>
Cc: dm-devel@redhat.com, linux-block@vger.kernel.org,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2 1/4] nvme: return BLK_STS_DO_NOT_RETRY if the DNR bit is set
Date: Fri, 16 Apr 2021 15:51:33 +0200
Message-ID: <afeb4a15-eed3-9544-439e-f69b9eff5ad7@suse.de> (raw)
In-Reply-To: <20210415231530.95464-2-snitzer@redhat.com>

On 4/16/21 1:15 AM, Mike Snitzer wrote:
> If the DNR bit is set we should not retry the command.
> 
> We care about the retryable vs not retryable distinction at the block
> layer so propagate the equivalent of the DNR bit by introducing
> BLK_STS_DO_NOT_RETRY. Update blk_path_error() to _not_ retry if it
> is set.
> 
> This change runs with the suggestion made here:
> https://lore.kernel.org/linux-nvme/20190813170144.GA10269@lst.de/
> 
> Suggested-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
>  drivers/nvme/host/core.c  | 3 +++
>  include/linux/blk_types.h | 8 ++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 0896e21642be..540d6fd8ffef 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -237,6 +237,9 @@ static void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl)
>  
>  static blk_status_t nvme_error_status(u16 status)
>  {
> +	if (unlikely(status & NVME_SC_DNR))
> +		return BLK_STS_DO_NOT_RETRY;
> +
>  	switch (status & 0x7ff) {
>  	case NVME_SC_SUCCESS:
>  		return BLK_STS_OK;
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index db026b6ec15a..1ca724948c56 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -142,6 +142,13 @@ typedef u8 __bitwise blk_status_t;
>   */
>  #define BLK_STS_ZONE_ACTIVE_RESOURCE	((__force blk_status_t)16)
>  
> +/*
> + * BLK_STS_DO_NOT_RETRY is returned from the driver in the completion path
> + * if the device returns a status indicating that if the same command is
> + * re-submitted it is expected to fail.
> + */
> +#define BLK_STS_DO_NOT_RETRY	((__force blk_status_t)17)
> +
>  /**
>   * blk_path_error - returns true if error may be path related
>   * @error: status the request was completed with
> @@ -157,6 +164,7 @@ typedef u8 __bitwise blk_status_t;
>  static inline bool blk_path_error(blk_status_t error)
>  {
>  	switch (error) {
> +	case BLK_STS_DO_NOT_RETRY:
>  	case BLK_STS_NOTSUPP:
>  	case BLK_STS_NOSPC:
>  	case BLK_STS_TARGET:
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Hannes
-- 
Dr. Hannes Reinecke		        Kernel Storage Architect
hare@suse.de			               +49 911 74053 688
SUSE Software Solutions Germany GmbH, 90409 Nürnberg
GF: F. Imendörffer, HRB 36809 (AG Nürnberg)

  parent reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 23:15 [PATCH v2 0/4] nvme: improve error handling and ana_state to work well with dm-multipath Mike Snitzer
2021-04-15 23:15 ` [PATCH v2 1/4] nvme: return BLK_STS_DO_NOT_RETRY if the DNR bit is set Mike Snitzer
2021-04-15 23:48   ` Chaitanya Kulkarni
2021-04-16 13:51   ` Hannes Reinecke [this message]
2021-04-15 23:15 ` [PATCH v2 2/4] nvme: allow local retry for requests with REQ_FAILFAST_TRANSPORT set Mike Snitzer
2021-04-16 14:01   ` Hannes Reinecke
2021-04-16 14:53     ` Mike Snitzer
2021-04-16 15:20       ` Hannes Reinecke
2021-04-16 15:32         ` Mike Snitzer
2021-04-15 23:15 ` [PATCH v2 3/4] nvme: introduce FAILUP handling for REQ_FAILFAST_TRANSPORT Mike Snitzer
2021-04-16 14:07   ` Hannes Reinecke
2021-04-16 15:03     ` Mike Snitzer
2021-04-16 16:23       ` Hannes Reinecke
2021-04-16 20:03     ` [dm-devel] " Ewan D. Milne
2021-04-16 20:52   ` Ewan D. Milne
2021-04-16 21:44     ` Mike Snitzer
2021-04-15 23:15 ` [PATCH v2 4/4] nvme: decouple basic ANA log page re-read support from native multipathing Mike Snitzer

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=afeb4a15-eed3-9544-439e-f69b9eff5ad7@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=snitzer@redhat.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

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git