When a bdev is being unregistered, after all channels have been closed, the bdev layer calls the module's destruct callback for the bdev before calling the bdev unregister callback. For the rbd module, the destruct callback is bdev_rbd_destruct. This callback unregisters the rbd io_device which is an asynchronous operation. We need to return >0 from bdev_rbd_destruct to inform the bdev layer that this is an asynchronous operation, so that it does not immediately call the bdev unregister callback. Once the rbd io_device is unregistered, we can call spdk_bdev_destruct_done() which will trigger the bdev layer to finally call the bdev unregister callback. Without this fix, deleting an rbd bdev would complete before the backing cluster reference had been released. This meant that even if you had deleted all rbd bdevs, there might still be cluster references in place for a short period of time. It's better to wait to complete the delete operation until the cluster reference has been released to avoid this issue (which this patch now does). Fixes issue #2069. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I8ac156c89d3e235a95ef196308cc349e6078bfd7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9115 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: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> |
||
---|---|---|
.. | ||
bdev_rbd_rpc.c | ||
bdev_rbd.c | ||
bdev_rbd.h | ||
Makefile |