From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CA4FC433ED for ; Fri, 16 Apr 2021 21:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C542E610CD for ; Fri, 16 Apr 2021 21:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236151AbhDPVpK (ORCPT ); Fri, 16 Apr 2021 17:45:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49105 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344518AbhDPVpJ (ORCPT ); Fri, 16 Apr 2021 17:45:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618609484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tLTgqRnP5TXoefl7vOZVal90OzLfQP2dBhM4AZR7Wj8=; b=i7SImWpHHYWHNsA9m+Cf/fSSZo4Ekp3powCdUHra9E+gzgLjK+ekNHPwcI/hY49aixgO/J lvV2Q4+CkRW7dHEKlNw4mxN4FVR4lW02V3sB8wiT8Ftq5WL7it2dZNw7t67BFejxFZ0Hd3 T/vFomPnvSfR0hg0fqDImCXesKOxqQ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-OgsOzGilOvyktH6l0E66vQ-1; Fri, 16 Apr 2021 17:44:42 -0400 X-MC-Unique: OgsOzGilOvyktH6l0E66vQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D13283DD20; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48E715D6D3; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Date: Fri, 16 Apr 2021 17:44:40 -0400 From: Mike Snitzer To: "Ewan D. Milne" Cc: Christoph Hellwig , Jens Axboe , dm-devel@redhat.com, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH v2 3/4] nvme: introduce FAILUP handling for REQ_FAILFAST_TRANSPORT Message-ID: <20210416214440.GA21540@redhat.com> References: <20210415231530.95464-1-snitzer@redhat.com> <20210415231530.95464-4-snitzer@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Fri, Apr 16 2021 at 4:52pm -0400, Ewan D. Milne wrote: > On Thu, 2021-04-15 at 19:15 -0400, Mike Snitzer wrote: > > If REQ_FAILFAST_TRANSPORT is set it means the driver should not retry > > IO that completed with transport errors. REQ_FAILFAST_TRANSPORT is > > set by multipathing software (e.g. dm-multipath) before it issues IO. > > > > Update NVMe to allow failover of requests marked with either > > REQ_NVME_MPATH or REQ_FAILFAST_TRANSPORT. This allows such requests > > to be given a disposition of either FAILOVER or FAILUP respectively. > > FAILUP handling ensures a retryable error is returned up from NVMe. > > > > Introduce nvme_failup_req() for use in nvme_complete_rq() if > > nvme_decide_disposition() returns FAILUP. nvme_failup_req() ensures > > the request is completed with a retryable IO error when appropriate. > > __nvme_end_req() was factored out for use by both nvme_end_req() and > > nvme_failup_req(). > > > > Signed-off-by: Mike Snitzer > > --- > > drivers/nvme/host/core.c | 31 ++++++++++++++++++++++++++----- > > 1 file changed, 26 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index 4134cf3c7e48..10375197dd53 100644 > > --- a/drivers/nvme/host/core.c > > +++ b/drivers/nvme/host/core.c > > @@ -299,6 +299,7 @@ enum nvme_disposition { > > COMPLETE, > > RETRY, > > FAILOVER, > > + FAILUP, > > }; > > > > static inline enum nvme_disposition nvme_decide_disposition(struct > > request *req) > > @@ -318,10 +319,11 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > nvme_req(req)->retries >= nvme_max_retries) > > return COMPLETE; > > > > - if (req->cmd_flags & REQ_NVME_MPATH) { > > + if (req->cmd_flags & (REQ_NVME_MPATH | REQ_FAILFAST_TRANSPORT)) > > { > > if (nvme_is_path_error(nvme_req(req)->status) || > > blk_queue_dying(req->q)) > > - return FAILOVER; > > + return (req->cmd_flags & REQ_NVME_MPATH) ? > > + FAILOVER : FAILUP; > > } else { > > if (blk_queue_dying(req->q)) > > return COMPLETE; > > @@ -330,10 +332,8 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > return RETRY; > > } > > > > -static inline void nvme_end_req(struct request *req) > > +static inline void __nvme_end_req(struct request *req, blk_status_t > > status) > > { > > - blk_status_t status = nvme_error_status(nvme_req(req)->status); > > - > > if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && > > req_op(req) == REQ_OP_ZONE_APPEND) > > req->__sector = nvme_lba_to_sect(req->q->queuedata, > > @@ -343,6 +343,24 @@ static inline void nvme_end_req(struct request > > *req) > > blk_mq_end_request(req, status); > > } > > > > +static inline void nvme_end_req(struct request *req) > > +{ > > + __nvme_end_req(req, nvme_error_status(nvme_req(req)->status)); > > +} > > + > > +static void nvme_failup_req(struct request *req) > > +{ > > + blk_status_t status = nvme_error_status(nvme_req(req)->status); > > + > > + if (WARN_ON_ONCE(!blk_path_error(status))) { > > + pr_debug("Request meant for failover but blk_status_t > > (errno=%d) was not retryable.\n", > > + blk_status_to_errno(status)); > > + status = BLK_STS_IOERR; > > + } > > + > > + __nvme_end_req(req, status); > > It seems like adding __nvme_end_req() was unnecessary, since > nvme_end_req() just calls it and does nothing else? The __nvme_end_req helper allowed the status to be passed in, making it easy to override status for unlikley edge-case where the BLK_STS is !blk_path_error() but should be given nvme_is_path_error() returned true. Anyway, I can avoid the need to factor out __nvme_end_req() and just: nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR; nvme_end_req(req); Thanks, Mike From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AAA4C433ED for ; Fri, 16 Apr 2021 21:45:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14B9660FE8 for ; Fri, 16 Apr 2021 21:45:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14B9660FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=z/GffVnSvX6A/H9448yi8ktuj6i3VwHhd2OYLT9aFQw=; b=jJCQjH6fLovLLAVd0Ti7KOB8o 5UVC/bLRnwYzEpu0x9FdsLk/HtBSrnDR0mlK5A/5skKxuffJRbt/cxPT7HJ8CwLuEF9MuuPXnYH5k l2yTwldMn0kZaqVblTWlev1XeIwR63c7oFVpZs9P5eYwMDjgfx79QFXPnCT0becFYirW+KdHvbE3j +unAkgWqhx2vwyZUCJLH7JAL3TOKWNGAMUxM9Lvgyw0IFzdsiX7nZbEQPc3xc39Aig4VgSJPwILf7 blEQkw7mXi8EHaarqmB/kFQago5urROTqQ3j3E9Ia8sIUYe5mIpspPVahL7GD6adXnpuD2P72+tGp /dnGcjJJw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lXWGl-003UYw-Cr; Fri, 16 Apr 2021 21:44:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lXWGf-003UXl-6b for linux-nvme@desiato.infradead.org; Fri, 16 Apr 2021 21:44:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=tLTgqRnP5TXoefl7vOZVal90OzLfQP2dBhM4AZR7Wj8=; b=iUSpUjQ6sQQHkY2zZnfCnQNJbR UyHxZtDymbUSHchR3BftJIXE6zkdsLHNlFL2C3iUQA1JuQNn1dU6KzmxnRcKhU7USLNlX1DCq+V/+ 0uEJ0GnGql6F9r3s5+XwgKFuHPD52H0k0l++3LhSJaIuydH4qvXg9QNFCtVvgs9scF4ifIGarZo+D TRzo0rGOU2QkLwnObwxPlCUmxx1mbIwDaRptkHtkb2QIsUyi37fnMCSVhl+ll0hm8fLuZgCXiGx1N rb38AKAPvsrS/xqQmaRGPxjpYW+U9n8pgBK1+7F/kplNeU3TNFiXaaJFEH5DfSL3Pk8PXR6KDEDxj Yz1Jzk7g==; Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lXWGc-009inh-Ik for linux-nvme@lists.infradead.org; Fri, 16 Apr 2021 21:44:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618609484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tLTgqRnP5TXoefl7vOZVal90OzLfQP2dBhM4AZR7Wj8=; b=i7SImWpHHYWHNsA9m+Cf/fSSZo4Ekp3powCdUHra9E+gzgLjK+ekNHPwcI/hY49aixgO/J lvV2Q4+CkRW7dHEKlNw4mxN4FVR4lW02V3sB8wiT8Ftq5WL7it2dZNw7t67BFejxFZ0Hd3 T/vFomPnvSfR0hg0fqDImCXesKOxqQ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-OgsOzGilOvyktH6l0E66vQ-1; Fri, 16 Apr 2021 17:44:42 -0400 X-MC-Unique: OgsOzGilOvyktH6l0E66vQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D13283DD20; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48E715D6D3; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Date: Fri, 16 Apr 2021 17:44:40 -0400 From: Mike Snitzer To: "Ewan D. Milne" Cc: Christoph Hellwig , Jens Axboe , dm-devel@redhat.com, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH v2 3/4] nvme: introduce FAILUP handling for REQ_FAILFAST_TRANSPORT Message-ID: <20210416214440.GA21540@redhat.com> References: <20210415231530.95464-1-snitzer@redhat.com> <20210415231530.95464-4-snitzer@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210416_144446_719412_6AE79E62 X-CRM114-Status: GOOD ( 30.97 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Fri, Apr 16 2021 at 4:52pm -0400, Ewan D. Milne wrote: > On Thu, 2021-04-15 at 19:15 -0400, Mike Snitzer wrote: > > If REQ_FAILFAST_TRANSPORT is set it means the driver should not retry > > IO that completed with transport errors. REQ_FAILFAST_TRANSPORT is > > set by multipathing software (e.g. dm-multipath) before it issues IO. > > > > Update NVMe to allow failover of requests marked with either > > REQ_NVME_MPATH or REQ_FAILFAST_TRANSPORT. This allows such requests > > to be given a disposition of either FAILOVER or FAILUP respectively. > > FAILUP handling ensures a retryable error is returned up from NVMe. > > > > Introduce nvme_failup_req() for use in nvme_complete_rq() if > > nvme_decide_disposition() returns FAILUP. nvme_failup_req() ensures > > the request is completed with a retryable IO error when appropriate. > > __nvme_end_req() was factored out for use by both nvme_end_req() and > > nvme_failup_req(). > > > > Signed-off-by: Mike Snitzer > > --- > > drivers/nvme/host/core.c | 31 ++++++++++++++++++++++++++----- > > 1 file changed, 26 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index 4134cf3c7e48..10375197dd53 100644 > > --- a/drivers/nvme/host/core.c > > +++ b/drivers/nvme/host/core.c > > @@ -299,6 +299,7 @@ enum nvme_disposition { > > COMPLETE, > > RETRY, > > FAILOVER, > > + FAILUP, > > }; > > > > static inline enum nvme_disposition nvme_decide_disposition(struct > > request *req) > > @@ -318,10 +319,11 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > nvme_req(req)->retries >= nvme_max_retries) > > return COMPLETE; > > > > - if (req->cmd_flags & REQ_NVME_MPATH) { > > + if (req->cmd_flags & (REQ_NVME_MPATH | REQ_FAILFAST_TRANSPORT)) > > { > > if (nvme_is_path_error(nvme_req(req)->status) || > > blk_queue_dying(req->q)) > > - return FAILOVER; > > + return (req->cmd_flags & REQ_NVME_MPATH) ? > > + FAILOVER : FAILUP; > > } else { > > if (blk_queue_dying(req->q)) > > return COMPLETE; > > @@ -330,10 +332,8 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > return RETRY; > > } > > > > -static inline void nvme_end_req(struct request *req) > > +static inline void __nvme_end_req(struct request *req, blk_status_t > > status) > > { > > - blk_status_t status = nvme_error_status(nvme_req(req)->status); > > - > > if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && > > req_op(req) == REQ_OP_ZONE_APPEND) > > req->__sector = nvme_lba_to_sect(req->q->queuedata, > > @@ -343,6 +343,24 @@ static inline void nvme_end_req(struct request > > *req) > > blk_mq_end_request(req, status); > > } > > > > +static inline void nvme_end_req(struct request *req) > > +{ > > + __nvme_end_req(req, nvme_error_status(nvme_req(req)->status)); > > +} > > + > > +static void nvme_failup_req(struct request *req) > > +{ > > + blk_status_t status = nvme_error_status(nvme_req(req)->status); > > + > > + if (WARN_ON_ONCE(!blk_path_error(status))) { > > + pr_debug("Request meant for failover but blk_status_t > > (errno=%d) was not retryable.\n", > > + blk_status_to_errno(status)); > > + status = BLK_STS_IOERR; > > + } > > + > > + __nvme_end_req(req, status); > > It seems like adding __nvme_end_req() was unnecessary, since > nvme_end_req() just calls it and does nothing else? The __nvme_end_req helper allowed the status to be passed in, making it easy to override status for unlikley edge-case where the BLK_STS is !blk_path_error() but should be given nvme_is_path_error() returned true. Anyway, I can avoid the need to factor out __nvme_end_req() and just: nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR; nvme_end_req(req); Thanks, Mike _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 625E0C433B4 for ; Fri, 16 Apr 2021 21:44:58 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F0FF960FE8 for ; Fri, 16 Apr 2021 21:44:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0FF960FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618609496; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wCs/AyUFUNn0BOsk4VP0ImCnuw0UdcQOiquqhNfWjFw=; b=hLkAwqRvSJfkt5FxCNa/b/Rf8WWPjn6N7WZtKt3Or7UjzXXWgONO2fKmbRM1ePQi/le1tO h1AHDD7UfqLRIo/w0AKREtwE+TiUCwU8zKui95+aWikEUrMGCxOJ9hKp8wStLRWQdM3a7U oYVkHhtXPnvPCznb4HzN9FofHy4BU/A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-Jdf4NsqjPQqhgu6C3PURKA-1; Fri, 16 Apr 2021 17:44:54 -0400 X-MC-Unique: Jdf4NsqjPQqhgu6C3PURKA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23A1D18B6149; Fri, 16 Apr 2021 21:44:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 655AB5945A; Fri, 16 Apr 2021 21:44:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 887981806D0F; Fri, 16 Apr 2021 21:44:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GLifuk009473 for ; Fri, 16 Apr 2021 17:44:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D7DD5D751; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48E715D6D3; Fri, 16 Apr 2021 21:44:41 +0000 (UTC) Date: Fri, 16 Apr 2021 17:44:40 -0400 From: Mike Snitzer To: "Ewan D. Milne" Message-ID: <20210416214440.GA21540@redhat.com> References: <20210415231530.95464-1-snitzer@redhat.com> <20210415231530.95464-4-snitzer@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com Cc: Jens Axboe , linux-block@vger.kernel.org, dm-devel@redhat.com, Christoph Hellwig , linux-nvme@lists.infradead.org Subject: Re: [dm-devel] [PATCH v2 3/4] nvme: introduce FAILUP handling for REQ_FAILFAST_TRANSPORT X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, Apr 16 2021 at 4:52pm -0400, Ewan D. Milne wrote: > On Thu, 2021-04-15 at 19:15 -0400, Mike Snitzer wrote: > > If REQ_FAILFAST_TRANSPORT is set it means the driver should not retry > > IO that completed with transport errors. REQ_FAILFAST_TRANSPORT is > > set by multipathing software (e.g. dm-multipath) before it issues IO. > > > > Update NVMe to allow failover of requests marked with either > > REQ_NVME_MPATH or REQ_FAILFAST_TRANSPORT. This allows such requests > > to be given a disposition of either FAILOVER or FAILUP respectively. > > FAILUP handling ensures a retryable error is returned up from NVMe. > > > > Introduce nvme_failup_req() for use in nvme_complete_rq() if > > nvme_decide_disposition() returns FAILUP. nvme_failup_req() ensures > > the request is completed with a retryable IO error when appropriate. > > __nvme_end_req() was factored out for use by both nvme_end_req() and > > nvme_failup_req(). > > > > Signed-off-by: Mike Snitzer > > --- > > drivers/nvme/host/core.c | 31 ++++++++++++++++++++++++++----- > > 1 file changed, 26 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > > index 4134cf3c7e48..10375197dd53 100644 > > --- a/drivers/nvme/host/core.c > > +++ b/drivers/nvme/host/core.c > > @@ -299,6 +299,7 @@ enum nvme_disposition { > > COMPLETE, > > RETRY, > > FAILOVER, > > + FAILUP, > > }; > > > > static inline enum nvme_disposition nvme_decide_disposition(struct > > request *req) > > @@ -318,10 +319,11 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > nvme_req(req)->retries >= nvme_max_retries) > > return COMPLETE; > > > > - if (req->cmd_flags & REQ_NVME_MPATH) { > > + if (req->cmd_flags & (REQ_NVME_MPATH | REQ_FAILFAST_TRANSPORT)) > > { > > if (nvme_is_path_error(nvme_req(req)->status) || > > blk_queue_dying(req->q)) > > - return FAILOVER; > > + return (req->cmd_flags & REQ_NVME_MPATH) ? > > + FAILOVER : FAILUP; > > } else { > > if (blk_queue_dying(req->q)) > > return COMPLETE; > > @@ -330,10 +332,8 @@ static inline enum nvme_disposition > > nvme_decide_disposition(struct request *req) > > return RETRY; > > } > > > > -static inline void nvme_end_req(struct request *req) > > +static inline void __nvme_end_req(struct request *req, blk_status_t > > status) > > { > > - blk_status_t status = nvme_error_status(nvme_req(req)->status); > > - > > if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && > > req_op(req) == REQ_OP_ZONE_APPEND) > > req->__sector = nvme_lba_to_sect(req->q->queuedata, > > @@ -343,6 +343,24 @@ static inline void nvme_end_req(struct request > > *req) > > blk_mq_end_request(req, status); > > } > > > > +static inline void nvme_end_req(struct request *req) > > +{ > > + __nvme_end_req(req, nvme_error_status(nvme_req(req)->status)); > > +} > > + > > +static void nvme_failup_req(struct request *req) > > +{ > > + blk_status_t status = nvme_error_status(nvme_req(req)->status); > > + > > + if (WARN_ON_ONCE(!blk_path_error(status))) { > > + pr_debug("Request meant for failover but blk_status_t > > (errno=%d) was not retryable.\n", > > + blk_status_to_errno(status)); > > + status = BLK_STS_IOERR; > > + } > > + > > + __nvme_end_req(req, status); > > It seems like adding __nvme_end_req() was unnecessary, since > nvme_end_req() just calls it and does nothing else? The __nvme_end_req helper allowed the status to be passed in, making it easy to override status for unlikley edge-case where the BLK_STS is !blk_path_error() but should be given nvme_is_path_error() returned true. Anyway, I can avoid the need to factor out __nvme_end_req() and just: nvme_req(req)->status = NVME_SC_HOST_PATH_ERROR; nvme_end_req(req); Thanks, Mike -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel