Fix issue with dangling pointer in the rbd engine
[fio.git] / engines / rbd.c
index 9d64efd233cab1dfd4188f8ada16351d649c8f5e..dc6e7db674ba38c6252a61fde337f061938f0555 100644 (file)
@@ -131,8 +131,10 @@ static int _fio_rbd_connect(struct thread_data *td)
 
 failed_open:
        rados_ioctx_destroy(rbd_data->io_ctx);
+       rbd_data->io_ctx = NULL;
 failed_shutdown:
        rados_shutdown(rbd_data->cluster);
+       rbd_data->cluster = NULL;
 failed_early:
        return 1;
 }
@@ -379,6 +381,7 @@ static int fio_rbd_setup(struct thread_data *td)
        if (!td->files_index) {
                add_file(td, td->o.filename ? : "rbd", 0, 0);
                td->o.nr_files = td->o.nr_files ? : 1;
+               td->o.open_files++;
        }
        f = td->files[0];
        f->real_file_size = info.size;