+11
−8
Loading
After spdk_bdev_register() completes, the bdev is ready to use. However, nvme_bdev_create() continue configuration even after spdk_bdev_register() call. This is a potential issue but if spdk_bdev_unregister() is called on a thread different from the thread which called spdk_bdev_register(), the race between nvme_bdev_create() and bdev_nvme_destruct() can cause unexpected behavior. Even on the current SPDK master, this is possible when the bdev susystem starts shutdown when there still exists any NVMe bdev. To fix the potential issue, move some operations prior to the spdk_bdev_register() call and revert these if spdk_bdev_register() fails. Additionally, for readability, move enqueueing nvme_ns to bdev->nvme_ns_list close to the similar operations. Signed-off-by:Alexey Marchuk <alexeymar@nvidia.com> Signed-off-by:
Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I3b70dfe64e1860fa9ed1704f7982415d61d4ecc0 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17712 Community-CI: Mellanox Build Bot Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by:
Jim Harris <james.r.harris@intel.com>