0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-05 08:31:53 +00:00

Hostentry: fix pool locking

This commit is contained in:
Maria Matejka 2023-05-01 14:20:27 +02:00
parent 7d8e541057
commit ed91d884d3

View File

@ -4592,18 +4592,12 @@ hc_notify_export_one(struct rt_export_request *req, const net_addr *net, struct
{ {
struct hostcache *hc = SKIP_BACK(struct hostcache, req, req); struct hostcache *hc = SKIP_BACK(struct hostcache, req, req);
/* No interest in this update, mark seen only */
int interested = 1;
RT_LOCKED((rtable *) hc->update.data, tab) RT_LOCKED((rtable *) hc->update.data, tab)
if (ev_active(&hc->update) || !trie_match_net(hc->trie, net)) if (ev_active(&hc->update) || !trie_match_net(hc->trie, net))
{ /* No interest in this update, mark seen only */
rpe_mark_seen_all(req->hook, first, NULL, NULL); rpe_mark_seen_all(req->hook, first, NULL, NULL);
interested = 0; else
} {
if (!interested)
return;
/* This net may affect some hostentries, check the actual change */ /* This net may affect some hostentries, check the actual change */
rte *o = RTE_VALID_OR_NULL(first->old_best); rte *o = RTE_VALID_OR_NULL(first->old_best);
struct rte_storage *new_best = first->new_best; struct rte_storage *new_best = first->new_best;
@ -4615,11 +4609,11 @@ hc_notify_export_one(struct rt_export_request *req, const net_addr *net, struct
} }
/* Yes, something has actually changed. Do the hostcache update. */ /* Yes, something has actually changed. Do the hostcache update. */
if (o != RTE_VALID_OR_NULL(new_best)) if ((o != RTE_VALID_OR_NULL(new_best))
RT_LOCKED((rtable *) hc->update.data, tab) && (atomic_load_explicit(&req->hook->export_state, memory_order_acquire) == TES_READY)
if ((atomic_load_explicit(&req->hook->export_state, memory_order_acquire) == TES_READY)
&& !ev_active(&hc->update)) && !ev_active(&hc->update))
ev_send_loop(tab->loop, &hc->update); ev_send_loop(tab->loop, &hc->update);
}
} }