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> |
||
---|---|---|
.. | ||
accel | ||
bdev | ||
blob | ||
blobfs | ||
env_dpdk | ||
event | ||
sock | ||
Makefile |