linux/drivers/block
Mike Christie e83a26a493 nbd: fix shutdown and recv work deadlock v2
commit 1c05839aa9 upstream.

This fixes a regression added with:

commit e9e006f5fc
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: e9e006f5fc ("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>
2019-12-31 16:36:36 +01:00
..
aoe
drbd drbd: Change drbd_request_detach_interruptible's return type to int 2019-12-17 20:35:31 +01:00
mtip32xx
paride
rsxx rsxx: add missed destroy_workqueue calls in remove 2019-12-13 08:51:06 +01:00
xen-blkback xen/blkback: fix memory leaks 2019-09-06 10:21:57 +02:00
zram zram: fix race between backing_dev_show and backing_dev_store 2019-11-06 13:05:10 +01:00
amiflop.c amiflop: clean up on errors during setup 2019-12-01 09:16:25 +01:00
ataflop.c
brd.c
cryptoloop.c
DAC960.c
DAC960.h
floppy.c floppy: fix usercopy direction 2019-09-21 07:17:14 +02:00
Kconfig
loop.c loop: fix no-unmap write-zeroes request behavior 2019-12-31 16:35:32 +01:00
loop.h
Makefile
nbd.c nbd: fix shutdown and recv work deadlock v2 2019-12-31 16:36:36 +01:00
null_blk_main.c block: null_blk: fix race condition for null_del_dev 2019-07-26 09:14:07 +02:00
null_blk_zoned.c
null_blk.h
pktcdvd.c pktcdvd: remove warning on attempting to register non-passthrough dev 2019-10-07 18:57:15 +02:00
ps3disk.c
ps3vram.c
rbd_types.h
rbd.c
skd_main.c skd: fixup usage of legacy IO API 2019-12-01 09:16:20 +01:00
skd_s1120.h
sunvdc.c
swim_asm.S
swim.c
swim3.c
sx8.c
umem.c
umem.h
virtio_blk.c
xen-blkfront.c
xsysace.c
z2ram.c