bdev: Hold mutex when adding bdev name to global bdev name tree
We had not held mutex when adding bdev name to global bdev name tree in bdev_name_add(). Fix these in this patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I33813638f11da85263ec0c8849e566d247a45d43 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8524 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: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
20ba4a0dbe
commit
d06f1c498f
@ -3262,7 +3262,10 @@ bdev_name_add(struct spdk_bdev_name *bdev_name, struct spdk_bdev *bdev, const ch
|
||||
|
||||
bdev_name->bdev = bdev;
|
||||
|
||||
pthread_mutex_lock(&g_bdev_mgr.mutex);
|
||||
tmp = RB_INSERT(bdev_name_tree, &g_bdev_mgr.bdev_names, bdev_name);
|
||||
pthread_mutex_unlock(&g_bdev_mgr.mutex);
|
||||
|
||||
if (tmp != NULL) {
|
||||
SPDK_ERRLOG("Bdev name %s already exists\n", name);
|
||||
free(bdev_name->name);
|
||||
|
Loading…
Reference in New Issue
Block a user