Commit 70ba1ba7 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Ben Walker
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent ffbc120d
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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);
	}
}