Re: [PATCH v5 7/8] nbd: remove queue freeze for newly created nbd from netlink path

"yu kuai" <[email protected]> Sun, 2 Aug 2026 20:16:05 +0800
Newsgroups org.kernel.vger.linux-block
Message-ID <[email protected]>
=E5=9C=A8 2026/7/30 16:20, Yang Erkun =E5=86=99=E9=81=93:

> Previous commits has removed the queue freeze in nbd_add_socket and
> nbd_set_size during nbd device setup. However, a queue freeze can still
> occur when nbd_start_device calls blk_mq_update_nr_hw_queues if the
> socket connection count does not match nbd->tag_set->nr_hw_queues.
>
> The nbd_start_device function can be invoked through either the ioctl or
> netlink paths. The ioctl path only allows reusing an existing inactivate
> nbd device, there is nothing more we can do to prevent the queue freeze
> since the old nbd->tag_set->nr_hw_queues may not match the new socket
> connection count. Similarly, the netlink path can reuse a preferred
> inactivate nbd device, and again, we cannot do more in this scenario.
> However, the netlink path can also add a new nbd device using
> nbd_dev_add. In this case, we can obtain the new number of socket
> connections, and by adding a new argument representing the expected
> nr_hw_queues in nbd_dev_add, we can ensure the queue freeze is avoided
> for this situation.
>
> Signed-off-by: Yang Erkun<[email protected]>
> ---
>   drivers/block/nbd.c | 13 +++++++++----
>   1 file changed, 9 insertions(+), 4 deletions(-)
Reviewed-by: Yu Kuai <[email protected]>

--=20
Thanks,
Kuai