Subject: kern/34293: vnd deadlocks on I/O buffers
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 08/26/2006 22:00:01
>Number:         34293
>Category:       kern
>Synopsis:       vnd deadlocks on I/O buffers
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 26 22:00:00 +0000 2006
>Originator:     Michael van Elst
>Release:        NetBSD 4.99.1
                                Michael van Elst
                                "A potential Snark may lurk in every tree."
System: NetBSD pepew 4.99.1 NetBSD 4.99.1 (PEPEW) #32: Sat Aug 26 23:34:55 CEST 2006 src@pepew:/usr/obj/usr/src/sys/arch/i386/compile/PEPEW i386
Architecture: i386
Machine: i386

When writing to a vnd device faster than the underlying
hardware can handle for a sufficient long enough time
then the system will exhaust all I/O buffers.  This is
expected. However, the vnd device then deadlocks and the
queued I/O will never complete.

The reason is that vnd uses nested I/O buffers. In order
to process a queued I/O request it has to allocate yet
another I/O buffer. When all I/O buffers have already
been exhausted it therfore waits forever.


Create a vnd device for a large (e.g. 10GB) file on the local disk.
Write lots of data to the vnd device (e.g. mkfs.ext2).

Watch the system deadlock on I/O buffers. The writing process
and the vnd kernel thread are waiting on "getnewbuf".

I have changed the system to use a separate pool for nested I/O
buffers. This works, but there are probably better ways to
solve the problem.