563f69ebe8
spdk_bdev_register() and spdk_bdev_add_alias() had not held mutex when adding bdev name or alias to global bdev name tree. This bug caused unexpected error when traversing global bdev name tree. The next patch will fix the bug. This patch is a preparation for the fix. spdk_bdev_get_by_name() had not held mutex while traversing bdev name tree. The major callers to spdk_bdev_get_by_name() had held mutex when calling it. However, this was not clear. Factor out the internal of spdk_bdev_get_by_name() into a helper function bdev_get_by_name() and then change spdk_bdev_get_by_name() to lock and unlock when calling bdev_get_by_name(). Then replace spdk_bdev_get_by_name() call in spdk_bdev_alias_add() and bdev_register() by bdev_get_by_name() call. spdk_bdev_get_by_name() call in spdk_bdev_examine() is not changed. This is called only from JSON RPC and not related with the bug. So we want to fix only unlocked access to global bdev name tree. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I25f07694e569eec10dba6c3c8543f6ce77412fe8 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8523 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: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> |
||
---|---|---|
.. | ||
bdev_internal.h | ||
bdev_rpc.c | ||
bdev_zone.c | ||
bdev.c | ||
Makefile | ||
part.c | ||
scsi_nvme.c | ||
spdk_bdev.map | ||
vtune.c |