ofproto: Add more thread safety annotations.
authorBen Pfaff <blp@nicira.com>
Fri, 10 Jan 2014 19:36:35 +0000 (11:36 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 10 Jan 2014 19:36:35 +0000 (11:36 -0800)
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>
ofproto/connmgr.c
ofproto/fail-open.c
ofproto/fail-open.h

index ea79795..b7c16d2 100644 (file)
@@ -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) {
index bae9dca..9ac80b6 100644 (file)
@@ -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)) {
index c8e1f32..725b82d 100644 (file)
@@ -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 */