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: Gal Hammer <gal.hammer@huawei.com> Signed-off-by: Shai 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: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Rafal Stefanowski <rafal.stefanowski@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
26f503b00f
commit
90aba31ac3
@ -175,7 +175,7 @@ vbdev_ocf_volume_submit_io_cb(struct spdk_bdev_io *bdev_io, bool success, void *
|
|||||||
assert(io_ctx != NULL);
|
assert(io_ctx != NULL);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
io_ctx->error |= 1;
|
io_ctx->error = io_ctx->error ? : -OCF_ERR_IO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (io_ctx->iovs_allocated && bdev_io != NULL) {
|
if (io_ctx->iovs_allocated && bdev_io != NULL) {
|
||||||
@ -360,10 +360,13 @@ vbdev_ocf_volume_submit_io(struct ocf_io *io)
|
|||||||
|
|
||||||
end:
|
end:
|
||||||
if (status) {
|
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 */
|
/* 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);
|
vbdev_ocf_volume_submit_io_cb(NULL, false, io);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user