We already have a lock for every socket: the inode semaphore.
Could you use this to protect the socket state transitions?
Possibly this will be replaced by a read/write/update lock at some
point, but given the fine granularity just a simple semaphore
should work pretty well.
Work yes, efficient no. Semaphore's are very expensive, and they do
such more than we need for sockets, really.
Later,
David "Sparc" Miller
davem@caip.rutgers.edu