2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 21:38:13 +00:00

ofproto: Add more thread safety annotations.

These would have found the problem fixed in commit c7be3f559349 (connmgr:
Fix attempt to take mutex recursively when exiting fail-open.).

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff 2014-01-10 11:36:35 -08:00
parent deb64473f6
commit feb8a80bb9
3 changed files with 8 additions and 4 deletions

View File

@ -454,7 +454,7 @@ static void add_controller(struct connmgr *, const char *target, uint8_t dscp,
OVS_REQUIRES(ofproto_mutex); OVS_REQUIRES(ofproto_mutex);
static struct ofconn *find_controller_by_target(struct connmgr *, static struct ofconn *find_controller_by_target(struct connmgr *,
const char *target); const char *target);
static void update_fail_open(struct connmgr *); static void update_fail_open(struct connmgr *) OVS_EXCLUDED(ofproto_mutex);
static int set_pvconns(struct pvconn ***pvconnsp, size_t *n_pvconnsp, static int set_pvconns(struct pvconn ***pvconnsp, size_t *n_pvconnsp,
const struct sset *); const struct sset *);
@ -771,6 +771,7 @@ update_in_band_remotes(struct connmgr *mgr)
static void static void
update_fail_open(struct connmgr *mgr) update_fail_open(struct connmgr *mgr)
OVS_EXCLUDED(ofproto_mutex)
{ {
if (connmgr_has_controllers(mgr) if (connmgr_has_controllers(mgr)
&& mgr->fail_mode == OFPROTO_FAIL_STANDALONE) { && mgr->fail_mode == OFPROTO_FAIL_STANDALONE) {

View File

@ -182,6 +182,7 @@ fail_open_run(struct fail_open *fo)
* controller, exits fail open mode. */ * controller, exits fail open mode. */
void void
fail_open_maybe_recover(struct fail_open *fo) fail_open_maybe_recover(struct fail_open *fo)
OVS_EXCLUDED(ofproto_mutex)
{ {
if (fail_open_is_active(fo) if (fail_open_is_active(fo)
&& connmgr_is_any_controller_admitted(fo->connmgr)) { && connmgr_is_any_controller_admitted(fo->connmgr)) {
@ -191,6 +192,7 @@ fail_open_maybe_recover(struct fail_open *fo)
static void static void
fail_open_recover(struct fail_open *fo) fail_open_recover(struct fail_open *fo)
OVS_EXCLUDED(ofproto_mutex)
{ {
struct match match; struct match match;
@ -250,6 +252,7 @@ fail_open_create(struct ofproto *ofproto, struct connmgr *mgr)
/* Destroys 'fo'. */ /* Destroys 'fo'. */
void void
fail_open_destroy(struct fail_open *fo) fail_open_destroy(struct fail_open *fo)
OVS_EXCLUDED(ofproto_mutex)
{ {
if (fo) { if (fo) {
if (fail_open_is_active(fo)) { if (fail_open_is_active(fo)) {

View File

@ -40,11 +40,11 @@ is_fail_open_rule(const struct rule *rule)
} }
struct fail_open *fail_open_create(struct ofproto *, struct connmgr *); struct fail_open *fail_open_create(struct ofproto *, struct connmgr *);
void fail_open_destroy(struct fail_open *); void fail_open_destroy(struct fail_open *) OVS_EXCLUDED(ofproto_mutex);
void fail_open_wait(struct fail_open *); void fail_open_wait(struct fail_open *);
bool fail_open_is_active(const struct fail_open *); bool fail_open_is_active(const struct fail_open *);
void fail_open_run(struct fail_open *); void fail_open_run(struct fail_open *);
void fail_open_maybe_recover(struct fail_open *); void fail_open_maybe_recover(struct fail_open *) OVS_EXCLUDED(ofproto_mutex);
void fail_open_flushed(struct fail_open *); void fail_open_flushed(struct fail_open *) OVS_EXCLUDED(ofproto_mutex);
#endif /* fail-open.h */ #endif /* fail-open.h */