bdev: When a channel is destroyed, abort all queued I/O

Change-Id: I03d042cbb6de08f7e07b8c0ccc8af44d7b16ae3b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362614
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2017-05-11 09:48:07 -07:00 committed by Jim Harris
parent 35ab754449
commit 7058f85318

View File

@ -546,6 +546,24 @@ static void
spdk_bdev_channel_destroy(void *io_device, void *ctx_buf)
{
struct spdk_bdev_channel *ch = ctx_buf;
struct spdk_bdev_io *bdev_io, *tmp;
uint32_t core;
core = spdk_env_get_current_core();
TAILQ_FOREACH_SAFE(bdev_io, &g_bdev_mgr.need_buf_small[core], buf_link, tmp) {
if (bdev_io->ch == ch) {
TAILQ_REMOVE(&g_bdev_mgr.need_buf_small[core], bdev_io, buf_link);
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
}
}
TAILQ_FOREACH_SAFE(bdev_io, &g_bdev_mgr.need_buf_large[core], buf_link, tmp) {
if (bdev_io->ch == ch) {
TAILQ_REMOVE(&g_bdev_mgr.need_buf_large[core], bdev_io, buf_link);
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
}
}
spdk_put_io_channel(ch->channel);
spdk_put_io_channel(ch->mgmt_channel);