Unverified Commit efbe143e authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14469 io_uring/tctx: work around xa_store() allocation error issue

parents c0f9297f 017a1b1f
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -47,8 +47,19 @@ static struct io_wq *io_init_wq_offload(struct io_ring_ctx *ctx,
void __io_uring_free(struct task_struct *tsk)
{
	struct io_uring_task *tctx = tsk->io_uring;
	struct io_tctx_node *node;
	unsigned long index;

	WARN_ON_ONCE(!xa_empty(&tctx->xa));
	/*
	 * Fault injection forcing allocation errors in the xa_store() path
	 * can lead to xa_empty() returning false, even though no actual
	 * node is stored in the xarray. Until that gets sorted out, attempt
	 * an iteration here and warn if any entries are found.
	 */
	xa_for_each(&tctx->xa, index, node) {
		WARN_ON_ONCE(1);
		break;
	}
	WARN_ON_ONCE(tctx->io_wq);
	WARN_ON_ONCE(tctx->cached_refs);