[PATCH RFC 4/5] nvme: add sysfs attribute to change IO timeout per nvme controller
Mohamed Khalfella
mkhalfella at purestorage.com
Wed Feb 18 09:54:52 PST 2026
On Wed 2026-02-18 14:28:03 +0100, Maurizio Lombardi wrote:
> On Tue Feb 17, 2026 at 9:25 PM CET, Mohamed Khalfella wrote:
> >> @@ -4169,6 +4169,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
> >> mutex_unlock(&ctrl->namespaces_lock);
> >> goto out_unlink_ns;
> >> }
> >> + blk_queue_rq_timeout(ns->queue, ctrl->io_timeout);
> >
> > Given that io tagset->timeout has been initialized to ctrl->io_timeout
> > Do we still need the line above?
>
>
> Yes, the line is necessary. While the tagset is initialized with
> ctrl->io_timeout, that happens only once during tagset allocation.
>
> If the user later changes io_timeout via sysfs, ctrl->io_timeout is updated,
> but the tagset->timeout remains at the old default value. I deliberately
> do not update tagset->timeout in the sysfs handler because the tagset
> lifetime is tied to the controller state (e.g., it may be freed during a
> controller reset). Attempting to update the tagset from the sysfs path
> introduces a race condition where we might dereference a pointer to
> a tagset that is being destroyed.
>
> Therefore, when a new namespace is allocated (nvme_alloc_ns), the block
> layer initializes the queue using the stale tagset->timeout. We must
> explicitly override that with the current ctrl->io_timeout to
> ensure the new namespace respects the runtime configuration.
Yeah. I got it now. Thanks for the explanation.
It would great if there is way to update admin and io tagsets timeout.
More information about the Linux-nvme
mailing list