summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2022-08-03 14:07:53 +0200
committerMaria Matejka <mq@ucw.cz>2022-08-03 14:07:53 +0200
commit5a96b9b12496082b9d6165f51597403546ed617d (patch)
tree41f7e773ee776bea66d306a0f546ae148aa37054 /lib
parent71b434a987067475b517792360f58dbe03bfee9e (diff)
parent97476e002d7dfb24a4613ac401b8f3192ca68d05 (diff)
Merge commit '97476e00' into thread-next
Had to fix route source locking inside BGP export table as we need to keep the route sources properly allocated until even last BGP pending update is sent out, therefore the export table printout is accurate.
Diffstat (limited to 'lib')
-rw-r--r--lib/route.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/route.h b/lib/route.h
index cf3c70ba..97e2e053 100644
--- a/lib/route.h
+++ b/lib/route.h
@@ -10,6 +10,8 @@
#ifndef _BIRD_LIB_ROUTE_H_
#define _BIRD_LIB_ROUTE_H_
+#undef RT_SOURCE_DEBUG
+
#include "lib/type.h"
#include "lib/rcu.h"
#include "lib/hash.h"
@@ -87,6 +89,11 @@ struct rte_src *rt_get_source_o(struct rte_owner *o, u32 id);
struct rte_src *rt_find_source_global(u32 id);
+#ifdef RT_SOURCE_DEBUG
+#define rt_lock_source _rt_lock_source_internal
+#define rt_unlock_source _rt_unlock_source_internal
+#endif
+
static inline void rt_lock_source(struct rte_src *src)
{
/* Locking a source is trivial; somebody already holds it so we just increase
@@ -139,6 +146,14 @@ static inline void rt_unlock_source(struct rte_src *src)
rcu_read_unlock();
}
+#ifdef RT_SOURCE_DEBUG
+#undef rt_lock_source
+#undef rt_unlock_source
+
+#define rt_lock_source(x) ( log(L_INFO "Lock source %uG at %s:%d", (x)->global_id, __FILE__, __LINE__), _rt_lock_source_internal(x) )
+#define rt_unlock_source(x) ( log(L_INFO "Unlock source %uG at %s:%d", (x)->global_id, __FILE__, __LINE__), _rt_unlock_source_internal(x) )
+#endif
+
void rt_init_sources(struct rte_owner *, const char *name, event_list *list);
void rt_destroy_sources(struct rte_owner *, event *);