Subject: Re: Memory leak in nfsrv_readdir
To: None <firstname.lastname@example.org>
From: Juergen Hannken-Illjes <email@example.com>
Date: 07/20/2006 10:32:06
On Thu, Jul 20, 2006 at 04:16:38PM +1200, Mark Davies wrote:
> A couple of weeks ago I posted to current-users about one of my servers that
> kept locking up every few days.
> After some very useful assistance by Juergen Hannken-Illjes we've tracked down
> that the actual problem is a memory leak in nfsrv_readdir(). It looks like
> this leak has been there since Lite2 was merged in 8 years ago.
> Whats happening is that nfsrv_readdir() calls VOP_READDIR which malloc's some
> space to hold the directory seek cookies. Normally the cookies are freed at
> the end of the routine but somtimes the code jumps back to the "again" label
> calling VOP_READDIR again so mallocing new cookies without ever freeing the
> old ones.
> The below patch fixes the problem in the same way as FreeBSD does. OK to
> I still don't know what it is about that particular server of mine that is
> tickling the bug much more frequently than other boxes.
This leak is triggered by directories with many unused entries in a row so
VOP_READDIR returns no valid entry.
Juergen Hannken-Illjes - firstname.lastname@example.org - TU Braunschweig (Germany)