Commit 86480b22 authored by David Johnson's avatar David Johnson

Decrease lock contention on new nodes in cnc_port_add (inspired by #6).

This function previously would only lock the csw and cport associated
with the new node, but it didn't actually lock the node -- it left that
to others.  I see no reason to allow that to continue; we're going to
lock it shortly anyway.  And this will prevent contention in the new
node path vs ARPs for or from this node in the packet_in path; that is
what I thought the original problem in #6 was --- no longer sure if that
really was it.  Still, this is an improvement, I believe.
parent 10dc1aa8
Pipeline #1904 passed with stage
in 30 seconds
......@@ -1500,6 +1500,7 @@ void cnc_port_add(mul_switch_t *sw, mul_port_t *port) {
cncerr("couldn't alloc node");
goto finish;
}
cn_obj_lock(node);
rc = metadata_get_node_info(csw, cport, node);
if (rc != 0) {
cncerr("couldn't get metatdata for node");
......@@ -1569,6 +1570,8 @@ void cnc_port_add(mul_switch_t *sw, mul_port_t *port) {
}
finish:
if (node)
cn_obj_unlock(node);
cn_obj_unlock(cport);
cn_obj_unlock(csw);
......
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