1
0
Fork 0
alistair23-linux/drivers/block
Mike Christie b3ead320dc 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:46:34 +01:00
..
aoe block: aoe: Fix kernel crash due to atomic sleep when exiting 2019-08-08 07:29:02 -06:00
drbd block: drbd: remove a stray unlock in __drbd_send_protocol() 2019-11-08 06:55:22 -07:00
mtip32xx
paride paride/pcd: need to check if cd->disk is null in pcd_detect 2019-09-04 07:04:37 -06:00
rsxx rsxx: add missed destroy_workqueue calls in remove 2019-11-14 13:59:49 -07:00
xen-blkback xen/blkback: fix memory leaks 2019-08-12 08:18:37 -06:00
zram zram: fix race between backing_dev_show and backing_dev_store 2019-10-19 06:32:32 -04:00
Kconfig docs: blockdev: add it to the admin-guide 2019-07-15 11:03:01 -03:00
Makefile
amiflop.c
ataflop.c ataflop: Mark expected switch fall-through 2019-07-29 15:24:58 -06:00
brd.c
cryptoloop.c
floppy.c floppy: fix usercopy direction 2019-08-09 07:41:36 -06:00
loop.c loop: fix no-unmap write-zeroes request behavior 2019-12-31 16:44:31 +01:00
loop.h
nbd.c nbd: fix shutdown and recv work deadlock v2 2019-12-31 16:46:34 +01:00
null_blk.h null_blk: format pr_* logs with pr_fmt 2019-09-16 08:38:29 -06:00
null_blk_main.c null_blk: format pr_* logs with pr_fmt 2019-09-16 08:38:29 -06:00
null_blk_zoned.c null_blk: Fix zoned command return code 2019-10-09 21:00:20 -06:00
pktcdvd.c pktcdvd: remove warning on attempting to register non-passthrough dev 2019-09-22 10:01:05 -06:00
ps3disk.c
ps3vram.c
rbd.c rbd: silence bogus uninitialized warning in rbd_object_map_update_finish() 2019-11-14 19:00:53 +01:00
rbd_types.h
skd_main.c
skd_s1120.h
sunvdc.c
swim.c
swim3.c
swim_asm.S
sx8.c
umem.c
umem.h
virtio_blk.c
xen-blkfront.c
xsysace.c
z2ram.c