Subject: namei pathname buffer handling
To: None <tech-kern@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 08/03/2000 10:37:54
Hi folks...
So, kind of as a side to something else I was working on, I went and
converted namei pathname buffer allocation to use the pool allocator
rather than MALLOC()/FREE() (err, and malloc()/free() ... it wasn't
even really consistent).
While doing this, I noticed that the handling of pathname buffers
is ... confusing at best, and buggy at worst. In particular, at
least with the NTFS file system, we're leaking memory, because it's
not following NetBSD's pathname buffer handling rules.
Now, I'm not 100% sure what those rules are, but I can say that
sometimes the VFS layer frees them, and sometimes the file system
frees them.
In the case of NTFS, it's never freeing them, and the reason is
really an artifact of having been ported from FreeBSD -- they have
different, and much simpler (as far as I can tell), pathname buffer
handling rules that apprear to be, essentially: file system never
frees them, unless the file system allocated them.
I.e. in almost all the cases where we currently have the file system
free a pathname buffer, FreeBSD does not, and lets the VFS layer handle
it.
There are a few cases where a file system needs to allocate and free
a pathname buffer, but these are special cases (it's done in unionfs
and nfs right now).
Anyway, I don't have time to really dig into the pathname buffer handling
issue right now, but it's definitely something that some file system
type person should look into :-)
--
-- Jason R. Thorpe <thorpej@zembu.com>