Fix race condition when using asynch verify
[fio.git] / verify.c
index faa5684d9dafa369551c41c4faf045b2fa4ad469..7d675e46de6b110c25b0145bd00b1453eba60e2f 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -437,6 +437,11 @@ int verify_io_u_async(struct thread_data *td, struct io_u *io_u)
        io_u->file = NULL;
 
        pthread_mutex_lock(&td->io_u_lock);
+       
+       if (io_u->flags & IO_U_F_IN_CUR_DEPTH) {
+               td->cur_depth--;
+               io_u->flags &= ~IO_U_F_IN_CUR_DEPTH;
+       }
        flist_del(&io_u->list);
        flist_add_tail(&io_u->list, &td->verify_list);
        pthread_mutex_unlock(&td->io_u_lock);