LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: pkalever@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	nbd@other.debian.org, josef@toxicpanda.com, axboe@kernel.dk,
	idryomov@redhat.com, xiubli@redhat.com,
	Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Subject: Re: [PATCH v1 2/2] nbd: reset the queue/io_timeout to default on disconnect
Date: Thu, 16 Sep 2021 16:23:40 +0800	[thread overview]
Message-ID: <YUL/DGZiUnQQGHVX@T590> (raw)
In-Reply-To: <20210806142914.70556-3-pkalever@redhat.com>

On Fri, Aug 06, 2021 at 07:59:14PM +0530, pkalever@redhat.com wrote:
> From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> 
> Without any changes to NBD_ATTR_TIMEOUT (default is 30 secs),
> $ rbd-nbd map rbd-pool/image0 --try-netlink
> /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 30000
> $ rbd-nbd unmap /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 30000
> 
> Now user sets NBD_ATTR_TIMEOUT to 60,
> $ rbd-nbd map rbd-pool/image0 --try-netlink --io-timeout 60
> /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 60000
> $ rbd-nbd unmap /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 60000
> 
> Now user doesn't alter NBD_ATTR_TIMEOUT, but sysfs still shows it as 60,
> $ rbd-nbd map rbd-pool/image0 --try-netlink
> /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 60000
> $ rbd-nbd unmap /dev/nbd0
> $ cat /sys/block/nbd0/queue/io_timeout
> 60000
> 
> The problem exists with ioctl interface too.
> 
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> ---
>  drivers/block/nbd.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 16a1a14b1fd1..a45aabc4914b 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -158,6 +158,7 @@ static void nbd_connect_reply(struct genl_info *info, int index);
>  static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info);
>  static void nbd_dead_link_work(struct work_struct *work);
>  static void nbd_disconnect_and_put(struct nbd_device *nbd);
> +static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout);
>  
>  static inline struct device *nbd_to_dev(struct nbd_device *nbd)
>  {
> @@ -1250,7 +1251,7 @@ static void nbd_config_put(struct nbd_device *nbd)
>  			destroy_workqueue(nbd->recv_workq);
>  		nbd->recv_workq = NULL;
>  
> -		nbd->tag_set.timeout = 0;
> +		nbd_set_cmd_timeout(nbd, 0);
>  		nbd->disk->queue->limits.discard_granularity = 0;
>  		nbd->disk->queue->limits.discard_alignment = 0;
>  		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
> @@ -2124,6 +2125,10 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
>  	if (ret)
>  		goto out;
>  
> +	/*
> +	 * On reconfigure, if NBD_ATTR_TIMEOUT is not provided, we will
> +	 * continue to use the cmd timeout provided with connect initially.
> +	 */
>  	if (info->attrs[NBD_ATTR_TIMEOUT])
>  		nbd_set_cmd_timeout(nbd,
>  				    nla_get_u64(info->attrs[NBD_ATTR_TIMEOUT]));
> -- 
> 2.31.1
> 

Looks fine:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


  reply	other threads:[~2021-09-16  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 14:29 [PATCH v1 0/2] " pkalever
2021-08-06 14:29 ` [PATCH v1 1/2] block: cleanup: define default command timeout and use it pkalever
2021-09-16  8:22   ` Ming Lei
2021-10-27  2:18     ` Prasanna Kalever
2021-10-27  2:20       ` Prasanna Kalever
2021-08-06 14:29 ` [PATCH v1 2/2] nbd: reset the queue/io_timeout to default on disconnect pkalever
2021-09-16  8:23   ` Ming Lei [this message]
2021-10-27  2:25     ` Prasanna Kalever
2021-09-16  6:25 ` [PATCH v1 0/2] " Prasanna Kalever
2021-10-27  2:41 ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUL/DGZiUnQQGHVX@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=idryomov@redhat.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=pkalever@redhat.com \
    --cc=prasanna.kalever@redhat.com \
    --cc=xiubli@redhat.com \
    --subject='Re: [PATCH v1 2/2] nbd: reset the queue/io_timeout to default on disconnect' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).