Commit 07e55326 authored by Nils Goroll's avatar Nils Goroll

register the worker which is unpending

because the push phase of unpending happens outside the tree lock, we
need to ensure only one thread is ever entering unpending

this is in preparation for future changes, right now, unpending is only
ever called from the topreq thread
parent bba038cb
......@@ -246,6 +246,7 @@ struct bytes_tree {
pthread_cond_t cond;
struct node *root;
struct node *front;
struct worker *unpend_owner;
int npending;
int retval;
};
......@@ -1832,9 +1833,19 @@ bytes_unpend(struct req *req, struct bytes_tree *tree)
struct node_head work;
int retval;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
CHECK_OBJ_NOTNULL(req->wrk, WORKER_MAGIC);
if (tree->unpend_owner != NULL)
return;
tree->unpend_owner = req->wrk;
do {
Lck_AssertHeld(&tree->tree_lock);
assert(tree->unpend_owner == req->wrk);
VSTAILQ_INIT(&work);
bytes_unpend_worklist(req, tree, &work);
......@@ -1851,6 +1862,8 @@ bytes_unpend(struct req *req, struct bytes_tree *tree)
}
bytes_set_delivered_worklist(tree, &work);
} while (1);
tree->unpend_owner = NULL;
}
static int v_matchproto_(vdp_init_f)
......
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