Pseudofs question

Dag-Erling Smørgrav des at des.no
Thu Mar 29 07:32:06 UTC 2007


Aniruddha Bohra <bohra at cs.rutgers.edu> writes:
> Pseudofs handles the fileno allocation and deallocation using
> alloc_unr() and free_unr().
>
> The fileno is allocated on demand when vn_readdir is called
> (pseudofs_vnops.c). However,
> I could not find the deallocation in pseudofs.
>
> So, when I unload my fs module, I get a crash with the unit busy:
> kern/subr_unit.c:321         KASSERT(uh->busy == 0, ("unrhdr has %u
> allocations", uh->busy));
>
> This is a good kassert as the pfs_fileno_free is never called.

Damn.  Pseudofs used to have its own fileno allocator, which contained
the following comment:

#if 0
        /* we currently don't reclaim filenos */
        if (used > 2)
                printf("WARNING: %d file numbers still in use\n", used);
#endif

I obviously didn't pay close enough attention when I reviewed the
switch to *_unr().

> Actually, the module unload function calls _fsname_uninit() which
> calls pfs_uninit() which calls pfs_fileno_uninit(pi) without first
> destroying the file system or deallocating any allocated unit
> numbers.

Again, this was fine when we had our own allocator.  It obviously
isn't fine now.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-fs mailing list