Commit d9603a2f authored by Ziye Yang's avatar Ziye Yang Committed by Tomasz Zawadzki
Browse files

bdev/rbd: Remove main_td field in struct bdev_rbd



Because we always create bdev_rbd instance in
spdk_thread_get_app_thread() thread.

This patch fixes the issue found in another ongoing patch:
In most cases, rbd->main_td was set, meaning that td
did not equal spdk_get_thread() here. But now this this
patch completely fixes this issue.

Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Change-Id: Ieaf9dd6a95bb63b51623070822b36a0ee32fe2a5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18271


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent dc833ba4
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ struct bdev_rbd {
	rbd_image_t image;

	rbd_image_info_t info;
	struct spdk_thread *main_td;
	struct spdk_thread *destruct_td;

	TAILQ_ENTRY(bdev_rbd) tailq;
@@ -339,8 +338,6 @@ bdev_rbd_init(struct bdev_rbd *rbd)
		return -1;
	}

	rbd->main_td = spdk_get_thread();

	return ret;
}

@@ -588,13 +585,6 @@ static int
bdev_rbd_destruct(void *ctx)
{
	struct bdev_rbd *rbd = ctx;
	struct spdk_thread *td;

	if (rbd->main_td == NULL) {
		td = spdk_get_thread();
	} else {
		td = rbd->main_td;
	}

	/* Start the destruct operation on the rbd bdev's
	 * main thread.  This guarantees it will only start
@@ -605,8 +595,8 @@ bdev_rbd_destruct(void *ctx)
	 * channel delete messages in flight to this thread.
	 */
	assert(rbd->destruct_td == NULL);
	rbd->destruct_td = td;
	spdk_thread_send_msg(td, _bdev_rbd_destruct, rbd);
	rbd->destruct_td = spdk_get_thread();
	spdk_thread_send_msg(spdk_thread_get_app_thread(), _bdev_rbd_destruct, rbd);

	/* Return 1 to indicate the destruct path is asynchronous. */
	return 1;
@@ -629,7 +619,6 @@ bdev_rbd_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io
{
	struct spdk_thread *submit_td = spdk_io_channel_get_thread(ch);
	struct bdev_rbd_io *rbd_io = (struct bdev_rbd_io *)bdev_io->driver_ctx;
	struct bdev_rbd *disk = (struct bdev_rbd *)bdev_io->bdev->ctxt;

	rbd_io->submit_td = submit_td;
	switch (bdev_io->type) {
@@ -649,7 +638,7 @@ bdev_rbd_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io
		break;

	case SPDK_BDEV_IO_TYPE_RESET:
		spdk_thread_exec_msg(disk->main_td, bdev_rbd_reset, bdev_io);
		spdk_thread_exec_msg(spdk_thread_get_app_thread(), bdev_rbd_reset, bdev_io);
		break;

	default: