client: fix double removal of client on job file open failure
authorJens Axboe <axboe@fb.com>
Thu, 28 Jan 2016 19:47:11 +0000 (12:47 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 28 Jan 2016 19:47:11 +0000 (12:47 -0700)
If fio is invoked as a client and the job file does not exist, it
will exit ala:

fio: job file <x.fio> open: No such file or directory
fio: client.c:240: remove_client: Assertion `client->refs' failed.

because the break path ends up doing the removal twice. Fix that
to only remove it once, so we don't trigger the assert.

Signed-off-by: Jens Axboe <axboe@fb.com>
client.c

index 515cbf2e178aae746d04a61ccfa0aab4b2d976c6..6bc114541062231f24d9bc0215e47102e05ec868 100644 (file)
--- a/client.c
+++ b/client.c
@@ -816,6 +816,8 @@ int fio_clients_send_ini(const char *filename)
        struct flist_head *entry, *tmp;
 
        flist_for_each_safe(entry, tmp, &client_list) {
+               bool failed = false;
+
                client = flist_entry(entry, struct fio_client, list);
 
                if (client->nr_files) {
@@ -827,12 +829,13 @@ int fio_clients_send_ini(const char *filename)
                                cf = &client->files[i];
 
                                if (fio_client_send_cf(client, cf)) {
+                                       failed = true;
                                        remove_client(client);
                                        break;
                                }
                        }
                }
-               if (client->sent_job)
+               if (client->sent_job || failed)
                        continue;
                if (!filename || fio_client_send_ini(client, filename, 0))
                        remove_client(client);