verify: fix a bug with verify_async
authorJens Axboe <axboe@fb.com>
Wed, 23 Jul 2014 14:11:43 +0000 (16:11 +0200)
committerJens Axboe <axboe@fb.com>
Wed, 23 Jul 2014 14:11:43 +0000 (16:11 +0200)
commitf8b0bd103ba18def828a0eab5611484486eed566
treefb1e5e7d06d7e9ad7f69f5d2a68d966032e01c20
parent7ffa8930764e6ccc5bf036fe4d73f1d7276453e5
verify: fix a bug with verify_async

There's a race between marking an io_u as deferred, completing it,
and checking of that flag. It cannot be done reliably for async
verify threads. So change the mechanism to have the verify_async
part pull the io_u completely, so we don't have to check for a flag
in it after we have run ->end_io().

This fixes a bug with verify_async, where fio would crash with
this message:

fio: io_u.c:1315: __get_io_u: Assertion `io_u->flags & IO_U_F_FREE' failed

This race has always existed, but was made considerably worse with
this commit:

commit 2ae0b204743d6b4048c6fffd46c6280a70f2ecd1
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue May 28 14:16:55 2013 +0200

    Replace list based free/busy/requeue list with FIFO + ring

    Cache friendliness of the list is pretty low. This has
    provably lower overhead.

since we moved from a single list holding the io, to a separate
verify list and io_u queues. The above bug is happening because
the io_u ends up on both the freelist and the pending verify list,
causing mayhem.

Reported-by: scameron@beardog.cce.hp.com
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c
io_u_queue.h
ioengine.h
verify.c
verify.h