cvs commit: src/sys/compat/svr4 svr4_stream.c
streams.c src/sys/fs/devfs devfs_vnops.c src/sys/fs/fifofs
fifo_vnops.c src/sys/kern kern_descrip.c kern_event.c sys_generic.c
sys_pipe.c uipc_mqueue.c uipc_syscalls.c ...
rwatson at FreeBSD.org
Sun Dec 30 08:38:45 PST 2007
On Sun, 30 Dec 2007, Jeff Roberson wrote:
> Remove explicit locking of struct file.
> - Introduce a finit() which is used to initailize the fields of struct file
> in such a way that the ops vector is only valid after the data, type,
> and flags are valid.
> - Protect f_flag and f_count with atomic operations.
> - Remove the global list of all files and associated accounting.
> - Rewrite the unp garbage collection such that it no longer requires
> the global list of all files and instead uses a list of all unp sockets.
> - Mark sockets in the accept queue so we don't incorrectly gc them.
This sounds like great work! I do have a few questions though:
(1) Could we teach "show files" to call out to a function in UNIX domain
sockets to print in-flight file descriptors (possibly under a separate
heading)? When "show files" showed all files, whether attached to
processes or not, it was quite useful for debugging problems with the
UNIX domain socket GC code. See point (2).
(2) The approach you've found for GCing without a global file list is quite
elegant. However, I think the definition of unreachable isn't quite
right yet. I'll send you some regression tests via private e-mail that
now fail, leading to leaked file descriptors with the new code.
Unfortunately, I've not had a chance to try to track them down.
(3) The old GC algorithm was not aware of UNIX domain sockets without file
descriptors, since it did it based on the global file list. The new code
is aware of these other sockets, such as the UNIX domain sockets in the
fifofs code. I don't see any specific problems in this area, but we
should be aware of it and make sure those cases are handled properly.
Robert N M Watson
University of Cambridge
More information about the cvs-src