Does linux's flock() implementation atomically downgrade exclusive locks to shared, or is it one of the ones that does not do this atomically and can be raced? The source has an old comment that says it's not atomic, but then seems to do the lock removal and addition inside the big kernel lock, which would seem to make it atomic. But I'm not much of a kernel hacker..