Nullfs leaks i-nodes

Peter Holm peter at holm.cc
Thu May 9 07:03:06 UTC 2013


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
> --- a/sys/fs/nullfs/null.h

The page fault seen in fifo_close() seems unrelated to this patch,
which I will continue testing some more.

The scenario triggering the page fault is the "rm":

mdconfig -a -t swap -s 1g -u 5
bsdlabel -w md5 auto
newfs -U md5a
mount /dev/md5a /mnt
mount -t nullfs /mnt /mnt2
mkfifo /mnt2/fifo
rm /mnt/fifo

Not a problem on 8.3-STABLE r247938.

- Peter


More information about the freebsd-stable mailing list