Commit 3f5d6eb2 authored by Nils Goroll's avatar Nils Goroll

only enter ST_OPEN subtrees which we own

parent 0c8110d1
......@@ -1349,12 +1349,24 @@ bytes_unpend_worklist(struct req *req, struct bytes_tree *tree,
return;
}
/* XXX what if we are a different worker and within a tree ?*/
/*
* if unpending changes between threads, we need to make sure that we
* only descend into ST_OPEN T_NEXUS which we own, so re-start at the
* root
*
* this might seem inefficient, but we skip over any delivered subtrees,
* so we will not walk the whole tree each time
*/
AN(tree->front);
if (tree->front_owner == req->wrk)
node = tree->front;
else
node = tree->root;
/* when starting, we do not want to see any ST_UNPENDING nodes */
check = CHK_DELI;
node = tree->front;
while (node != NULL) {
assert_node(node, CHK_ANY);
......@@ -1405,16 +1417,27 @@ bytes_unpend_worklist(struct req *req, struct bytes_tree *tree,
assert_node(node, CHK_PEND);
/* XXX only enter ST_OPEN if we own it */
/* for ST_OPEN, only descend if we own it */
if (node->type == T_NEXUS) {
node = VSTAILQ_FIRST(&node->nexus.children);
continue;
}
next = VSTAILQ_FIRST(&node->nexus.children);
if (node->state == ST_OPEN) {
VSLdbg(req, "bytes_unpend: init node no children");
switch (node->state) {
case ST_CLOSED:
// closed node with no children must not exist
AN(next);
node = next;
continue;
case ST_OPEN:
set_front(tree, node, req->wrk);
AN(node->nexus.owner);
if (node->nexus.owner == req->wrk) {
node = next;
continue;
}
return;
default:
INCOMPL();
}
}
assert(node->state == ST_DATA);
......
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