dev_warn_ratelimited(dev, "no available path - failing I/O\n");
bio_io_error(bio);
+ atomic_long_inc(&head->io_fail_no_available_path_count);
}
srcu_read_unlock(&head->srcu, srcu_idx);
DEVICE_ATTR_RW(io_requeue_no_usable_path_count);
+static ssize_t io_fail_no_available_path_count_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ struct nvme_ns_head *head = disk->private_data;
+
+ return sysfs_emit(buf, "%lu\n",
+ atomic_long_read(&head->io_fail_no_available_path_count));
+}
+
+static ssize_t io_fail_no_available_path_count_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int err;
+ unsigned long fail_cnt;
+ struct gendisk *disk = dev_to_disk(dev);
+ struct nvme_ns_head *head = disk->private_data;
+
+ err = kstrtoul(buf, 0, &fail_cnt);
+ if (err)
+ return -EINVAL;
+
+ atomic_long_set(&head->io_fail_no_available_path_count, fail_cnt);
+
+ return count;
+}
+
+DEVICE_ATTR_RW(io_fail_no_available_path_count);
+
static int nvme_lookup_ana_group_desc(struct nvme_ctrl *ctrl,
struct nvme_ana_group_desc *desc, void *data)
{
struct delayed_work remove_work;
unsigned int delayed_removal_secs;
atomic_long_t io_requeue_no_usable_path_count;
+ atomic_long_t io_fail_no_available_path_count;
#define NVME_NSHEAD_DISK_LIVE 0
#define NVME_NSHEAD_QUEUE_IF_NO_PATH 1
struct nvme_ns __rcu *current_path[];
extern struct device_attribute dev_attr_delayed_removal_secs;
extern struct device_attribute dev_attr_multipath_failover_count;
extern struct device_attribute dev_attr_io_requeue_no_usable_path_count;
+extern struct device_attribute dev_attr_io_fail_no_available_path_count;
extern struct device_attribute subsys_attr_iopolicy;
static inline bool nvme_disk_is_ns_head(struct gendisk *disk)
#ifdef CONFIG_NVME_MULTIPATH
&dev_attr_multipath_failover_count.attr,
&dev_attr_io_requeue_no_usable_path_count.attr,
+ &dev_attr_io_fail_no_available_path_count.attr,
#endif
NULL,
};
if (!nvme_disk_is_ns_head(dev_to_disk(dev)))
return 0;
}
+ if (a == &dev_attr_io_fail_no_available_path_count.attr) {
+ if (!nvme_disk_is_ns_head(dev_to_disk(dev)))
+ return 0;
+ }
#endif
return a->mode;
}