Re: [PATCH] sock: Make sock->sk_tstamp thread-safe

From: Deepa Dinamani
Date: Sat Dec 22 2018 - 12:02:52 EST


> Are we actually worried about concurrent writers here? I thought the
> only problem was a race between writer and reader, which would mean
> that we could solve it using only a seqcount_t which is cheaper to
> update than a seqlock_t.

I considered using just the seqcount_t. But, I think we do care about
concurrent writers here.
A couple of scenarios I can think of:

1. When you have 2 concurrent recvmsg() calls on a socket, and they
both try to update sk_tstamp.
2. If a socket has don't have one of the SO_TIMESTAMP/NS options set
and you have a first recvmsg and a concurrent ioctl call on the
socket.

These are corner cases and if we don't care aout these then we can use
just the sequence counters.

I have missed out tstamp update in the sunrcpc code. If everyone is ok
with this approach, I will add it in when I post an update

-Deepa