From 761325e2fb933a343b82d2fb036d70a1c8cefa3a Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Wed, 20 Dec 2017 16:44:45 +0100 Subject: [PATCH] fio_plugin: add proper I/O error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When an I/O failed to be issued, fio used to freeze entirely. From the fio perspective, that I/O was never being completed. Fio expected us to complete it during the I/O thread cleanup & shutdown. (spdk_fio_getevents, line 578) This patch makes the I/O issue callback complete the I/O immediately on any encountered error. Return codes are now properly propagated with io_u->error field. This also allows some additional error messages to be printed. Change-Id: I9fc3cb6c6a946b78fc8384701827a815103ed4c6 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/392534 Reviewed-by: Ben Walker Reviewed-by: Paweł Niedźwiecki Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System --- examples/bdev/fio_plugin/fio_plugin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index d639431c8..4f3094f1f 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -473,6 +473,7 @@ spdk_fio_completion_cb(struct spdk_bdev_io *bdev_io, struct spdk_fio_thread *fio_thread = td->io_ops_data; assert(fio_thread->iocq_count < fio_thread->iocq_size); + fio_req->io->error = success ? 0 : EIO; fio_thread->iocq[fio_thread->iocq_count++] = fio_req->io; spdk_bdev_free_io(bdev_io); @@ -489,7 +490,8 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u) if (!target) { SPDK_ERRLOG("Unable to look up correct I/O target.\n"); - return -1; + fio_req->io->error = ENODEV; + return FIO_Q_COMPLETED; } switch (io_u->ddir) { @@ -518,7 +520,8 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u) } if (rc != 0) { - return -abs(rc); + fio_req->io->error = abs(rc); + return FIO_Q_COMPLETED; } return FIO_Q_QUEUED;