Commit 90aba31a authored by Gal Hammer's avatar Gal Hammer Committed by Tomasz Zawadzki
Browse files

bdev/ocf: Implement ENOMEM handling when submitting IO to base device



Replaced the TODO comment with an error handing in case SPDK fails to
allocate memory for the IO request. Returning the proper error code
will use the bdev's no memory retry mechanism to handle the failure.

Signed-off-by: default avatarGal Hammer <gal.hammer@huawei.com>
Signed-off-by: default avatarShai Fultheim <shai.fultheim@huawei.com>
Change-Id: I151668f26b7f122dca95eaf65934be675e601952
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12372


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarRafal Stefanowski <rafal.stefanowski@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 26f503b0
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ vbdev_ocf_volume_submit_io_cb(struct spdk_bdev_io *bdev_io, bool success, void *
	assert(io_ctx != NULL);

	if (!success) {
		io_ctx->error |= 1;
		io_ctx->error = io_ctx->error ? : -OCF_ERR_IO;
	}

	if (io_ctx->iovs_allocated && bdev_io != NULL) {
@@ -360,10 +360,13 @@ vbdev_ocf_volume_submit_io(struct ocf_io *io)

end:
	if (status) {
		/* TODO [ENOMEM]: implement ENOMEM handling when submitting IO to base device */
		if (status == -ENOMEM) {
			io_ctx->error = -OCF_ERR_NO_MEM;
		} else {
			SPDK_ERRLOG("submission failed with status=%d\n", status);
		}

		/* Since callback is not called, we need to do it manually to free io structures */
		SPDK_ERRLOG("submission failed with status=%d\n", status);
		vbdev_ocf_volume_submit_io_cb(NULL, false, io);
	}
}