The following changes since commit 92ac72c415e7688f1423d24058eff19de590b32e: Fio 1.99.7 (2011-10-14 14:31:06 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (4): Fix off-by-one in fgets() size Fix strip blank space for empty string Don't request ETA until server has started jobs Fix fragmented package opcode mismatch client.c | 11 +++++++++-- init.c | 2 +- parse.c | 5 +++++ server.c | 12 ++++++++++-- server.h | 5 +++-- 5 files changed, 28 insertions(+), 7 deletions(-) --- Diff of recent changes: diff --git a/client.c b/client.c index c72f034..fb678e1 100644 --- a/client.c +++ b/client.c @@ -58,8 +58,9 @@ enum { Client_created = 0, Client_connected = 1, Client_started = 2, - Client_stopped = 3, - Client_exited = 4, + Client_running = 3, + Client_stopped = 4, + Client_exited = 5, }; static FLIST_HEAD(client_list); @@ -824,6 +825,10 @@ static int handle_client(struct fio_client *client) handle_probe(client, cmd); free(cmd); break; + case FIO_NET_CMD_RUN: + client->state = Client_running; + free(cmd); + break; case FIO_NET_CMD_START: client->state = Client_started; free(cmd); @@ -861,6 +866,8 @@ static void request_client_etas(void) skipped++; continue; } + if (client->state != Client_running) + continue; assert(!client->eta_in_flight); flist_add_tail(&client->eta_list, &eta_list); diff --git a/init.c b/init.c index 0ccb185..72ec85d 100644 --- a/init.c +++ b/init.c @@ -964,7 +964,7 @@ int parse_jobs_ini(char *file, int is_buf, int stonewall_flag) if (is_buf) p = strsep(&file, "\n"); else - p = fgets(string, 4095, f); + p = fgets(string, 4096, f); if (!p) break; } diff --git a/parse.c b/parse.c index afbde61..18e8a40 100644 --- a/parse.c +++ b/parse.c @@ -273,6 +273,8 @@ void strip_blank_front(char **p) { char *s = *p; + if (!strlen(s)) + return; while (isspace((int) *s)) s++; @@ -283,6 +285,9 @@ void strip_blank_end(char *p) { char *start = p, *s; + if (!strlen(p)) + return; + s = strchr(p, ';'); if (s) *s = '\0'; diff --git a/server.c b/server.c index e7a9057..7c4804a 100644 --- a/server.c +++ b/server.c @@ -32,6 +32,7 @@ static int server_fd = -1; static char *fio_server_arg; static char *bind_sock; static struct sockaddr_in saddr_in; +static int first_cmd_check; static const char *fio_server_ops[FIO_NET_CMD_NR] = { "", @@ -48,6 +49,7 @@ static const char *fio_server_ops[FIO_NET_CMD_NR] = { "START", "STOP", "DISK_UTIL", + "RUN", }; const char *fio_server_op(unsigned int op) @@ -181,8 +183,12 @@ struct fio_net_cmd *fio_net_recv_cmd(int sk) if (first) memcpy(cmdret, &cmd, sizeof(cmd)); - else - assert(cmdret->opcode == cmd.opcode); + else if (cmdret->opcode != cmd.opcode) { + log_err("fio: fragment opcode mismatch (%d != %d)\n", + cmdret->opcode, cmd.opcode); + ret = 1; + break; + } if (!cmd.pdu_len) break; @@ -539,6 +545,8 @@ static int handle_connection(int sk, int block) void fio_server_idle_loop(void) { + if (!first_cmd_check) + fio_net_send_simple_cmd(server_fd, FIO_NET_CMD_RUN, 0, NULL); if (server_fd != -1) handle_connection(server_fd, 0); } diff --git a/server.h b/server.h index d709e98..da520e3 100644 --- a/server.h +++ b/server.h @@ -35,7 +35,7 @@ struct fio_net_int_cmd { }; enum { - FIO_SERVER_VER = 5, + FIO_SERVER_VER = 6, FIO_SERVER_MAX_PDU = 1024, @@ -52,7 +52,8 @@ enum { FIO_NET_CMD_START = 11, FIO_NET_CMD_STOP = 12, FIO_NET_CMD_DU = 13, - FIO_NET_CMD_NR = 14, + FIO_NET_CMD_RUN = 14, + FIO_NET_CMD_NR = 15, FIO_NET_CMD_F_MORE = 1UL << 0, -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html