To avoid races that lead to use-after-free errors during esnap device hot add/remove, we need a way to ensure that the destroy callback does not free a bs_dev until all consumers are done. This adds reference counting to the create_channel() and destroy_channel() callbacks. The reference couunt is initialized to 1 and is decremented by destroy(). The destroy() and destroy_channel() callbacks are updated to free the bs_dev only when the reference count drops to 0. Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Change-Id: Ie0b873717e431b33ce6548f878643dbc66d4f956 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16422 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> |
||
---|---|---|
.. | ||
blob_bdev.c | ||
Makefile | ||
spdk_blob_bdev.map |