Opened 5 years ago
Closed 5 years ago
#2131 closed enhancement (invalid)
relblobif should use fcntl instead of flock
Reported by: | Dimitar Misev | Owned by: | apercov |
---|---|---|---|
Priority: | major | Milestone: | 10.0 |
Component: | relblobif | Version: | 9.8 |
Keywords: | Cc: | Peter Baumann, Vlad Merticariu | |
Complexity: | Medium |
Description
Currently flock is used in source:relblobif to handle transaction locks on the filesystem. The problem, as the man page notes, is that it doesn't work on NFS:
flock() does not lock files over NFS. Use fcntl(2) instead: that does work over NFS, given a sufficiently recent version of Linux and a server which supports locking.
So usage of flock should be replaced with fcntl.
Change History (3)
comment:1 by , 5 years ago
Status: | new → accepted |
---|
comment:2 by , 5 years ago
comment:3 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | accepted → closed |
Ok, I didn't know that flock works fine with such an old kernel version already, it's not indicated in the man pages. So I guess we can close this ticket as invalid.
Note:
See TracTickets
for help on using tickets.
After some research, I believe we should leave the implementation as it is now. NFS supports Flock starting with linux version 2.6.12(https://gavv.github.io/articles/file-locks/). Additionally, after multiple tries and even more research, I couldn't manage to make isLocked() work with fcntl(). Reason for that is that locks provided by the function are not conflicting to each other, therefore we can always substitute them without receiving an error. Conflict is required for F_GETLK(suggested way of checking the lock) to give us return that the file is locked, and we cannot achieve it in context of one process.