From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Keith Busch <keith.busch@wdc.com>, Christoph Hellwig <hch@lst.de>,
linux-nvme@lists.infradead.org, Sagi Grimberg <sagi@grimberg.me>
Subject: Re: [PATCH 1/2] nvme: add 'fail_if_no_path' sysfs attribute
Date: Tue, 23 Feb 2021 21:41:09 +0900 [thread overview]
Message-ID: <20210223124109.GB2119@localhost.localdomain> (raw)
In-Reply-To: <20210223115922.104369-2-hare@suse.de>
On 21-02-23 12:59:21, Hannes Reinecke wrote:
> In some setups like RAID or cluster we need to return an I/O error
> once all paths are unavailable to allow the upper layers to start
> their own error recovery (like redirecting I/O to other mirrors).
> This patch adds a sysfs attribute 'fail_if_no_path' to allow the
> admin to enable that behaviour instead of the current 'queue until
> a path becomes available' policy.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/nvme/host/core.c | 5 ++++
> drivers/nvme/host/multipath.c | 43 +++++++++++++++++++++++++++++++++--
> drivers/nvme/host/nvme.h | 2 ++
> 3 files changed, 48 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 4de6a3a13575..2fb3ecc0c53b 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3464,6 +3464,7 @@ static struct attribute *nvme_ns_id_attrs[] = {
> #ifdef CONFIG_NVME_MULTIPATH
> &dev_attr_ana_grpid.attr,
> &dev_attr_ana_state.attr,
> + &dev_attr_fail_if_no_path.attr,
> #endif
> NULL,
> };
> @@ -3494,6 +3495,10 @@ static umode_t nvme_ns_id_attrs_are_visible(struct kobject *kobj,
> if (!nvme_ctrl_use_ana(nvme_get_ns_from_dev(dev)->ctrl))
> return 0;
> }
> + if (a == &dev_attr_fail_if_no_path.attr) {
> + if (dev_to_disk(dev)->fops == &nvme_bdev_ops)
> + return 0;
> + }
> #endif
> return a->mode;
> }
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 0696319adaf6..d5773ea105b1 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -283,10 +283,18 @@ static bool nvme_available_path(struct nvme_ns_head *head)
> continue;
> switch (ns->ctrl->state) {
> case NVME_CTRL_LIVE:
> + if (!test_bit(NVME_NSHEAD_FAIL_IF_NO_PATH,
> + &head->flags))
> + return true;
> + if (ns->ana_state != NVME_ANA_INACCESSIBLE &&
> + ns->ana_state != NVME_ANA_PERSISTENT_LOSS)
> + return true;
It looks like it needs to prevent fallthru here with return false. It
causes following warning:
drivers/nvme/host/multipath.c: In function ‘nvme_available_path’:
drivers/nvme/host/multipath.c:289:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
289 | if (ns->ana_state != NVME_ANA_INACCESSIBLE &&
| ^
drivers/nvme/host/multipath.c:292:3: note: here
292 | case NVME_CTRL_RESETTING:
| ^~~~
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index f995b8234622..d692eab3d483 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -289,6 +289,7 @@ static bool nvme_available_path(struct nvme_ns_head *head)
if (ns->ana_state != NVME_ANA_INACCESSIBLE &&
ns->ana_state != NVME_ANA_PERSISTENT_LOSS)
return true;
+ return false;
case NVME_CTRL_RESETTING:
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-02-23 12:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 11:59 [PATCH 0/2] nvme: fix regression with MD RAID Hannes Reinecke
2021-02-23 11:59 ` [PATCH 1/2] nvme: add 'fail_if_no_path' sysfs attribute Hannes Reinecke
2021-02-23 12:41 ` Minwoo Im [this message]
2021-02-24 22:47 ` Sagi Grimberg
2021-02-25 8:10 ` Hannes Reinecke
2021-02-23 11:59 ` [PATCH 2/2] nvme: delete disk when last path is gone Hannes Reinecke
2021-02-23 12:56 ` Minwoo Im
2021-02-23 14:07 ` Hannes Reinecke
2021-02-24 22:40 ` Sagi Grimberg
2021-02-25 8:37 ` Hannes Reinecke
2021-02-24 16:25 ` [PATCH 0/2] nvme: fix regression with MD RAID Christoph Hellwig
2021-02-24 17:10 ` 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=20210223124109.GB2119@localhost.localdomain \
--to=minwoo.im.dev@gmail.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=keith.busch@wdc.com \
--cc=linux-nvme@lists.infradead.org \
--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 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.