summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.archive/pom.xml
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2018-08-26 19:44:29 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2018-09-07 12:13:53 +0200
commit06e06fc291a8ccc0e68b7d84b54097a9635df740 (patch)
tree82e5cf77e0b4ee6519b4e05faebc967418e0ba62 /org.eclipse.jgit.archive/pom.xml
parent6bec391d3693a38f812473413db2b4f73acf70fd (diff)
downloadjgit-06e06fc291a8ccc0e68b7d84b54097a9635df740.tar.gz
jgit-06e06fc291a8ccc0e68b7d84b54097a9635df740.zip
Fix atomic lock file creation on NFS
FS_POSIX.createNewFile(File) failed to properly implement atomic file creation on NFS using the algorithm [1]: - name of the hard link must be unique to prevent that two processes using different NFS clients try to create the same link. This would render nlink useless to detect if there was a race. - the hard link must be retained for the lifetime of the file since we don't know when the state of the involved NFS clients will be synchronized. This depends on NFS configuration options. To fix these issues we need to change the signature of createNewFile which would break API. Hence deprecate the old method FS.createNewFile(File) and add a new method createNewFileAtomic(File). The new method returns a LockToken which needs to be retained by the caller (LockFile) until all involved NFS clients synchronized their state. Since we don't know when the NFS caches are synchronized we need to retain the token until the corresponding file is no longer needed. The LockToken must be closed after the LockFile using it has been committed or unlocked. On Posix, if core.supportsAtomicCreateNewFile = false this will delete the hard link which guarded the atomic creation of the file. When acquiring the lock fails ensure that the hard link is removed. [1] https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html also see file creation flag O_EXCL in http://man7.org/linux/man-pages/man2/open.2.html Change-Id: I84fcb16143a5f877e9b08c6ee0ff8fa4ea68a90d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.archive/pom.xml')
0 files changed, 0 insertions, 0 deletions