bdev: bdev_close() unlock g_bdev_mgr.mutex after spdk_io_device_unregister()

spdk_io_device_unregister() send message to call its callback. So to
make the following patches easier, consolidate g_bdev_mgr.mutex unlocks
to the end of spdk_bdev_close().

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: Ib3b5c72be06e764918da30d7aa9fbc2ccd33956e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12125
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2022-04-01 15:01:15 +09:00 committed by Tomasz Zawadzki
parent ced08048ee
commit b4bcf7721d

View File

@ -6521,15 +6521,15 @@ spdk_bdev_close(struct spdk_bdev_desc *desc)
if (bdev->internal.status == SPDK_BDEV_STATUS_REMOVING && TAILQ_EMPTY(&bdev->internal.open_descs)) {
rc = bdev_unregister_unsafe(bdev);
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
if (rc == 0) {
spdk_io_device_unregister(__bdev_to_io_dev(bdev), bdev_destroy_cb);
}
} else {
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
}
pthread_mutex_unlock(&g_bdev_mgr.mutex);
}
int