libaio: don't call io_destroy(), let exit_aio() take care of it
[fio.git] / client.c
index 3cb7c1c50a92f27706da48f5d4ce64ccb7ca6b59..af3407cefe95a55fc211d5deb92bd4687fd922fc 100644 (file)
--- a/client.c
+++ b/client.c
@@ -62,6 +62,8 @@ static struct json_object *root = NULL;
 static struct json_array *clients_array = NULL;
 static struct json_array *du_array = NULL;
 
+static int error_clients;
+
 #define FIO_CLIENT_HASH_BITS   7
 #define FIO_CLIENT_HASH_SZ     (1 << FIO_CLIENT_HASH_BITS)
 #define FIO_CLIENT_HASH_MASK   (FIO_CLIENT_HASH_SZ - 1)
@@ -176,6 +178,9 @@ void fio_put_client(struct fio_client *client)
        if (!client->did_stat)
                sum_stat_clients--;
 
+       if (client->error)
+               error_clients++;
+
        free(client);
 }
 
@@ -380,6 +385,7 @@ static const char *server_name(struct fio_client *client, char *buf,
 static void probe_client(struct fio_client *client)
 {
        struct cmd_client_probe_pdu pdu;
+       const char *sname;
        uint64_t tag;
        char buf[64];
 
@@ -391,7 +397,9 @@ static void probe_client(struct fio_client *client)
        pdu.flags = 0;
 #endif
 
-       strcpy((char *) pdu.server, server_name(client, buf, sizeof(buf)));
+       sname = server_name(client, buf, sizeof(buf));
+       memset(pdu.server, 0, sizeof(pdu.server));
+       strncpy((char *) pdu.server, sname, sizeof(pdu.server) - 1);
 
        fio_net_send_cmd(client->fd, FIO_NET_CMD_PROBE, &pdu, sizeof(pdu), &tag, &client->cmd_list);
 }
@@ -883,6 +891,10 @@ static void convert_ts(struct thread_stat *dst, struct thread_stat *src)
        dst->latency_target     = le64_to_cpu(src->latency_target);
        dst->latency_window     = le64_to_cpu(src->latency_window);
        dst->latency_percentile.u.f = fio_uint64_to_double(le64_to_cpu(src->latency_percentile.u.i));
+
+       dst->nr_block_infos     = le64_to_cpu(src->nr_block_infos);
+       for (i = 0; i < dst->nr_block_infos; i++)
+               dst->block_infos[i] = le32_to_cpu(src->block_infos[i]);
 }
 
 static void convert_gs(struct group_run_stats *dst, struct group_run_stats *src)
@@ -1613,6 +1625,7 @@ static int fio_check_clients_timed_out(void)
                else
                        log_err("fio: client %s timed out\n", client->hostname);
 
+               client->error = ETIMEDOUT;
                remove_client(client);
                ret = 1;
        }
@@ -1706,5 +1719,5 @@ int fio_handle_clients(struct client_ops *ops)
        fio_client_json_fini();
 
        free(pfds);
-       return retval;
+       return retval || error_clients;
 }