[PATCH v2] nvme-multipath: add fail_if_no_path sysfs attribute

Krishna Iyer kiyer at crusoe.ai
Fri Sep 18 16:18:18 PDT 2026


On 9/18/26 1:58 AM, Nilay Shroff wrote:
>>   		switch (nvme_ctrl_state(ns->ctrl)) {
>>   		case NVME_CTRL_LIVE:
>> +			if (fail_if_no_path &&
>> +			    (ns->ana_state == NVME_ANA_INACCESSIBLE ||
>> +			     ns->ana_state == NVME_ANA_PERSISTENT_LOSS))
>> +				continue;
> I think we have helper nvme_state_is_live() which could be used here.

Will use it in v3. One note: !nvme_state_is_live() alone would also
cover NVME_ANA_CHANGE, which v2 deliberately keeps queueing since it
is transient and bounded by ANATT. So I'll keep an explicit
NVME_ANA_CHANGE check alongside the helper:

		if (fail_if_no_path &&
		    !nvme_state_is_live(ns->ana_state) &&
		    ns->ana_state != NVME_ANA_CHANGE)
			continue;

This also means moving nvme_state_is_live() above
nvme_available_path().

>> +	if (enable)
>> +		set_bit(NVME_NSHEAD_FAIL_IF_NO_PATH, &head->flags);
>> +	else
>> +		clear_bit(NVME_NSHEAD_FAIL_IF_NO_PATH, &head->flags);
> If the user stores the same value as the current setting, we could
> return immediately instead of waiting for synchronize_srcu() and
> scheduling the requeue work.

Good point, will fix in v3 using test_and_set_bit()/
test_and_clear_bit() and returning early when the value is unchanged.

> Otherwise changes look good.

Thanks for the review! I'll send v3 addressing both in the next few
days.

Thanks,
Krishna



More information about the Linux-nvme mailing list