rdma engine graceful teardown
authorYufei Ren <renyufei83@gmail.com>
Thu, 15 Mar 2012 13:44:47 +0000 (14:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Mar 2012 13:44:47 +0000 (14:44 +0100)
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 <axboe@kernel.dk>
engines/rdma.c
ioengines.c

index 54fd19463462229c1a5bd99b433798ee925eda99..79d72d20c844d7f8a393c6e1e7873a3f5bbde99c 100644 (file)
@@ -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;
index 1a0898de701e349acdd9f4a2c1337504374334ec..bb7833f120a6c5a62ba839750c15bb2e170e8582 100644 (file)
@@ -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)