From 0f12c406d1e9d960f3432ea3009fe7b80d667d72 Mon Sep 17 00:00:00 2001 From: Wojciech Malikowski Date: Wed, 20 Feb 2019 08:50:00 -0500 Subject: [PATCH] lib/ftl: Propagate ENOMEM error during read to upper layer ENOMEM is expected when nvme_qpair will be out of resources. In such a case ENOMEM shall be propagated to allow upper (bdev) layer proper handling. Change-Id: Ie647c2d3efff24a8de949a22ac42a31dfd0e78b7 Signed-off-by: Wojciech Malikowski Reviewed-on: https://review.gerrithub.io/c/445580 Reviewed-by: Jakub Radtke Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- lib/ftl/ftl_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index e13a80e49..1ae75d83e 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -733,10 +733,14 @@ ftl_submit_read(struct ftl_io *io, ftl_next_ppa_fn next_ppa, ftl_io_iovec_addr(io), ftl_ppa_addr_pack(io->dev, ppa), lbk_cnt, ftl_io_cmpl_cb, io, 0); - if (rc) { + + if (rc != 0 && rc != -ENOMEM) { SPDK_ERRLOG("spdk_nvme_ns_cmd_read failed with status: %d\n", rc); io->status = -EIO; break; + } else if (rc == -ENOMEM) { + io->status = rc; + break; } ftl_io_update_iovec(io, lbk_cnt);