On Fri, May 11, 2001 at 05:10:01PM -0700, John Byrne wrote: > > If more than one process or thread are writing to the same TCP socket, > and one write calls wait_for_tcp_memory(), the socket lock will be > dropped and reacquired. This appears to open a window where the second > writer can put its data in the middle of the first writer's data. > > Assuming I have this correctly, is this a bug that should be fixed in > tcp_sendmsg() or should the callers' guarantee the atomicity themselves? The POSIX/Austin draft gives no guarantee of atomicity for non datagram oriented sockets as far as I can see. It violates the definition of write() though if the TCP socket is accessed via write(2), because writes are guaranteed to be atomic. The later could be fixed by aquiring the inode semaphore in sock_write, but I'm not sure if it is worth the cycles. -Andi - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org