Actions
Bug #6253
closedF_GETLK doesn't always return lock owner
Start date:
2015-09-21
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
Description
Issue #6225 describes a scenario where fcntl(F_GETLK) returns F_UNLCK even though F_SETLK declines the lock. This basically happens when one process holds a read lock while a second process waits for a write lock. Subsequent read lock requests fail, because the pending write lock blocks out new read locks to avoid write starvation.
flk_get_first_blocking_lock() is the function that determines the result of F_GETLK. For this, it only searches the list of all currently held locks. As this list contains only a read lock, it returns F_UNLCK.
To fix this, it's necessary to also search the list of pending locks to see if there is a write lock waiting.
Related issues
Actions