NetBSD Problem Report #60637
From www@netbsd.org Mon Aug 24 20:27:19 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 449331A923B
for <gnats-bugs@gnats.NetBSD.org>; Mon, 24 Aug 2026 20:27:19 +0000 (UTC)
Message-Id: <20260824202718.1D69B1A923C@mollari.NetBSD.org>
Date: Mon, 24 Aug 2026 20:27:18 +0000 (UTC)
From: joe@ns1.eloisystems.com
Reply-To: joe@ns1.eloisystems.com
To: gnats-bugs@NetBSD.org
Subject: destroying a vlan interface with a configured parent interface hangs
X-Send-Pr-Version: www-1.0
X-From4GNATS: "joe@ns1.eloisystems.com via gnats" <gnats-admin@NetBSD.org>
>Number: 60637
>Category: kern
>Synopsis: destroying a vlan interface with a configured parent interface hangs
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 24 20:30:00 +0000 2026
>Last-Modified: Tue Aug 25 20:15:01 +0000 2026
>Originator: Emmanuel Nyarko
>Release: NetBSD 11
>Organization:
NetBSD
>Environment:
amd64 x86
>Description:
The usual procedure to configuring a vlan interface is
create the vlan interface, configure it with a vlan ID and a parent
when shutting it down,
unconfigure it
and
destroy it and this works without hanging.
but running destroy when not unconfigured hangs.
>How-To-Repeat:
ifconfig vlan0 create
ifconfig vlan0 vlan 6 vlanif $interface
ifconfig vlan0 destroy
>Fix:
Not yet!
>Audit-Trail:
From: joe@ns1.eloisystems.com
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/60637: destroying a vlan interface with a configured parent
interface hangs
Date: Tue, 25 Aug 2026 12:34:50 +0000
On Mon, Aug 24, 2026 at 08:30:00PM +0000, gnats-admin@netbsd.org wrote:
> Thank you very much for your problem report.
> It has the internal identification `kern/60637'.
> The individual assigned to look at your
> report is: kern-bug-people.
>
> >Category: kern
> >Responsible: kern-bug-people
> >Synopsis: destroying a vlan interface with a configured parent interface hangs
> >Arrival-Date: Mon Aug 24 20:30:00 +0000 2026
Hi,
The attched patch fixes this issue.
Index: sys/net/if.c
===================================================================
RCS file: /cvsroot/src/sys/net/if.c,v
retrieving revision 1.538
diff -u -r1.538 if.c
--- sys/net/if.c 14 May 2026 08:05:48 -0000 1.538
+++ sys/net/if.c 25 Aug 2026 12:27:04 -0000
@@ -1356,12 +1356,10 @@
* from pserialize read sections. Note that we can't do
* psref_target_destroy here. See below.
*/
- IFNET_GLOBAL_LOCK();
ifindex2ifnet[ifp->if_index] = NULL;
TAILQ_REMOVE(&ifnet_list, ifp, if_list);
IFNET_WRITER_REMOVE(ifp);
pserialize_perform(ifnet_psz);
- IFNET_GLOBAL_UNLOCK();
if (ifp->if_slowtimo != NULL) {
struct if_slowtimo_data *isd = ifp->if_slowtimo_data;
However, I might not be fully convinced yet if that's the best solution
but i tracked down the hang and realized the vlan thread running if_detach forever waits
on the "BIG LOCK" IFNET_GLOBAL_LOCK() because another thread is using it.
My guess is maybe this lock doesn't need to be held here as it is causes a deadlock on vlan interfaces
when destroying. or some other thread needs to release hold unto the BIG lock
From: Taylor R Campbell <riastradh@NetBSD.org>
To: Emmanuel Nyarko <joe@ns1.eloisystems.com>
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: kern/60637: destroying a vlan interface with a configured parent interface hangs
Date: Tue, 25 Aug 2026 19:04:01 +0000
> Date: Mon, 24 Aug 2026 20:27:18 +0000 (UTC)
> From: Emmanuel Nyarko <joe@ns1.eloisystems.com>
>
> >Description:
>
> The usual procedure to configuring a vlan interface is
>
> create the vlan interface, configure it with a vlan ID and a parent
>
> when shutting it down,
>
> unconfigure it
> and
> destroy it and this works without hanging.
>
> but running destroy when not unconfigured hangs.
> >How-To-Repeat:
>
> ifconfig vlan0 create
> ifconfig vlan0 vlan 6 vlanif $interface
> ifconfig vlan0 destroy
I tried this in a VM with interface=vioif0 and it worked fine.
Can you share the output of the following, before it hangs?
1. ifconfig -a
2. dmesg
3. when it hangs, start crash(8) in another terminal (or start it
before the hang) and run:
- ps
- show all tstiles/t
Also, are you running with any local patches?
> - IFNET_GLOBAL_LOCK();
> ifindex2ifnet[ifp->if_index] = NULL;
> TAILQ_REMOVE(&ifnet_list, ifp, if_list);
> IFNET_WRITER_REMOVE(ifp);
> pserialize_perform(ifnet_psz);
> - IFNET_GLOBAL_UNLOCK();
This is definitely not a fix! Everything here -- ifindex2ifnet,
ifnet_list, IFNET_WRITER_*, ifnet_psz -- must have access serialized
by IFNET_GLOBAL_LOCK in order to coordinate the data structures with
other threads.
From: joe@ns1.eloisystems.com
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/60637: destroying a vlan interface with a configured parent
interface hangs
Date: Tue, 25 Aug 2026 20:10:16 +0000
On Tue, Aug 25, 2026 at 07:05:02PM +0000, Taylor R Campbell via gnats wrote:
> The following reply was made to PR kern/60637; it has been noted by GNATS.
>
> From: Taylor R Campbell <riastradh@NetBSD.org>
> To: Emmanuel Nyarko <joe@ns1.eloisystems.com>
> Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
> Subject: Re: kern/60637: destroying a vlan interface with a configured parent interface hangs
> Date: Tue, 25 Aug 2026 19:04:01 +0000
>
> > Date: Mon, 24 Aug 2026 20:27:18 +0000 (UTC)
> > From: Emmanuel Nyarko <joe@ns1.eloisystems.com>
> >
> > >Description:
> >
> > The usual procedure to configuring a vlan interface is
> >
> > create the vlan interface, configure it with a vlan ID and a parent
> >
> > when shutting it down,
> >
> > unconfigure it
> > and
> > destroy it and this works without hanging.
> >
> > but running destroy when not unconfigured hangs.
> > >How-To-Repeat:
> >
> > ifconfig vlan0 create
> > ifconfig vlan0 vlan 6 vlanif $interface
> > ifconfig vlan0 destroy
>
> I tried this in a VM with interface=vioif0 and it worked fine.
so the funny case here is that it hangs 80 percent of time.
i tried it five times, it hung four time and didn't one time.
>
> Can you share the output of the following, before it hangs?
>
> 1. ifconfig -a
> 2. dmesg
> 3. when it hangs, start crash(8) in another terminal (or start it
> before the hang) and run:
> - ps
> - show all tstiles/t
so I got it though DDB and this is what i got.
* Lock 1 (initialized at netbsd:if_initialize+0x10e)
lock address : ffffc674c3581f40
type : sleep/adaptive
initialized : netbsd:if_initialize+0x10e
shared holds : 0 exclusive: 1
shares wanted: 0 exclusive: 2
relevant cpu : 1 last held: 1
relevant lwp : 0xffffc674c4278800 last held: 0xffffc674c4278800
last locked* : netbsd:if_detach+0x61
unlocked : netbsd:vlan_clone_destroy+0x5c
owner field : 0xffffc674c4278800 wait/spin: 1/0
Turnstile:
=> 0 waiting readers:
=> 2 waiting writers: 0xffffc675380a4c00 0xffffc674c2743000
*** Locks wanted:
workqueue_wait(ifnet_link_state_wq, &ifp->if_link_work);
i got some printfs in and never run past this function.
this is the function causing it i am now convinced.
>
> Also, are you running with any local patches?
no patches. this is a GENERIC kernel using wm0 interface on a VM.
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.