Spdk/module/blob/bdev
Mike Gerdts 421fb11094 blob_bdev: defer free until all channels destroyed
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>
2023-03-28 03:57:35 +00:00
..
blob_bdev.c blob_bdev: defer free until all channels destroyed 2023-03-28 03:57:35 +00:00
Makefile so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
spdk_blob_bdev.map remove spdk_bdev_create_bs_dev_from_desc from map file 2022-11-09 08:19:04 +00:00