[PATCHv4 6/8] nvme: export I/O failure count when no path is available via sysfs
Nilay Shroff
nilay at linux.ibm.com
Thu Jul 2 06:10:46 PDT 2026
On 7/2/26 1:45 PM, John Garry wrote:
> On 16/05/2026 19:36, Nilay Shroff wrote:
>> +
>
> I'm just looking at this now for the scsi multipath/libmultipath work.
>
>> +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);
>
> is fail_cnt ever going to be non-zero? I assume that we allow the value to be stored to just reset the counter (to zero).
Yes, this is possible when the namespace head has no available path to
forward I/O. In that case, the counter can become non-zero for a
transient period before the namespace head is deleted. The namespace
head is removed once its reference count drops to zero.
The primary purpose of this attribute is to aid debugging. Under normal
operation, the counter is expected to be zero most of the time because
the namespace head is short-lived after all paths are removed. However,
if there is a subtle bug in the namespace head reference counting logic
that prevents it from being deleted, a non-zero value would remain
visible under:
/sys/block/<nshead-dev>/diag/io_fail_no_available_path_count
And yes this attribute is writable (as all other diag attributes), only
to allow users to reset the counter to zero and then observe subsequent
events.
Thanks,
--Nilay
More information about the Linux-nvme
mailing list