lib/idxd: Fix the idxd_ops resource exhaustion in chan->ops_pool
The issue is that: We call cb_fn firstly, then add the related idxd_ops into the chan->ops_list. Then if in user's callback, we call spdk_idxd_submit_* function gain, then we will allocate new idxd_opts first. So if there is recursive spdk_idxd_submit_* in the call back function, then we will exhaust all the ops_pool resources. And the function will report -EBUSY issue in _idxd_prep_command function. And this patch fixes this issue by adding back idxd_ops before calling user's call_cb function. Change-Id: I32239fb29be875bc452803a48dc24ff5fa533016 Signed-off-by: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9401 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
43299f394d
commit
caa1f84e1c
@ -1108,6 +1108,8 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
struct idxd_ops *op, *tmp;
|
||||
int status = 0;
|
||||
int rc = 0;
|
||||
void *cb_arg;
|
||||
spdk_idxd_req_cb cb_fn;
|
||||
|
||||
assert(chan != NULL);
|
||||
|
||||
@ -1144,17 +1146,21 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
|
||||
break;
|
||||
}
|
||||
|
||||
if (op->cb_fn) {
|
||||
op->cb_fn(op->cb_arg, status);
|
||||
}
|
||||
|
||||
op->hw.status = status = 0;
|
||||
|
||||
cb_fn = op->cb_fn;
|
||||
cb_arg = op->cb_arg;
|
||||
op->hw.status = 0;
|
||||
if (op->desc->opcode == IDXD_OPCODE_BATCH) {
|
||||
_free_batch(op->batch, chan);
|
||||
} else if (op->batch == NULL) {
|
||||
TAILQ_INSERT_TAIL(&chan->ops_pool, op, link);
|
||||
}
|
||||
|
||||
if (cb_fn) {
|
||||
cb_fn(cb_arg, status);
|
||||
}
|
||||
|
||||
/* reset the status */
|
||||
status = 0;
|
||||
} else {
|
||||
/*
|
||||
* oldest locations are at the head of the list so if
|
||||
|
Loading…
Reference in New Issue
Block a user