Commit f9061ca3 authored by Nils Goroll's avatar Nils Goroll

fix race - set_closed() needs to be moved further out now

previously, we called it way too early from within vdp_pesi_fini() /
vdp_pesi_bytes() - see 6632dc5d

but the call from vped_deliver() was still from within the FSM, and we
need to finish additional cleanup in ved_task() before we can let the
topreq thread start delivering and possibly fini'ing / freeing our node.
parent 4b1deec2
......@@ -920,7 +920,9 @@ ved_task(struct worker *wrk, void *priv)
task_fini(pesi_tree, req->transport_priv);
break;
case T_NEXUS:
assert(node->req == req); // XXX THIS HAS FAILED
assert(node->req == req);
assert(node->state == ST_OPEN ||
node->state == ST_PRIVATE);
/*
* XXX rethink: T_NEXUS' req gets fini't in
* bytes_push_worklist(), but not if it had no nodes below,
......@@ -928,7 +930,6 @@ ved_task(struct worker *wrk, void *priv)
* "zero object" case here
*/
if (VSTAILQ_EMPTY(&node->nexus.children)) {
assert(node->state == ST_DELIVERED);
assert(pesi == req->transport_priv);
assert(req == node->req);
......@@ -936,11 +937,22 @@ ved_task(struct worker *wrk, void *priv)
req = NULL;
pesi_destroy(&pesi);
req_fini(&node->req, wrk);
task_fini(pesi_tree, pesi);
} else {
// pesi destroyed within the FSM via vdp_pesi_fini
AZ(req->transport_priv);
pesi = NULL;
task_fini(pesi_tree, req->transport_priv);
}
Lck_Lock(&pesi_tree->tree->tree_lock);
set_closed(pesi_tree->tree, node);
Lck_Unlock(&pesi_tree->tree->tree_lock);
if (VSTAILQ_EMPTY(&node->nexus.children))
assert(node->state == ST_DELIVERED);
else
assert(node->state == ST_CLOSED);
task_fini(pesi_tree, pesi);
break;
default:
INCOMPL();
......@@ -2612,9 +2624,6 @@ clean:
noesi:
vped_close_first_vdp(req, &VDP_pesi_buf);
out:
Lck_Lock(&tree->tree_lock);
set_closed(tree, node);
Lck_Unlock(&tree->tree_lock);
return;
close:
VDP_close(req);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment