bdev: clean up child I/O in bdev core

When an I/O with children is being freed, also free its child I/O
requests that were allocated via spdk_bdev_get_child_io().

Change-Id: I2d44aed845c1035ae8f8cb07c5992da855f1dc99
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-29 14:06:00 -07:00 committed by Ben Walker
parent ffbc120d3e
commit 70ba1ba7cc

View File

@ -418,6 +418,24 @@ __submit_request(spdk_event_t event)
}
bdev->fn_table->submit_request(bdev_io);
} else {
struct spdk_bdev_io *child_io, *tmp;
TAILQ_FOREACH_SAFE(child_io, &bdev_io->child_io, link, tmp) {
/*
* Make sure no references to the parent I/O remain, since it is being
* returned to the free pool.
*/
child_io->parent = NULL;
TAILQ_REMOVE(&bdev_io->child_io, child_io, link);
/*
* Child I/O may have an rbuf that needs to be returned to a pool
* on a different core, so free it through the request submission
* process rather than calling put_io directly here.
*/
spdk_bdev_free_io(child_io);
}
spdk_bdev_put_io(bdev_io);
}
}