Re: Socket locking

Bill Hawes (whawes@star.net)
Sat, 04 Oct 1997 11:53:49 -0400


Andi Kleen wrote:
> BTW with more stuff moving into the dentries - how about getting rid
> of the socket inode and putting a socket pointer directly into the
> dentry?

Currently sockets and inodes are always 1-1, since the socket is part of
the inode structure. I don't think you need to have a separate socket
pointer in the dentry structure, but it would be good to keep the dentry
pointer everywhere instead of "stealing" the inode away from the dentry.

> I propose a new lock for every socket:
> - One reader/writer lock that protects socket state that is used by
> the data send path. This will prevent many of the clone-races in the
> socket layer.
> - Use sock_readers only for the input processing.

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.

Regards,
Bill