On Sun, Sep 04, 2022 at 08:53:45AM +0200, Stefan Sperling wrote:
> On Sat, Aug 27, 2022 at 11:32:24PM +0300, Vitaliy Makkoveev wrote:
> > > On 27 Aug 2022, at 22:03, Alexander Bluhm <[email protected]> wrote:
> > >
> > > On Sat, Aug 27, 2022 at 03:14:15AM +0300, Vitaliy Makkoveev wrote:
> > >>> On 27 Aug 2022, at 00:04, Alexander Bluhm <[email protected]>
> > >>> wrote:
> > >>>
> > >>> Anyone willing to test or ok this?
> > >>>
> > >>
> > >> This fixes weird `ifa??? refcounting. I like this.
> > >>
> > >> Could the ifaref() and ifafree() names use the same notation? Like
> > >> ifaref() and ifarele() or ifaget() and ifafree() or something else?
> > >
> > > Refcount naming is very inconsistent.
> > >
> > > ifget(), ifput(), pf_state_key_ref(), pf_state_key_unref(), tdb_ref(),
> > > tdb_unref(), tdb_delete(), tdb_free(), vxlan_take(), vxlan_rele()
> > > all work in subtle different ways.
> > >
> > > I want to keep ifafree() as the name is established and called from
> > > many places. And giving ifaref() another name makes it different
> > > but not better.
> > >
> > > It would be easy to change something but hard to make it consistent.
> > > So I prefer to leave the diff as it is.
> > >
> > > bluhm
> >
> > I have no objections to commit this diff.
>
> The diff has been committed but the problem remains:
>
Not for commit, just for collect assertions. Netlock assertions doen't
provide panics.
Index: sys/net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.664
diff -u -p -r1.664 if.c
--- sys/net/if.c 2 Sep 2022 13:12:31 -0000 1.664
+++ sys/net/if.c 4 Sep 2022 14:39:58 -0000
@@ -3148,12 +3148,14 @@ ifpromisc(struct ifnet *ifp, int pswitch
void
ifa_add(struct ifnet *ifp, struct ifaddr *ifa)
{
+ NET_ASSERT_LOCKED();
TAILQ_INSERT_TAIL(&ifp->if_addrlist, ifa, ifa_list);
}
void
ifa_del(struct ifnet *ifp, struct ifaddr *ifa)
{
+ NET_ASSERT_LOCKED();
TAILQ_REMOVE(&ifp->if_addrlist, ifa, ifa_list);
}