]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Moved table hostcache updater to table service routines to not bother the mainloop
authorMaria Matejka <mq@ucw.cz>
Mon, 6 Mar 2023 12:16:12 +0000 (13:16 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Apr 2023 15:00:58 +0000 (17:00 +0200)
nest/rt-table.c
nest/rt.h

index a737e1b31283c36e776b5a89c7bad76bebfc00f1..fab8f06df705ee13b4df9f690ec11d94cc08c901 100644 (file)
@@ -2573,6 +2573,14 @@ rt_flag_handler(struct birdloop_flag_handler *fh, u32 flags)
        rt_prune_table(tab);
     }
 
+    if (flags & RTF_DELETE)
+    {
+      if (tab->hostcache)
+       rt_stop_export(&tab->hostcache->req, NULL);
+
+      rt_unlock_table(tab);
+    }
+
     rt_unlock_table(tab);
   }
 }
@@ -4155,16 +4163,13 @@ rt_commit(struct config *new, struct config *old)
          config_add_obstacle(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_check_cork_low(tab);
-         rt_unlock_table(tab);
 
+         if (tab->hostcache && ev_get_list(&tab->hostcache->update) == &rt_cork.queue)
+           ev_postpone(&tab->hostcache->update);
+
+         /* Force one more loop run */
+         birdloop_flag(tab->loop, RTF_DELETE);
          RT_UNLOCK(tab);
        }
     }
@@ -4583,7 +4588,7 @@ rt_init_hostcache(struct rtable_private *tab)
 
   hc->req = (struct rt_export_request) {
     .name = mb_sprintf(tab->rp, "%s.hcu.notifier", tab->name),
-    .list = &global_work_list,
+    .list = birdloop_event_list(tab->loop),
     .trace_routes = tab->config->debug,
     .dump_req = hc_notify_dump_req,
     .log_state_change = hc_notify_log_state_change,
index cceb5edfd97336e942f0f2faec50a678c73a1e3b..8de305c63db282d56add4fb31c6b81db963227de 100644 (file)
--- a/nest/rt.h
+++ b/nest/rt.h
@@ -185,6 +185,7 @@ typedef union rtable {
 #define RTF_CLEANUP    1
 #define RTF_NHU                2
 #define RTF_EXPORT     4
+#define RTF_DELETE     8
 
 extern struct rt_cork {
   _Atomic uint active;