diff options
author | Maria Matejka <mq@ucw.cz> | 2022-09-14 10:25:09 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-09-18 16:35:49 +0200 |
commit | cf38092b2ddf7c3bc8d2ec25e57c2621462c02c2 (patch) | |
tree | 492bd1fefbc3b4d7943db8a491ff2bc2004dc43e /nest/rt-table.c | |
parent | 12fd6c989a6676ff2bcb9475e96897338c59c5f8 (diff) |
Fix for table hostcache corking and shutdown race conditions
Diffstat (limited to 'nest/rt-table.c')
-rw-r--r-- | nest/rt-table.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c index 35da182c..4b9d83c5 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -4008,7 +4008,11 @@ rt_commit(struct config *new, struct config *old) rt_lock_table(tab); if (tab->hostcache) + { rt_stop_export(&tab->hostcache->req, NULL); + if (ev_get_list(&tab->hostcache->update) == &rt_cork.queue) + ev_postpone(&tab->hostcache->update); + } rt_unlock_table(tab); @@ -4392,7 +4396,9 @@ hc_notify_export_one(struct rt_export_request *req, const net_addr *net, struct /* Yes, something has actually changed. Do the hostcache update. */ if (o != RTE_VALID_OR_NULL(new_best)) RT_LOCKED((rtable *) hc->update.data, tab) - ev_send_loop(tab->loop, &hc->update); + if ((atomic_load_explicit(&req->hook->export_state, memory_order_acquire) == TES_READY) + && !ev_active(&hc->update)) + ev_send_loop(tab->loop, &hc->update); } @@ -4555,6 +4561,10 @@ rt_update_hostcache(void *data) struct hostcache *hc = tab->hostcache; + /* Shutdown shortcut */ + if (!hc->req.hook) + RT_RETURN(tab); + if (rt_cork_check(&hc->update)) { rt_trace(tab, D_STATES, "Hostcache update corked"); |