Commit a870a9a7 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

examples/perf: Avoid losing references to perf tasks.



Requeuing perf tasks for submission is done by swapping
currently queued tasks to a local list and then submitting
them one by one with TAILQ_FOREACH() and submit_single_io().
The problem here is that upon further failure in
submit_single_io() we move a task back to the queued list,
which causes the original list, on which TAILQ_FOREACH()
operates, to lose reference to the second element and exit
the loop. So in the end we just move the first task and the
rest are left hanging in the memory.

Fixes #3032

Change-Id: Ia55ff448be4213b9bfe3a685ec14b097f26a2278
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18908


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0ab00835
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1745,7 +1745,9 @@ work_fn(void *arg)
				/* Submit any I/O that is queued up */
				TAILQ_INIT(&swap);
				TAILQ_SWAP(&swap, &ns_ctx->queued_tasks, perf_task, link);
				TAILQ_FOREACH(task, &swap, link) {
				while (!TAILQ_EMPTY(&swap)) {
					task = TAILQ_FIRST(&swap);
					TAILQ_REMOVE(&swap, task, link);
					submit_single_io(task);
				}
			}