From 9ad234a121159655979c0938974bc2824d4f4188 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 5 Feb 2020 17:38:47 +0100 Subject: [PATCH] examples/fio_plugin: don't allow starting in daemonized fio server A nice message about not supporting fio daemon mode is better than seeing CRC errors. Resolves #1118 Change-Id: I274e7a053e2fa464e26a19bf2b8b76395ad40e7c Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/575 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- examples/bdev/fio_plugin/fio_plugin.c | 14 ++++++++++++++ examples/nvme/fio_plugin/fio_plugin.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index e20a4a19c..b29f4a68f 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -405,6 +405,20 @@ spdk_fio_setup(struct thread_data *td) unsigned int i; struct fio_file *f; + /* we might be running in a daemonized FIO instance where standard + * input and output were closed and fds 0, 1, and 2 are reused + * for something important by FIO. We can't ensure we won't print + * anything (and so will our dependencies, e.g. DPDK), so abort early. + * (is_backend is an fio global variable) + */ + if (is_backend) { + char buf[1024]; + snprintf(buf, sizeof(buf), + "SPDK FIO plugin won't work with daemonized FIO server."); + fio_server_text_output(FIO_LOG_ERR, buf, sizeof(buf)); + return -1; + } + if (!td->o.use_thread) { SPDK_ERRLOG("must set thread=1 when using spdk plugin\n"); return -1; diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 543bb1b59..3d720018f 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -372,6 +372,20 @@ static int spdk_fio_setup(struct thread_data *td) char *trid_info; unsigned int i; + /* we might be running in a daemonized FIO instance where standard + * input and output were closed and fds 0, 1, and 2 are reused + * for something important by FIO. We can't ensure we won't print + * anything (and so will our dependencies, e.g. DPDK), so abort early. + * (is_backend is an fio global variable) + */ + if (is_backend) { + char buf[1024]; + snprintf(buf, sizeof(buf), + "SPDK FIO plugin won't work with daemonized FIO server."); + fio_server_text_output(FIO_LOG_ERR, buf, sizeof(buf)); + return -1; + } + if (!td->o.use_thread) { log_err("spdk: must set thread=1 when using spdk plugin\n"); return 1;