numam-spdk/lib/bdev
Shuhei Matsumoto db8bd99588 bdev/part: Add spdk_bdev_part_base_construct_ext() to pass bdev_name
Add an new API spdk_bdev_part_base_construct_ext() to pass not bdev but
bdev_name to fix the race condition due to the time gap between
spdk_bdev_get_by_name() and spdk_bdev_open(). A pointer to a bdev is
valid only while the bdev is opened.

In the new API, spdk_bdev_get_by_name() is included in
spdk_bdev_part_base_construct_ext() and the caller has to know if
the bdev exists or not. Hence spdk_bdev_part_base_construct_ext()
returns return code and returns the created part object by the double
pointer.

Another critical change is that base is just freed if spdk_bdev_open_ext()
failed with -ENODEV. The reason is that if we call spdk_bdev_part_base_free()
for that case, the configuration is removed by the registered callback
and so bdev_examine() will not work.

The following patches will replace spdk_bdev_part_base_construct()
by spdk_bdev_part_base_construct_ext() for the corresponding bdev
modules.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2db027a159559c403cdfbd71800afba590b0f328
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4576
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-10-16 08:14:34 +00:00
..
bdev_internal.h bdev: rename spdk_bdev_get_io to bdev_channel_get_io 2019-11-20 09:34:18 +00:00
bdev_rpc.c log: remove internal log.h header 2020-10-15 08:23:39 +00:00
bdev_zone.c lib/bdev: remove _spdk prefix from functions. 2020-05-27 07:35:02 +00:00
bdev.c log: remove internal log.h header 2020-10-15 08:23:39 +00:00
Makefile bdev: add bdev_examine_bdev API 2020-08-20 08:56:53 +00:00
part.c bdev/part: Add spdk_bdev_part_base_construct_ext() to pass bdev_name 2020-10-16 08:14:34 +00:00
scsi_nvme.c nvme: fix command specific status code 2020-02-20 09:49:24 +00:00
spdk_bdev.map bdev/part: Add spdk_bdev_part_base_construct_ext() to pass bdev_name 2020-10-16 08:14:34 +00:00
vtune.c mk: don't use '-include spdk/config.h' 2018-10-02 23:13:32 +00:00