Re: [PATCHv2] nvme: add 'fail_if_no_path' sysfs attribute
From: Hannes Reinecke <hare@suse.de>
Date: 2021-02-22 12:37:31
On 2/22/21 11:15 AM, Minwoo Im wrote:
On 21-02-22 07:41:55, Hannes Reinecke wrote:quoted
In some setups like RAID 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 | 38 +++++++++++++++++++++++++++++++++-- drivers/nvme/host/nvme.h | 2 ++ 3 files changed, 43 insertions(+), 2 deletions(-)diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 5c1ec3bfb9d3..ef20029a46b2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c@@ -3466,6 +3466,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, };@@ -3496,6 +3497,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..35ed2f6d431b 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c@@ -283,10 +283,13 @@ static bool nvme_available_path(struct nvme_ns_head *head) continue; switch (ns->ctrl->state) { case NVME_CTRL_LIVE: + return true;Hello Hannes, May I ask there's any reason why LIVE state is not covered by the sysfs attribute that this patch introduced ? Wouldn't it be possible to have no available paths (inaccessible) in LIVE state ? Thanks! :)
Ah, you mean ANA inaccessible? Hmm. Technically, yes, this might be the case. I'll be updating the patch. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme