Comments (3)
SoftFileLock uses O_WRONLY | O_CREAT | O_EXCL | O_TRUNC
.
According to man open:
O_CREAT: If pathname does not exist, create it as a regular file.
O_EXCL: Ensure that this call creates the file: if this flag is specified in conjunction with O_CREAT, and pathname already exists, then open() fails with the error EEXIST.
On NFS, O_EXCL is supported only when using NFSv3 or later on kernel 2.6 or later.
This is in compliance with the NFS FAQ D10:
It's worth noting that until early 2.6 kernels, O_EXCL creates were not atomic on Linux NFS clients. Don't use O_EXCL creates and expect atomic behavior among multiple NFS client unless you are running a kernel newer than 2.6.5.
So the answer should be: Yes, on modern systems.
What is the reason for O_TRUNC? It seems to be superfluous, because O_CREAT | O_EXCL prevent the file from being opened if it exists.
O_TRUNC: If the file already exists and is a regular file and the access mode allows writing (i.e., is O_RDWR or O_WRONLY) it will be truncated to length 0.
from filelock.
I tested this on lusterfs and nfs both the lock
mount flag enabled and disabled, and "unit tests passed". I do not know enough if this answers any of the reliability questions, but if the tests are good enough, this might be enough to verify it works on "RHEL 7" modern.
from filelock.
Great! Then I think this can be closed.
from filelock.
Related Issues (20)
- [regression] 12 tests fail with version 3.12.3, 0 tests were failing with version 3.12.2 HOT 1
- typing-extensions is a dependency but is not needed at runtime HOT 5
- Bug: Reentrant behavior does not work with distinct lock objects on the same thread HOT 4
- Using filelock in docker HOT 1
- Allow disabling fcntl (and use softfilelock) with environment variable HOT 2
- Python 3.7 support dropoff at version 3.12.3 not reflected in 'Security' section HOT 1
- Request add `RwLock` HOT 1
- Add cancellation tokens support
- Demo usage in the documentation is uncommon and misleading HOT 2
- Deadlock when a process tries to open and lock on the same file twice HOT 5
- Suggestion on documentation improvement over SoftFileLock
- 6 tests fail HOT 6
- is_singleton=True with nested lock hangs HOT 1
- Release to PyPi is failing HOT 1
- AttributeError: '_CountedFileLock' object has no attribute 'thread_safe' HOT 2
- '_CountedFileLock' object has no attribute 'thread_safe' HOT 34
- the latest filelock package 3.15.1 has compatible issue with package virtualenv HOT 6
- Poetry build fails with new filelock bugfix version HOT 9
- TypeError: LockedJSONData.__init__() got an unexpected keyword argument 'lock_file' ; regression between 3.15.1 and 3.15.3 HOT 3
- Android/Termux doesn't have flock, use lockf, SoftFileLock, or no lock? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from filelock.