summaryrefslogtreecommitdiff
path: root/bgpd/bgp_keepalives.c
diff options
context:
space:
mode:
authorMark Stapp <mstapp@nvidia.com>2022-09-06 05:34:10 -0700
committerMark Stapp <mstapp@nvidia.com>2022-09-06 09:07:07 -0400
commit85ba04f3897d3c9def83d8b291b6c6a276e96c54 (patch)
tree853793799e43a9b0631312e05d337a86296c9df9 /bgpd/bgp_keepalives.c
parent1011b31a1c72f0fd92a508c486406f3287a6c8e4 (diff)
bgpd: release rcu lock in bgp keepalive pthread
Don't hold the rcu lock in the bgp keepalive pthread: it blocks the rcu pthread and prevents log-file deletion. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
Diffstat (limited to 'bgpd/bgp_keepalives.c')
-rw-r--r--bgpd/bgp_keepalives.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c
index 158f163358..604d6c9509 100644
--- a/bgpd/bgp_keepalives.c
+++ b/bgpd/bgp_keepalives.c
@@ -175,6 +175,15 @@ void *bgp_keepalives_start(void *arg)
struct timeval next_update = {0, 0};
struct timespec next_update_ts = {0, 0};
+ /*
+ * The RCU mechanism for each pthread is initialized in a "locked"
+ * state. That's ok for pthreads using the frr_pthread,
+ * thread_fetch event loop, because that event loop unlocks regularly.
+ * For foreign pthreads, the lock needs to be unlocked so that the
+ * background rcu pthread can run.
+ */
+ rcu_read_unlock();
+
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));