mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 14:27:36 +00:00
Merge pull request #12641 from samanvithab/bgpd_crash
bgpd: Fix crash during shutdown due to race condition
This commit is contained in:
commit
6664d74505
@ -273,8 +273,9 @@ void bgp_keepalives_on(struct peer *peer)
|
||||
peer_lock(peer);
|
||||
}
|
||||
SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
|
||||
/* Force the keepalive thread to wake up */
|
||||
pthread_cond_signal(peerhash_cond);
|
||||
}
|
||||
bgp_keepalives_wake();
|
||||
}
|
||||
|
||||
void bgp_keepalives_off(struct peer *peer)
|
||||
@ -304,19 +305,15 @@ void bgp_keepalives_off(struct peer *peer)
|
||||
}
|
||||
}
|
||||
|
||||
void bgp_keepalives_wake(void)
|
||||
{
|
||||
frr_with_mutex (peerhash_mtx) {
|
||||
pthread_cond_signal(peerhash_cond);
|
||||
}
|
||||
}
|
||||
|
||||
int bgp_keepalives_stop(struct frr_pthread *fpt, void **result)
|
||||
{
|
||||
assert(fpt->running);
|
||||
|
||||
atomic_store_explicit(&fpt->running, false, memory_order_relaxed);
|
||||
bgp_keepalives_wake();
|
||||
frr_with_mutex (peerhash_mtx) {
|
||||
atomic_store_explicit(&fpt->running, false,
|
||||
memory_order_relaxed);
|
||||
pthread_cond_signal(peerhash_cond);
|
||||
}
|
||||
|
||||
pthread_join(fpt->thread, result);
|
||||
return 0;
|
||||
|
@ -73,18 +73,6 @@ extern void bgp_keepalives_init(void);
|
||||
*/
|
||||
extern void *bgp_keepalives_start(void *arg);
|
||||
|
||||
/**
|
||||
* Poking function for keepalives pthread.
|
||||
*
|
||||
* Under normal circumstances the pthread will automatically wake itself
|
||||
* whenever it is necessary to do work. This function may be used to force the
|
||||
* thread to wake up and see if there is any work to do, or if it is time to
|
||||
* die.
|
||||
*
|
||||
* It is not necessary to call this after bgp_keepalives_on().
|
||||
*/
|
||||
extern void bgp_keepalives_wake(void);
|
||||
|
||||
/**
|
||||
* Stops the thread and blocks until it terminates.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user