]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: release rcu lock in bgp keepalive pthread
authorMark Stapp <mstapp@nvidia.com>
Tue, 6 Sep 2022 12:34:10 +0000 (05:34 -0700)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Mon, 13 Mar 2023 14:09:45 +0000 (14:09 +0000)
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>
(cherry picked from commit 85ba04f3897d3c9def83d8b291b6c6a276e96c54)

bgpd/bgp_keepalives.c

index 86202a0e3dc5f6f0f0287eade66157aaab2497ef..d0eb249d382236ac903ac5f60443f8f3aaef4c3f 100644 (file)
@@ -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));