[PATCH RFC 2/5] nvme: add sysfs attribute to change admin timeout per nvme controller
Maurizio Lombardi
mlombard at arkamax.eu
Thu Feb 19 08:16:57 PST 2026
On Wed Feb 18, 2026 at 7:00 PM CET, Mohamed Khalfella wrote:
>> +static ssize_t nvme_admin_timeout_store(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t count)
>> +{
>> + struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
>> + u32 timeout;
>> + int err;
>> +
>> + err = kstrtou32(buf, 10, &timeout);
>> + if (err || !timeout)
>> + return -EINVAL;
>> +
>> + blk_queue_rq_timeout(ctrl->admin_q, msecs_to_jiffies(timeout));
>> +
>> + return count;
>> +}
>> +
>> +static struct device_attribute dev_attr_admin_timeout = \
>> + __ATTR(admin_timeout, S_IRUGO | S_IWUSR, \
>> + nvme_admin_timeout_show, nvme_admin_timeout_store);
>> +
>
> Do we want similar attribute to ctrl->fabrics_q?
Makes sense, I think.
We don't need other attributes, it should be sufficient to modify
nvme_admin_timeout_store() to do the following:
static ssize_t nvme_admin_timeout_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
u32 timeout;
int err;
err = kstrtou32(buf, 10, &timeout);
if (err || !timeout)
return -EINVAL;
blk_queue_rq_timeout(ctrl->admin_q, msecs_to_jiffies(timeout));
if (ctrl->ops->flags & NVME_F_FABRICS)
blk_queue_rq_timeout(ctrl->fabrics_q, msecs_to_jiffies(timeout));
return count;
}
Maurizio
More information about the Linux-nvme
mailing list