soo_close() vs. filt_soread()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Oct 30 09:48:34 UTC 2013


On 2013-10-29 23:25, Konstantin Belousov wrote:
> On Tue, Oct 29, 2013 at 11:35:04AM +0100, Sebastian Huber wrote:
[...]
 >> Are there some means that prevent this
>> sequence in a real FreeBSD kernel?
>
> When file descriptor gets closed, kevent subsystem is notified first
> and clears knotes related to the filedescriptor (important, not the
> file) being closed. You could see this in the closefp() function calling
> knote_fdclose(). Since files are referenced and destroyed only when the
> last reference vanishes, and filedescriptor holds a reference on the
> file, file (which is socket in your case) cannot go away until knotes
> are expunged.
>
> There are some corner cases, when knotes are really attached to objects
> with different life-cycle, like vnodes, but I believe the description
> above should be accurate enough for sockets.
[...]

Thanks for the hints.  I missed this knote_fdclose() completely.  Similar test 
cases worked for select() and poll() since they use the file descriptor index.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the freebsd-hackers mailing list