When queue action was missing from a trace, handling of dispatch didn't
quite get things right and crashed due to NULL pointer dereference.
Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
return NULL;
}
-static int hash_queued_io(struct blk_io_trace *io)
+static struct pending_io *hash_queued_io(struct blk_io_trace *io)
{
struct pending_io *pio;
int ret;
if (ret < 0) {
/* crud, the IO is there already */
free(pio);
- return ret;
+ return NULL;
}
- return 0;
+ return pio;
}
static struct pending_io *hash_dispatched_io(struct blk_io_trace *io)
struct pending_io *pio;
pio = io_hash_table_search(io->sector);
- if (!pio)
- hash_queued_io(io);
+ if (!pio) {
+ pio = hash_queued_io(io);
+ if (!pio)
+ return NULL;
+ }
pio->dispatch_time = io->time;
return pio;
}