Fix segfault with verify_async
authorSteven Lang <tirea@google.com>
Wed, 26 Oct 2011 07:46:50 +0000 (09:46 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 26 Oct 2011 07:47:14 +0000 (09:47 +0200)
commitd7ee2a7d431c2cabdf56d04ca14805cad72cf985
tree43a478f02c5faf68eb3fe7436a0bfe5b68e5ae82
parentef71e317e6e1e96a4776610035cd67711603e1f8
Fix segfault with verify_async

At some point the filename was added to the report on verify failures,
however this broke verify_async, as the file pointer on the io_u is
set to NULL before the verify thread sees the io_u.  The result is a
segfault when there is a verify mismatch.

This patch changes the semantics of a deferred free (IO_U_F_FREE_DEF)
to have already called put_file, but not set the file pointer to NULL.
 This is safe to do as the file list is only freed after all the
verify threads have been terminated.

FYI - this is the minimal config to cause the error this patch fixes,
and is what I used to test the fix.  (Not using thread still causes a
segfault, but it is reported more subtly since just a sub-process hits
it.)

[segv]
ioengine=null
size=4k
verify=meta
rw=read
thread
verify_async=1

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c
verify.c