Re: [PATCHv4 6/8] nvme: export I/O failure count when no path is available via sysfs

Nilay Shroff <[email protected]>
Newsgroups org.infradead.lists.linux-nvme
Message-ID <[email protected]>
On 7/2/26 8:18 PM, John Garry wrote:
> On 02/07/2026 14:10, Nilay Shroff wrote:
>>
>> 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.
> 
> It's something minor, but it makes sense to me that we only allow users to reset the value to zero, like:
> 
> @@ -1249,7 +1249,7 @@ static ssize_t
> io_fail_no_available_path_count_store(struct device *dev,
>          struct nvme_ns_head *head = disk->private_data;
> 
>          err = kstrtoul(buf, 0, &fail_cnt);
> -       if (err)
> +       if (err || fail_cnt)
>                  return -EINVAL;
> 
>          atomic_long_set(&head->io_fail_no_available_path_count, fail_cnt);
> 

Yes practically, I think no one would want to set these
counters value to anything but zero. So I'm okay with
the above change.

Thanks,
--Nilay
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.