lib/bdev: spdk_bdev_open_ext() returns -ENODEV if bdev whose name matches is not found

For example, for pass-through bdev modules, it is acceptable that
bdev whose name matches is not found when creating a pass-through
bdev.

The next patch will replace spdk_bdev_open() by spdk_bdev_open_ext()
for pass-through bdev module.

spdk_bdev_open_ext() includes spdk_bdev_get_by_name(). Pass-through
bdev module has to know if spdk_bdev_get_by_name() returned NULL
in spdk_bdev_open_ext().

Hence change spdk_bdev_open_ext() to return -ENODEV if spdk_bdev_get_by_name()
returned NULL.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I525a7118481586161bd0e8c07b96a887c0a04210
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4575
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Shuhei Matsumoto 2020-10-09 11:48:29 +09:00 committed by Tomasz Zawadzki
parent 0238bb734a
commit c0e0693145

View File

@ -5709,7 +5709,7 @@ spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t event
if (bdev == NULL) {
SPDK_ERRLOG("Failed to find bdev with name: %s\n", bdev_name);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
return -EINVAL;
return -ENODEV;
}
desc = calloc(1, sizeof(*desc));