Commit 91916654 authored by Denis Barakhtanov's avatar Denis Barakhtanov Committed by Tomasz Zawadzki
Browse files

bdev/daos: early bdev creation failure detection



If during a channel creation, an error happens, due to incorrect parameters
e.g. wrong pool / container name, or some other internal DAOS errors (like
reaching CART context limit), bdev_daos_io_channel_create_cb() signals
about such errors, however, spdk_io_device_register() does not takes them into account.
The device creation succeeds, returning successful RPC response and leaving bdev
in the bdev lists but it's completely unusable and not amendable.

This patch tries to detect it early and return an RPC error on failure.

Signed-off-by: default avatarDenis Barakhtanov <denis.barahtanov@croit.io>
Change-Id: I04758e6243566b4e619a1420aa7c01f6041441a6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15168


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent 5497616e
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -583,7 +583,7 @@ bdev_daos_io_channel_create_cb(void *io_device, void *ctx_buf)
	ch->disk = io_device;

	if (spdk_call_unaffinitized(_bdev_daos_io_channel_create_cb, ch) == NULL) {
		return EINVAL;
		return -EINVAL;
	}

	SPDK_DEBUGLOG(bdev_daos, "%s: starting daos event queue poller\n",
@@ -634,6 +634,7 @@ create_bdev_daos(struct spdk_bdev **bdev,
	int rc;
	size_t len;
	struct bdev_daos *daos;
	struct bdev_daos_io_channel ch = {};

	SPDK_NOTICELOG("%s: creating bdev_daos disk on '%s:%s'\n", name, pool, cont);

@@ -717,6 +718,19 @@ create_bdev_daos(struct spdk_bdev **bdev,
		return rc;
	}

	/* We try to connect to the DAOS container during channel creation, so simulate
	 * creating a channel here, so that we can return a failure when the DAOS bdev
	 * is created, instead of finding it out later when the first channel is created
	 * and leaving unusable bdev registered.
	 */
	rc = bdev_daos_io_channel_create_cb(daos, &ch);
	if (rc) {
		SPDK_ERRLOG("'%s' could not initialize io-channel: %s", name, strerror(-rc));
		bdev_daos_free(daos);
		return rc;
	}
	bdev_daos_io_channel_destroy_cb(daos, &ch);

	spdk_io_device_register(daos, bdev_daos_io_channel_create_cb,
				bdev_daos_io_channel_destroy_cb,
				sizeof(struct bdev_daos_io_channel),
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ free_rpc_construct_daos(struct rpc_construct_daos *r)
	free(r->uuid);
	free(r->pool);
	free(r->cont);
	free(r->oclass);
}

static const struct spdk_json_object_decoder rpc_construct_daos_decoders[] = {