Spdk/module/bdev
Jim Harris a70aae4610 bdev_rbd: do final clean up on main_td
The bdev layer doesn't call the destruct callback until
all channels have been released, but because the channel
delete callback passes message to the main thread, we can
end up with a complicated race condition.  Currently we
have a deferred_free code path to handle this race, but
we can handle this a bit more cleanly by doing the
construct operation on the main_td as well.

This also simplifies the next patch which will
asynchronously destruct the bdev to fix an RPC bug.

Here's the race:

1) first channel was created on thread A, so disk->main_td = thread A
2) second channel was created on thread B
3) first channel is freed (but disk->main_td is still thread A)
4) spdk_bdev_unregister is called on thread C
5) bdev layer gives callback on thread B to upper layer
6) upper layer on thread B frees channel
7) bdev_rbd_destroy_cb runs on thread B and has to send msg to thread A
   for processing
8) bdev layer calls bdev_rbd_destruct on thread C (since step #4 was on
   thread C)

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I25ede2dc56e24dac0919aed05b9def2560823ee7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9158
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-08-25 07:26:46 +00:00
..
aio bdev/aio: Remove the unused link entry in bdev_aio_task 2021-08-02 09:04:46 +00:00
compress compress: Add RPC option to enable mlx5_pci PMD 2021-08-16 08:48:31 +00:00
crypto so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
delay bdev: Add API to get SPDK memory domains used by bdev 2021-08-20 07:26:10 +00:00
error bdev/error: properly initialize value of num for inject_error RPC 2021-04-15 21:41:05 +00:00
ftl so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
gpt lib/bdev: move to spdk_bdev_part_base_construct_ext() 2021-03-09 08:54:53 +00:00
iscsi bdev/iscsi: apply max_unmap and max_unmap_segments to bdev layer 2021-05-14 10:00:54 +00:00
lvol bdev/lvol: asserting lvol ptr before dereference 2021-08-24 07:18:54 +00:00
malloc bdev/malloc: check block size when creating a new block device 2021-03-01 12:07:09 +00:00
null lib/bdev: added spdk_bdev_module_fini_done() 2021-08-23 08:49:56 +00:00
nvme lib/bdev: added spdk_bdev_module_fini_done() 2021-08-23 08:49:56 +00:00
ocf bdev/ocf: Fix devices block size mismatch 2021-08-20 07:27:43 +00:00
passthru bdev: Add API to get SPDK memory domains used by bdev 2021-08-20 07:26:10 +00:00
pmem lib/bdev: added spdk_bdev_module_fini_done() 2021-08-23 08:49:56 +00:00
raid bdev/raid: remove deprecated parameter strip_size 2021-03-29 07:41:09 +00:00
rbd bdev_rbd: do final clean up on main_td 2021-08-25 07:26:46 +00:00
split splite/vbdev_split: Free base part bdev on the error path. 2021-03-02 08:02:58 +00:00
uring so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
virtio lib/bdev: added spdk_bdev_module_fini_done() 2021-08-23 08:49:56 +00:00
zone_block bdev/zone_block: check for unmap support in zone reset 2021-08-12 12:57:24 +00:00
Makefile bdev: move bdev_rpc library contents 2020-09-25 11:43:42 +00:00