mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Simplified table deletion (one less step)
This commit is contained in:
parent
cacf743dcb
commit
8527bb6bf3
@ -175,9 +175,6 @@ LOBJ_UNLOCK_CLEANUP(rtable, rtable);
|
||||
|
||||
#define RT_PUB(tab) SKIP_BACK(rtable, priv, tab)
|
||||
|
||||
/* Flags for birdloop_flag() */
|
||||
#define RTF_DELETE 8
|
||||
|
||||
extern struct rt_cork {
|
||||
_Atomic uint active;
|
||||
event_list queue;
|
||||
|
@ -2378,26 +2378,6 @@ rt_schedule_prune(struct rtable_private *tab)
|
||||
ev_send_loop(tab->loop, tab->prune_event);
|
||||
}
|
||||
|
||||
static void
|
||||
rt_flag_handler(struct birdloop_flag_handler *fh, u32 flags)
|
||||
{
|
||||
RT_LOCKED(RT_PUB(SKIP_BACK(struct rtable_private, fh, fh)), tab)
|
||||
{
|
||||
ASSERT_DIE(birdloop_inside(tab->loop));
|
||||
rt_lock_table(tab);
|
||||
|
||||
if (flags & RTF_DELETE)
|
||||
{
|
||||
if (tab->hostcache)
|
||||
rt_stop_export_locked(tab, tab->hostcache->req.hook);
|
||||
|
||||
rt_unlock_table(tab);
|
||||
}
|
||||
|
||||
rt_unlock_table(tab);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rt_prune_timer(timer *t)
|
||||
{
|
||||
@ -2688,7 +2668,6 @@ rt_setup(pool *pp, struct rtable_config *cf)
|
||||
hmap_init(&t->id_map, p, 1024);
|
||||
hmap_set(&t->id_map, 0);
|
||||
|
||||
t->fh = (struct birdloop_flag_handler) { .hook = rt_flag_handler, };
|
||||
t->nhu_event = ev_new_init(p, rt_next_hop_update, t);
|
||||
t->nhu_uncork_event = ev_new_init(p, rt_nhu_uncork, t);
|
||||
t->prune_timer = tm_new_init(p, rt_prune_timer, t, 0, 0);
|
||||
@ -3799,15 +3778,20 @@ rt_commit(struct config *new, struct config *old)
|
||||
if (old)
|
||||
{
|
||||
WALK_LIST(o, old->tables)
|
||||
{
|
||||
_Bool ok;
|
||||
RT_LOCKED(o->table, tab)
|
||||
{
|
||||
if (tab->deleted)
|
||||
continue;
|
||||
r = tab->deleted ? NULL : rt_find_table_config(new, o->name);
|
||||
ok = r && !new->shutdown && rt_reconfigure(tab, r, o);
|
||||
}
|
||||
|
||||
r = rt_find_table_config(new, o->name);
|
||||
if (r && !new->shutdown && rt_reconfigure(tab, r, o))
|
||||
continue;
|
||||
if (ok)
|
||||
continue;
|
||||
|
||||
birdloop_enter(o->table->loop);
|
||||
RT_LOCKED(o->table, tab)
|
||||
{
|
||||
DBG("\t%s: deleted\n", o->name);
|
||||
tab->deleted = old;
|
||||
config_add_obstacle(old);
|
||||
@ -3815,12 +3799,17 @@ rt_commit(struct config *new, struct config *old)
|
||||
|
||||
rt_check_cork_low(tab);
|
||||
|
||||
if (tab->hcu_event && (ev_get_list(tab->hcu_event) == &rt_cork.queue))
|
||||
ev_postpone(tab->hcu_event);
|
||||
if (tab->hcu_event)
|
||||
{
|
||||
if (ev_get_list(tab->hcu_event) == &rt_cork.queue)
|
||||
ev_postpone(tab->hcu_event);
|
||||
|
||||
/* Force one more loop run */
|
||||
birdloop_flag(tab->loop, RTF_DELETE);
|
||||
rt_stop_export_locked(tab, tab->hostcache->req.hook);
|
||||
}
|
||||
rt_unlock_table(tab);
|
||||
}
|
||||
birdloop_leave(o->table->loop);
|
||||
}
|
||||
}
|
||||
|
||||
WALK_LIST(r, new->tables)
|
||||
|
Loading…
Reference in New Issue
Block a user