Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 May 2013 09:02:56 +0200
From:      Peter Holm <peter@holm.cc>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Nullfs leaks i-nodes
Message-ID:  <20130509070256.GA15884@x2.osted.lan>
In-Reply-To: <20130508091317.GJ3047@kib.kiev.ua>
References:  <B799E3B928B18B9E6C68F912@[172.16.2.62]> <20130508091317.GJ3047@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130509070256.GA15884>