From 37962990e490dee1fd35eb436ce6363d2052bd94 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 14 Jul 2017 13:32:50 -0700 Subject: [PATCH] nvme/fio_plugin: fix ->queue() error reporting FIO backends are supposed to return a negative value on error. Add special handling for -ENOMEM (out of requests) case to return FIO_Q_BUSY, indicating that FIO should resubmit the request later. This is part of the fix for issue #169, which is related to high queue depths with large I/Os causing the NVMe library to run out of request objects. Change-Id: I4fa4001b078b07c42fcd4d1357434575b2c84023 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/369664 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- examples/nvme/fio_plugin/fio_plugin.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index b1e2f83e6..ea4f527ad 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -371,7 +371,7 @@ static int spdk_fio_queue(struct thread_data *td, struct io_u *io_u) fio_qpair = fio_qpair->next; } if (fio_qpair == NULL || ns == NULL) { - return FIO_Q_COMPLETED; + return -ENXIO; } block_size = spdk_nvme_ns_get_sector_size(ns); @@ -392,9 +392,16 @@ static int spdk_fio_queue(struct thread_data *td, struct io_u *io_u) break; } - assert(rc == 0); + /* NVMe read/write functions return -ENOMEM if there are no free requests. */ + if (rc == -ENOMEM) { + return FIO_Q_BUSY; + } - return rc ? FIO_Q_COMPLETED : FIO_Q_QUEUED; + if (rc != 0) { + return -abs(rc); + } + + return FIO_Q_QUEUED; } static struct io_u *spdk_fio_event(struct thread_data *td, int event)