]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Table: drop LOBJ_(UN)LOCK_SIMPLE
authorMaria Matejka <mq@ucw.cz>
Sat, 11 Oct 2025 13:02:31 +0000 (15:02 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 13 Nov 2025 11:25:03 +0000 (12:25 +0100)
This is needed for the next commit.

nest/route.h
nest/rt-table.c

index e3a21753ee45cef6f35dd2dc8b1f086d7bc87857..f718520c3f3e878c159dd93c10c46a3ceb244731 100644 (file)
@@ -467,9 +467,6 @@ LOBJ_UNLOCK_CLEANUP(rtable, rtable);
 #define RT_LOCKED(tab, tp)     LOBJ_LOCKED((tab), tp, rtable, rtable)
 #define RT_LOCK(tab, tp)       LOBJ_LOCK((tab), tp, rtable, rtable)
 
-#define RT_LOCK_SIMPLE(tab)    LOBJ_LOCK_SIMPLE((tab), rtable)
-#define RT_UNLOCK_SIMPLE(tab)  LOBJ_UNLOCK_SIMPLE((tab), rtable)
-
 #define RT_UNLOCKED_TEMPORARILY(tab, tp)       LOBJ_UNLOCKED_TEMPORARILY((tab), tp, rtable, rtable)
 
 #define RT_PUB(tab)    SKIP_BACK(rtable, priv, tab)
index dca2a5c1984817ccaa828765d5021c374019e2fa..9eab1b907e7a84964633fa4aa906e83686a1dd52 100644 (file)
@@ -4943,13 +4943,17 @@ rt_delete(void *tab_)
 {
   ASSERT_DIE(birdloop_inside(&main_birdloop));
 
-  /* We assume that nobody holds the table reference now as use_count is zero.
-   * Anyway the last holder may still hold the lock. Therefore we lock and
-   * unlock it the last time to be sure that nobody is there. */
-  struct rtable_private *tab = RT_LOCK_SIMPLE((rtable *) tab_);
-  OBSREF_CLEAR(tab->deleted);
+  /* Pull out the last references; TODO: make this generic */
+  rtable *tab = tab_;
   DOMAIN(rtable) dom = tab->lock;
-  RT_UNLOCK_SIMPLE(RT_PUB(tab));
+
+  /* We assume that nobody holds the table reference now as use_count is zero.
+   * Anyway the last holder may still hold the lock because of the kernel scheduler.
+   * Therefore we lock and unlock it the last time to be sure that nobody is there.
+   * Also it's semantically more valid to lock when accessing otherwise private things.
+   * */
+  RT_LOCKED(tab, tp)
+    OBSREF_CLEAR(tp->deleted);
 
   /* Everything is freed by freeing the loop */
   birdloop_free(tab->loop);