[PATCH V3 2/8] nvme: add sysfs attribute to change admin timeout per nvme controller
Maurizio Lombardi
mlombard at arkamax.eu
Thu Apr 23 05:58:25 PDT 2026
On Thu Apr 23, 2026 at 2:46 PM CEST, Daniel Wagner wrote:
> On Wed, Apr 22, 2026 at 01:08:44PM +0200, Maurizio Lombardi wrote:
>> On Wed Apr 22, 2026 at 12:10 PM CEST, Daniel Wagner wrote:
>> > On Fri, Apr 10, 2026 at 09:39:18AM +0200, Maurizio Lombardi wrote:
>> >> + /*
>> >> + * Wait until the controller reaches the LIVE state
>> >> + * to be sure that admin_q and fabrics_q are
>> >> + * properly initialized.
>> >> + */
>> >> + if (!test_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags))
>> >> + return -EBUSY;
>> >
>> > I assume the idea is to use an udev rule to set the value. Though I
>> > think this is racy:
>> >
>> > nvme_change_uevent(ctrl, "NVME_EVENT=connected");
>> > set_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags);
>>
>>
>> Not really, the idea was about to prevent the user from setting the
>> timeouts too early during the controller's initialization.
>
> Yes, but then how do you know when is too early? Do you read/poll the
> state of the controller?
>
>> Otherwise the user could try to change the timeout while
>> admin_q and fabrics_q are still being created.
>>
>> if the NVME_CTRL_STARTED_ONCE bit is set, we know that the
>> initialization has been completed and that admin_q and fabrics_q will
>> exist until the controller will be torn down.
>
> Yes, that is all fine but I think it would be good to be able to use
> udev here as we have it other timeouts.
Ok I understand, what do you think if we swap the order in
nvme_start_ctrl() so the flag is set before userspace is notified?
set_bit(NVME_CTRL_STARTED_ONCE, &ctrl->flags);
nvme_change_uevent(ctrl, "NVME_EVENT=connected");
Maurizio
More information about the Linux-nvme
mailing list