From fcf4c5e4261e78ed574f6585b04c0c06d3d54aa7 Mon Sep 17 00:00:00 2001 From: GangCao Date: Thu, 31 Oct 2019 17:33:36 -0400 Subject: [PATCH] bdev/fio: always set the engine_data to NULL When initiating the io_u strcture from FIO, always set the engine_data to NULL first as the io_u structure is just malloced from FIO without specifically setting to zero. In the io_u free path, the engine_data field is checked whether to NULL or not. To avoid mischeck issue, explicitly set the engine_data to NULL at the beginning of the io_u init path. Change-Id: I52c8c251f36925650a44d14e35781bd8494ff358 Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472916 Community-CI: Broadcom SPDK FC-NVMe CI Reviewed-by: yidong0635 Reviewed-by: Ziye Yang Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- examples/bdev/fio_plugin/fio_plugin.c | 2 ++ examples/nvme/fio_plugin/fio_plugin.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index 2a237d8aa..565cf7e00 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -538,6 +538,8 @@ spdk_fio_io_u_init(struct thread_data *td, struct io_u *io_u) { struct spdk_fio_request *fio_req; + io_u->engine_data = NULL; + fio_req = calloc(1, sizeof(*fio_req)); if (fio_req == NULL) { return 1; diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 3958c4ba4..14cba2a7f 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -537,6 +537,8 @@ static int spdk_fio_io_u_init(struct thread_data *td, struct io_u *io_u) struct spdk_fio_thread *fio_thread = td->io_ops_data; struct spdk_fio_request *fio_req; + io_u->engine_data = NULL; + fio_req = calloc(1, sizeof(*fio_req)); if (fio_req == NULL) { return 1;