From: Yufei Ren Date: Thu, 15 Mar 2012 13:44:47 +0000 (+0100) Subject: rdma engine graceful teardown X-Git-Tag: fio-2.0.6~11 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a05d62b28f18e37256f2698106169b1177708cc1;p=fio.git rdma engine graceful teardown For rdma ioengine's one side operation, RDMA_WRITE or RDMA_READ, server side gets a message from client side that the task is finished. In previous version, the server simply exit() in td_io_commit() which causes segmentation fault in thread mode or process hanging in process mode. This patch achieves graceful tear down by setting up `td->done` as UDP engine did. Signed-off-by: Jens Axboe --- diff --git a/engines/rdma.c b/engines/rdma.c index 54fd1946..79d72d20 100644 --- a/engines/rdma.c +++ b/engines/rdma.c @@ -674,7 +674,8 @@ static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us, rdma_poll_wait(td, IBV_WC_RECV); dprint(FD_IO, "fio: recv FINISH message\n"); - exit(0); + td->done = 1; + return 0; } return i; diff --git a/ioengines.c b/ioengines.c index 1a0898de..bb7833f1 100644 --- a/ioengines.c +++ b/ioengines.c @@ -208,6 +208,16 @@ int td_io_getevents(struct thread_data *td, unsigned int min, unsigned int max, { int r = 0; + /* + * For ioengine=rdma one side operation RDMA_WRITE or RDMA_READ, + * server side gets a message from the client + * side that the task is finished, and + * td->done is set to 1 after td_io_commit(). In this case, + * there is no need to reap complete event in server side. + */ + if (td->done) + return 0; + if (min > 0 && td->io_ops->commit) { r = td->io_ops->commit(td); if (r < 0)