ioengines: Fix td->io_issues[ddir] over decrement
authorSitsofe Wheeer <sitsofe@yahoo.com>
Sun, 27 Nov 2016 10:34:53 +0000 (10:34 +0000)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Sun, 27 Nov 2016 21:40:26 +0000 (21:40 +0000)
If an ioengine returned FIO_Q_BUSY, td->io_issues[ddir] would be
over decremented: once in td_io_queue() and then again in
requeue_io_u(). This was because td_io_queue() reverted various values
upon finding the queue busy but requeue_io_u() found the I/O was still
in flight so decremented again. This then showed up as unsigned
underflow on td->io_issues[ddir].

Fix this by clearing IO_U_F_FLIGHT on the I/O when we find the queue was
busy in td_io_queue().

Signed-off-by: Sitsofe Wheeer <sitsofe@yahoo.com>
ioengines.c

index 4c53fe554d65184f8f768466f225b2f24e76702f..1b58168608046390146765b7f546c9b9d964736e 100644 (file)
@@ -298,6 +298,7 @@ int td_io_queue(struct thread_data *td, struct io_u *io_u)
                td->io_issues[ddir]--;
                td->io_issue_bytes[ddir] -= buflen;
                td->rate_io_issue_bytes[ddir] -= buflen;
+               io_u_clear(td, io_u, IO_U_F_FLIGHT);
        }
 
        /*