]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
nbd: fix max number of supported devs
authorMike Christie <mchristi@redhat.com>
Sun, 4 Aug 2019 19:10:06 +0000 (14:10 -0500)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 18:04:24 +0000 (19:04 +0100)
commite4ddf873affc6f54ccc80fe061816530073028af
tree33f48a8a369bc80d412963350a8757d5931117e8
parent7f9d2eb3424d5f17fa063a1415e546d2cd0d1e75
nbd: fix max number of supported devs

BugLink: https://bugs.launchpad.net/bugs/1849576
[ Upstream commit e9e006f5fcf2bab59149cb38a48a4817c1b538b4 ]

This fixes a bug added in 4.10 with commit:

commit 9561a7ade0c205bc2ee035a2ac880478dcc1a024
Author: Josef Bacik <jbacik@fb.com>
Date:   Tue Nov 22 14:04:40 2016 -0500

    nbd: add multi-connection support

that limited the number of devices to 256. Before the patch we could
create 1000s of devices, but the patch switched us from using our
own thread to using a work queue which has a default limit of 256
active works.

The problem is that our recv_work function sits in a loop until
disconnection but only handles IO for one connection. The work is
started when the connection is started/restarted, but if we end up
creating 257 or more connections, the queue_work call just queues
connection257+'s recv_work and that waits for connection 1 - 256's
recv_work to be disconnected and that work instance completing.

Instead of reverting back to kthreads, this has us allocate a
workqueue_struct per device, so we can block in the work.

Cc: stable@vger.kernel.org
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/block/nbd.c