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 <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/445580
Reviewed-by: Jakub Radtke <jakub.radtke@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Wojciech Malikowski 2019-02-20 08:50:00 -05:00 committed by Jim Harris
parent 53d446c8a3
commit 0f12c406d1

View File

@ -733,10 +733,14 @@ ftl_submit_read(struct ftl_io *io, ftl_next_ppa_fn next_ppa,
ftl_io_iovec_addr(io), ftl_io_iovec_addr(io),
ftl_ppa_addr_pack(io->dev, ppa), lbk_cnt, ftl_ppa_addr_pack(io->dev, ppa), lbk_cnt,
ftl_io_cmpl_cb, io, 0); 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); SPDK_ERRLOG("spdk_nvme_ns_cmd_read failed with status: %d\n", rc);
io->status = -EIO; io->status = -EIO;
break; break;
} else if (rc == -ENOMEM) {
io->status = rc;
break;
} }
ftl_io_update_iovec(io, lbk_cnt); ftl_io_update_iovec(io, lbk_cnt);