Merge pull request #16035 from raja-rajasekar/rajasekarr/backpressure_infinite_loop

bgpd: backpressure - Fix to avoid CPU hog
This commit is contained in:
Donatas Abraitis 2024-05-20 09:54:04 +03:00 committed by GitHub
commit 95b1b1d3e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -6317,9 +6317,11 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
{
struct bgp_dest *dest = NULL;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
while (zebra_announce_count(&bm->zebra_announce_head)) {
while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
if (dest->za_vpn == vpn) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);

View File

@ -3908,11 +3908,13 @@ int bgp_delete(struct bgp *bgp)
int i;
struct bgp_dest *dest = NULL;
struct graceful_restart_info *gr_info;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);
assert(bgp);
while (zebra_announce_count(&bm->zebra_announce_head)) {
while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
if (dest->za_bgp_pi->peer->bgp == bgp) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);