On Mon, 2018-11-19 at 22:11 +0800, Weiping Zhang wrote:
> Give a interface to adjust io timeout by device.
>
> Signed-off-by: Weiping Zhang <[email protected]>
> ---
>
> Changes since v1:
> * make sure timeout > 0
>
> block/blk-sysfs.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
Documentation for new block layer sysfs attributes should be added in
Documentation/ABI/testing/sysfs-block and also in
Documentation/block/queue-sysfs.txt.
Please add such documentation for this new attribute.
> +static ssize_t queue_io_timeout_store(struct request_queue *q, const char
> *page,
> + size_t count)
> +{
> + unsigned int val;
> + int err;
> +
> + err = kstrtou32(page, 10, &val);
> + if (err || val == 0)
> + return -EINVAL;
> +
> + blk_queue_rq_timeout(q, val);
> +
> + return count;
> +}
Setting the block layer timeout to a very high value (e.g. hours) may make it
look
like a request got stuck without users having an easy way of figuring out what
is
going on. I'm wondering whether this function should restrict the upper bound
for
block layer timeouts. How about limiting timeout values to ten minutes?
Thanks,
Bart.