Commit f45c98dd authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

blobcli: use spdk_thread_send_msg when dumping blob



For thin provisioned blobs, an IO read to an unallocated
cluster completes inline, meaning that if the read
completion function issues another read, we can quickly
blow the stack.  So use spdk_thread_send_msg() to
issue the next read operation.

Fixes #2405.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I10a40b83bfc25fa6bbd8bc93b6fea36ac8ee83c6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11784


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent c32476bb
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -578,6 +578,8 @@ set_xattr_cb(void *cb_arg, struct spdk_blob *blob, int bserrno)
	spdk_blob_sync_md(cli_context->blob, sync_cb, cli_context);
}

static void __read_dump_cb(void *arg1);

/*
 * Callback function for reading a blob for dumping to a file.
 */
@@ -603,6 +605,19 @@ read_dump_cb(void *arg1, int bserrno)
		return;
	}

	/* This completion may have occurred in the context of a read to
	 * an unallocated cluster.  So we can't issue the next read here, or
	 * we risk overflowing the stack.  So use spdk_thread_send_msg() to
	 * make sure we unwind before doing the next read.
	 */
	spdk_thread_send_msg(spdk_get_thread(), __read_dump_cb, cli_context);
}

static void
__read_dump_cb(void *arg1)
{
	struct cli_context_t *cli_context = arg1;

	printf(".");
	if (++cli_context->io_unit_count < cli_context->blob_io_units) {
		/* perform another read */