client: ignore a client timeout, if the last thing we saw as a trigger
authorJens Axboe <axboe@kernel.dk>
Thu, 30 Nov 2017 20:27:40 +0000 (13:27 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Nov 2017 20:27:40 +0000 (13:27 -0700)
If triggers are used and are fatal to the fio backend (killing power,
etc), then we don't have time to process the stop/quit commands. We
expect the client to go away, but the backend can't let us know.

If the last thing we saw was a trigger command, don't exit in error
if the client times out and goes away.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c
client.h

index 11fa262..5466265 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1666,6 +1666,8 @@ int fio_handle_client(struct fio_client *client)
        dprint(FD_NET, "client: got cmd op %s from %s (pdu=%u)\n",
                fio_server_op(cmd->opcode), client->hostname, cmd->pdu_len);
 
+       client->last_cmd = cmd->opcode;
+
        switch (cmd->opcode) {
        case FIO_NET_CMD_QUIT:
                if (ops->quit)
@@ -1940,7 +1942,10 @@ static int fio_check_clients_timed_out(void)
                else
                        log_err("fio: client %s timed out\n", client->hostname);
 
-               client->error = ETIMEDOUT;
+               if (client->last_cmd != FIO_NET_CMD_VTRIGGER)
+                       client->error = ETIMEDOUT;
+               else
+                       log_info("fio: ignoring timeout due to vtrigger\n");
                remove_client(client);
                ret = 1;
        }
index 394b685..90082a3 100644 (file)
--- a/client.h
+++ b/client.h
@@ -39,6 +39,7 @@ struct fio_client {
        int port;
        int fd;
        unsigned int refs;
+       unsigned int last_cmd;
 
        char *name;