A virtual filesystem locking surprise
A virtual filesystem locking surprise
Posted Jul 31, 2023 17:10 UTC (Mon) by wsy (subscriber, #121706)Parent article: A virtual filesystem locking surprise
> mutex_lock(&file->f_pos_lock);
What happens if the refrence count changed between the check and the lock?
Posted Jul 31, 2023 19:03 UTC (Mon)
by stevie-oh (subscriber, #130795)
[Link]
The logic goes like this:
The problem, then, is that io_uring and pidfd_getfd violate the validity of the leap from 2->3. pidfd_getfd would do what you mentioned: it allows the reference count to be incremented by a thread from another process. io_uring, on the other hand, seems to do work on threads that don't get "counted" for #2.
Posted Jul 31, 2023 21:13 UTC (Mon)
by pbonzini (subscriber, #60935)
[Link]
A virtual filesystem locking surprise
1. Only one reference exists to this file descriptor
2. The reference belongs to a process with only one thread
3. Therefore, right now, there is only one thread that can access or manipulate this file descriptor
4. Right now, that thread is busy running executing this function, which means it can't conflict with anything.
A virtual filesystem locking surprise