summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-03-13 21:28:54 +0200
committerGitHub <noreply@github.com>2023-03-13 21:28:54 +0200
commit65810cc44dfe4ff548869ff51863b2eb50635351 (patch)
tree63a5be2a8d187cfcef050dd53e6b128035c7c758
parent331813c63de68bf70bc55e3c4432ac96a10aac1e (diff)
parent74d699cb8b794da51d48cbaf29769f068d89ccbc (diff)
Merge pull request #12985 from FRRouting/mergify/bp/stable/8.3/pr-11913
bgpd: release rcu lock in bgp keepalive pthread (backport #11913)
-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 86202a0e3d..d0eb249d38 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));