bind() on AF_UNIX socket may sporadically fail with EADDRINUSE
If a process calls unlink() on the path of a bound socket before calling close() on it's file descriptor, it seems that a vnode pointer may be re-used such that a another process calling into bind() on an AF_UNIX socket, will encounter EADDRINUSE even though no file actually exists.
The attached test program usually demonstrates this when run on a 48-core machine with the following command line:
./eaddrinuse -f /var/tmp -c 256 -p 64
This issue seems to play out in the following files:
uts/common/fs/sockfs/socktpi.c (where the vnode is created)
uts/common/io/tl.c (where mod_hash_insert_reserve() fails when it encounters a previously used vnode pointer)
While it's pretty easy to work around this (call close() before unlink()), this still seems wrong.