Nullfs leaks i-nodes

Peter Holm peter at holm.cc
Wed May 8 20:48:50 UTC 2013


On Wed, May 08, 2013 at 07:58:56PM +0200, Peter Holm wrote:
> On Wed, May 08, 2013 at 12:13:17PM +0300, Konstantin Belousov wrote:
> > On Tue, May 07, 2013 at 08:30:06AM +0200, G??ran L??wkrantz wrote:
> > > I created a PR, kern/178238, on this but would like to know if anyone has 
> > > any ideas or patches?
> > > 
> > > Have updated the system where I see this to FreeBSD 9.1-STABLE #0 r250229 
> > > and still have the problem.
> > 
> > The patch below should fix the issue for you, at least it did so in my
> > limited testing.
> > 
> > What is does:
> > 1. When inactivating a nullfs vnode, check if the lower vnode is
> >    unlinked, and reclaim upper vnode if so. [This fixes your case].
> > 
> > 2. Besides a callback to the upper filesystems for the lower vnode
> >    reclaimation, it also calls the upper fs for lower vnode unlink.
> >    This allows nullfs to purge cached vnodes for the unlinked lower.
> >    [This fixes an opposite case, when the vnode is removed from the
> >    lower mount, but upper aliases prevent the vnode from being
> >    recycled].
> > 
> > 3. Fix a wart which existed from the introduction of the nullfs caching,
> >    do not unlock lower vnode in the nullfs_reclaim_lowervp().  It should
> >    be completely innocent, but now it is also formally safe.
> > 
> > 4. Fix vnode reference leak in nullfs_reclaim_lowervp().
> > 
> > Please note that the patch is basically not tested, I only verified your
> > scenario and a mirror of it as described in item 2.
> > 
> > diff --git a/sys/fs/nullfs/null.h b/sys/fs/nullfs/null.h
> > index 4f37020..a624be6 100644
> 
> I got this page fault after interrupting a nullfs test that had been
> running for three hours:
> 
> http://people.freebsd.org/~pho/stress/log/kostik562.txt
> 

Seems to be easily reproduced, so I compiled null_vnops.c and
fifo_vnops.c without "-O" in order to get some more info:

http://people.freebsd.org/~pho/stress/log/kostik563.txt

- Peter


More information about the freebsd-stable mailing list