]> git.baikalelectronics.ru Git - kernel.git/commit
[AF_UNIX]: Rewrite garbage collector, fixes race.
authorMiklos Szeredi <mszeredi@suse.cz>
Wed, 11 Jul 2007 21:22:39 +0000 (14:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Jul 2007 21:22:39 +0000 (14:22 -0700)
commit07dab33ae6d54b2c9cb3d7ea7b9d20ba6da6ad04
tree3403194403ab25f1f7a360a002adf63be2b4e9b0
parent09ee85539cd71f5a5c510ac15d5f357a52508e5a
[AF_UNIX]: Rewrite garbage collector, fixes race.

Throw out the old mark & sweep garbage collector and put in a
refcounting cycle detecting one.

The old one had a race with recvmsg, that resulted in false positives
and hence data loss.  The old algorithm operated on all unix sockets
in the system, so any additional locking would have meant performance
problems for all users of these.

The new algorithm instead only operates on "in flight" sockets, which
are very rare, and the additional locking for these doesn't negatively
impact the vast majority of users.

In fact it's probable, that there weren't *any* heavy senders of
sockets over sockets, otherwise the above race would have been
discovered long ago.

The patch works OK with the app that exposed the race with the old
code.  The garbage collection has also been verified to work in a few
simple cases.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/af_unix.h
net/unix/af_unix.c
net/unix/garbage.c