]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Table long-locking debug code
authorMaria Matejka <mq@ucw.cz>
Wed, 7 Sep 2022 13:06:22 +0000 (15:06 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 8 Sep 2022 13:13:37 +0000 (15:13 +0200)
nest/rt-table.c
nest/rt.h

index eb53eff7e9a48068b1427e40d5d7b71455674235..cdf0fd3e9fae0e92f65d1976e49ebf5b05eb64a7 100644 (file)
@@ -3680,10 +3680,10 @@ rt_new_table(struct symbol *s, uint addr_type)
  * preventing it from being freed when it gets undefined in a new
  * configuration.
  */
-void
-rt_lock_table(rtable *r)
+void rt_lock_table_debug(rtable *tab, const char *file, uint line)
 {
-  r->use_count++;
+  rt_trace(tab, D_STATES, "Locked at %s:%d", file, line);
+  tab->use_count++;
 }
 
 /**
@@ -3694,9 +3694,9 @@ rt_lock_table(rtable *r)
  * that is decrease its use count and delete it if it's scheduled
  * for deletion by configuration changes.
  */
-void
-rt_unlock_table(rtable *r)
+void rt_unlock_table_debug(rtable *r, const char *file, uint line)
 {
+  rt_trace(r, D_STATES, "Unlocked at %s:%d", file, line);
   if (!--r->use_count && r->deleted)
     {
       struct config *conf = r->deleted;
index 987a9ff8491b47bb0d8cfa41e580f7efa03cfdbd..82d74296606d486ed11e8819414fc0526af62acb 100644 (file)
--- a/nest/rt.h
+++ b/nest/rt.h
@@ -482,8 +482,12 @@ void rt_init(void);
 void rt_preconfig(struct config *);
 void rt_postconfig(struct config *);
 void rt_commit(struct config *new, struct config *old);
-void rt_lock_table(rtable *);
-void rt_unlock_table(rtable *);
+
+void rt_lock_table_debug(rtable *, const char *file, uint line);
+void rt_unlock_table_debug(rtable *, const char *file, uint line);
+#define rt_lock_table(tab)     rt_lock_table_debug(tab, __FILE__, __LINE__)
+#define rt_unlock_table(tab)   rt_unlock_table_debug(tab, __FILE__, __LINE__)
+
 struct f_trie * rt_lock_trie(rtable *tab);
 void rt_unlock_trie(rtable *tab, struct f_trie *trie);
 void rt_flowspec_link(rtable *src, rtable *dst);