diff options
author | Mike Christie <mchristi@redhat.com> | 2019-12-08 16:51:50 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-31 16:36:36 +0100 |
commit | e83a26a49356a3dbd4f54102abe17fc594643698 (patch) | |
tree | ba5ed13f9a282e98c8921f895ef2c32417bb6906 /tools | |
parent | 07aaeed0e5886a15b75ce3a92aeff0ea77f48301 (diff) | |
download | linux-stable-e83a26a49356a3dbd4f54102abe17fc594643698.tar.gz linux-stable-e83a26a49356a3dbd4f54102abe17fc594643698.tar.bz2 linux-stable-e83a26a49356a3dbd4f54102abe17fc594643698.zip |
nbd: fix shutdown and recv work deadlock v2
commit 1c05839aa973cfae8c3db964a21f9c0eef8fcc21 upstream.
This fixes a regression added with:
commit e9e006f5fcf2bab59149cb38a48a4817c1b538b4
Author: Mike Christie <mchristi@redhat.com>
Date: Sun Aug 4 14:10:06 2019 -0500
nbd: fix max number of supported devs
where we can deadlock during device shutdown. The problem occurs if
the recv_work's nbd_config_put occurs after nbd_start_device_ioctl has
returned and the userspace app has droppped its reference via closing
the device and running nbd_release. The recv_work nbd_config_put call
would then drop the refcount to zero and try to destroy the config which
would try to do destroy_workqueue from the recv work.
This patch just has nbd_start_device_ioctl do a flush_workqueue when it
wakes so we know after the ioctl returns running works have exited. This
also fixes a possible race where we could try to reuse the device while
old recv_works are still running.
Cc: stable@vger.kernel.org
Fixes: e9e006f5fcf2 ("nbd: fix max number of supported devs")
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions