summaryrefslogtreecommitdiff
path: root/ofproto/ofproto.c
diff options
context:
space:
mode:
authorDaniele Di Proietto <ddiproietto@vmware.com>2014-10-01 11:54:09 -0700
committerBen Pfaff <blp@nicira.com>2014-10-01 12:13:51 -0700
commit58f195398e4d457d2b83b760935a65a70d9b1384 (patch)
tree9adec548708f4adaab1205d46df8674380774e65 /ofproto/ofproto.c
parent538919d3a672eab8a561048acf9a8e1721cd559c (diff)
downloadopenvswitch-58f195398e4d457d2b83b760935a65a70d9b1384.tar.gz
ofproto: Do not postpone closing the mgmt socket
When the bridge datapath_type is changed, ofproto is destroyed and immediately recreated. This involves closing and reopening the mgmt socket. If the destruction of the 'connmgr' is postponed, a race condition might happen, where we first recreate the socket and then try to destroy it. Reported-by: Daniel Badea <daniel.badea@windriver.com> Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto/ofproto.c')
-rw-r--r--ofproto/ofproto.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 5233a4ddd..127d8c3dd 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -535,6 +535,7 @@ ofproto_create(const char *datapath_name, const char *datapath_type,
if (error) {
VLOG_ERR("failed to open datapath %s: %s",
datapath_name, ovs_strerror(error));
+ connmgr_destroy(ofproto->connmgr);
ofproto_destroy__(ofproto);
return error;
}
@@ -1390,8 +1391,6 @@ ofproto_destroy__(struct ofproto *ofproto)
ovs_rwlock_destroy(&ofproto->groups_rwlock);
hmap_destroy(&ofproto->groups);
- connmgr_destroy(ofproto->connmgr);
-
hmap_remove(&all_ofprotos, &ofproto->hmap_node);
free(ofproto->name);
free(ofproto->type);
@@ -1450,6 +1449,12 @@ ofproto_destroy(struct ofproto *p)
}
p->ofproto_class->destruct(p);
+
+ /* We should not postpone this because it involves deleting a listening
+ * socket which we may want to reopen soon. 'connmgr' should not be used
+ * by other threads */
+ connmgr_destroy(p->connmgr);
+
/* Destroying rules is deferred, must have 'ofproto' around for them. */
ovsrcu_postpone(ofproto_destroy__, p);
}