From: Maria Matejka Date: Sat, 11 Oct 2025 13:02:31 +0000 (+0200) Subject: Table: drop LOBJ_(UN)LOCK_SIMPLE X-Git-Tag: v3.2.0~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1df414ce96a940d315ded8acf89190dc9448574f;p=thirdparty%2Fbird.git Table: drop LOBJ_(UN)LOCK_SIMPLE This is needed for the next commit. --- diff --git a/nest/route.h b/nest/route.h index e3a21753e..f718520c3 100644 --- a/nest/route.h +++ b/nest/route.h @@ -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) diff --git a/nest/rt-table.c b/nest/rt-table.c index dca2a5c19..9eab1b907 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -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);