From feb8a80bb9621f17ed0a249c79b0d02e9543e64a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 10 Jan 2014 11:36:35 -0800 Subject: [PATCH] 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 --- ofproto/connmgr.c | 3 ++- ofproto/fail-open.c | 3 +++ ofproto/fail-open.h | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index ea7979570..b7c16d2b5 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -454,7 +454,7 @@ static void add_controller(struct connmgr *, const char *target, uint8_t dscp, OVS_REQUIRES(ofproto_mutex); static struct ofconn *find_controller_by_target(struct connmgr *, 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, const struct sset *); @@ -771,6 +771,7 @@ update_in_band_remotes(struct connmgr *mgr) static void update_fail_open(struct connmgr *mgr) + OVS_EXCLUDED(ofproto_mutex) { if (connmgr_has_controllers(mgr) && mgr->fail_mode == OFPROTO_FAIL_STANDALONE) { diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index bae9dcaf4..9ac80b6d1 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -182,6 +182,7 @@ fail_open_run(struct fail_open *fo) * controller, exits fail open mode. */ void fail_open_maybe_recover(struct fail_open *fo) + OVS_EXCLUDED(ofproto_mutex) { if (fail_open_is_active(fo) && connmgr_is_any_controller_admitted(fo->connmgr)) { @@ -191,6 +192,7 @@ fail_open_maybe_recover(struct fail_open *fo) static void fail_open_recover(struct fail_open *fo) + OVS_EXCLUDED(ofproto_mutex) { struct match match; @@ -250,6 +252,7 @@ fail_open_create(struct ofproto *ofproto, struct connmgr *mgr) /* Destroys 'fo'. */ void fail_open_destroy(struct fail_open *fo) + OVS_EXCLUDED(ofproto_mutex) { if (fo) { if (fail_open_is_active(fo)) { diff --git a/ofproto/fail-open.h b/ofproto/fail-open.h index c8e1f32fc..725b82ddf 100644 --- a/ofproto/fail-open.h +++ b/ofproto/fail-open.h @@ -40,11 +40,11 @@ is_fail_open_rule(const struct rule *rule) } 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 *); bool fail_open_is_active(const struct fail_open *); void fail_open_run(struct fail_open *); -void fail_open_maybe_recover(struct fail_open *); -void fail_open_flushed(struct fail_open *); +void fail_open_maybe_recover(struct fail_open *) OVS_EXCLUDED(ofproto_mutex); +void fail_open_flushed(struct fail_open *) OVS_EXCLUDED(ofproto_mutex); #endif /* fail-open.h */ -- 2.43.0