Recent changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following changes since commit 811ac503a6196f13da22565eb165c278988da4da:

  Compression fixes (2012-03-02 22:23:36 +0100)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Jens Axboe (7):
      server: fixup bug in sending jobs_eta command
      Add client references
      Avoid segfault if verify header appears longer than io_u
      Add regression test for verify bug
      Fix another verify segfault
      Add regression test for 8a99fdf6
      server: fix bad win32 indentation

 client.c                       |   17 ++++++++++++++++-
 server.c                       |    6 +++---
 t/jobs/t0003-0ae2c6e1-post.fio |   26 ++++++++++++++++++++++++++
 t/jobs/t0003-0ae2c6e1-pre.fio  |   22 ++++++++++++++++++++++
 t/jobs/t0004-8a99fdf6.fio      |   27 +++++++++++++++++++++++++++
 verify.c                       |   10 +++++++---
 6 files changed, 101 insertions(+), 7 deletions(-)
 create mode 100644 t/jobs/t0003-0ae2c6e1-post.fio
 create mode 100644 t/jobs/t0003-0ae2c6e1-pre.fio
 create mode 100644 t/jobs/t0004-8a99fdf6.fio

---

Diff of recent changes:

diff --git a/client.c b/client.c
index 8c85d2b..dd75882 100644
--- a/client.c
+++ b/client.c
@@ -37,6 +37,7 @@ struct fio_client {
 	char *hostname;
 	int port;
 	int fd;
+	unsigned int refs;
 
 	char *name;
 
@@ -119,8 +120,10 @@ static struct fio_client *find_client_by_fd(int fd)
 	flist_for_each(entry, &client_hash[bucket]) {
 		client = flist_entry(entry, struct fio_client, hash_list);
 
-		if (client->fd == fd)
+		if (client->fd == fd) {
+			client->refs++;
 			return client;
+		}
 	}
 
 	return NULL;
@@ -128,6 +131,11 @@ static struct fio_client *find_client_by_fd(int fd)
 
 static void remove_client(struct fio_client *client)
 {
+	assert(client->refs);
+
+	if (--client->refs)
+		return;
+
 	dprint(FD_NET, "client: removed <%s>\n", client->hostname);
 	flist_del(&client->list);
 
@@ -149,6 +157,11 @@ static void remove_client(struct fio_client *client)
 	sum_stat_clients--;
 }
 
+static void put_client(struct fio_client *client)
+{
+	remove_client(client);
+}
+
 static void __fio_client_add_cmd_option(struct fio_client *client,
 					const char *opt)
 {
@@ -215,6 +228,7 @@ int fio_client_add(const char *hostname, void **cookie)
 		return -1;
 
 	client->fd = -1;
+	client->refs = 1;
 
 	__fio_client_add_cmd_option(client, "fio");
 
@@ -1055,6 +1069,7 @@ int fio_handle_clients(void)
 				retval = 1;
 			} else if (client->error)
 				retval = 1;
+			put_client(client);
 		}
 	}
 
diff --git a/server.c b/server.c
index 5e94696..33f69ef 100644
--- a/server.c
+++ b/server.c
@@ -453,7 +453,7 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
 		je->iops[i]	= cpu_to_le32(je->iops[i]);
 	}
 
-	je->elapsed_sec		= cpu_to_le32(je->nr_running);
+	je->elapsed_sec		= cpu_to_le64(je->elapsed_sec);
 	je->eta_sec		= cpu_to_le64(je->eta_sec);
 
 	fio_net_send_cmd(server_fd, FIO_NET_CMD_ETA, je, size, cmd->tag);
@@ -1188,8 +1188,8 @@ int fio_start_server(char *pidfile)
 	int ret;
 
 #if defined(WIN32)
-    WSADATA wsd;
-    WSAStartup(MAKEWORD(2,2), &wsd);
+	WSADATA wsd;
+	WSAStartup(MAKEWORD(2,2), &wsd);
 #endif
 
 	if (!pidfile)
diff --git a/t/jobs/t0003-0ae2c6e1-post.fio b/t/jobs/t0003-0ae2c6e1-post.fio
new file mode 100644
index 0000000..8bc4f05
--- /dev/null
+++ b/t/jobs/t0003-0ae2c6e1-post.fio
@@ -0,0 +1,26 @@
+# Expected result: verify fails.
+# Buggy result: fio segfaults
+[global]
+ioengine=libaio
+direct=1
+filename=/tmp/foo
+iodepth=128
+size=1M
+loops=1
+group_reporting=1
+readwrite=read
+do_verify=1
+verify=md5
+verify_fatal=1
+numjobs=1
+thread
+verify_dump=1
+bs=4k
+
+[large_reads]
+offset=0G
+blocksize=1M
+
+[small_reads]
+offset=1G
+blocksize=512
diff --git a/t/jobs/t0003-0ae2c6e1-pre.fio b/t/jobs/t0003-0ae2c6e1-pre.fio
new file mode 100644
index 0000000..46f452c
--- /dev/null
+++ b/t/jobs/t0003-0ae2c6e1-pre.fio
@@ -0,0 +1,22 @@
+[global]
+ioengine=libaio
+direct=1
+filename=/tmp/foo
+iodepth=128
+size=10M
+loops=1
+group_reporting=1
+readwrite=write
+do_verify=0
+verify=md5
+numjobs=1
+thread
+verify_dump=1
+
+[small_writes]
+offset=0G
+blocksize=512
+
+[large_writes]
+offset=1G
+blocksize=1M
diff --git a/t/jobs/t0004-8a99fdf6.fio b/t/jobs/t0004-8a99fdf6.fio
new file mode 100644
index 0000000..09ae9b2
--- /dev/null
+++ b/t/jobs/t0004-8a99fdf6.fio
@@ -0,0 +1,27 @@
+# Expected result: fio runs to completion
+# Buggy result: fio segfaults
+[global]
+ioengine=libaio
+direct=1
+filename=/tmp/foo
+iodepth=128
+size=10M
+loops=1
+group_reporting=1
+readwrite=write
+do_verify=0
+verify=md5
+numjobs=1
+thread
+verify_dump=1
+
+[small_writes]
+offset=0G
+blocksize=512
+verify_interval=1M
+
+[large_writes]
+stonewall
+offset=1G
+blocksize=1M
+verify_interval=512
diff --git a/verify.c b/verify.c
index 5621db2..6dd7f6a 100644
--- a/verify.c
+++ b/verify.c
@@ -78,7 +78,7 @@ static unsigned int get_hdr_inc(struct thread_data *td, struct io_u *io_u)
 	unsigned int hdr_inc;
 
 	hdr_inc = io_u->buflen;
-	if (td->o.verify_interval)
+	if (td->o.verify_interval && td->o.verify_interval <= io_u->buflen)
 		hdr_inc = td->o.verify_interval;
 
 	return hdr_inc;
@@ -646,13 +646,17 @@ static int verify_trimmed_io_u(struct thread_data *td, struct io_u *io_u)
 	return ret;
 }
 
-static int verify_header(struct verify_header *hdr)
+static int verify_header(struct io_u *io_u, struct verify_header *hdr)
 {
 	void *p = hdr;
 	uint32_t crc;
 
 	if (hdr->magic != FIO_HDR_MAGIC)
 		return 0;
+	if (hdr->len > io_u->buflen) {
+		log_err("fio: verify header exceeds buffer length (%u > %lu)\n", hdr->len, io_u->buflen);
+		return 0;
+	}
 
 	crc = fio_crc32c(p, offsetof(struct verify_header, crc32));
 	if (crc == hdr->crc32)
@@ -695,7 +699,7 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u)
 			memswp(p, p + td->o.verify_offset, header_size);
 		hdr = p;
 
-		if (!verify_header(hdr)) {
+		if (!verify_header(io_u, hdr)) {
 			log_err("verify: bad magic header %x, wanted %x at "
 				"file %s offset %llu, length %u\n",
 				hdr->magic, FIO_HDR_MAGIC,
--
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


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux