storeExportWithContentIdentifierM for directory special remote

Not sure if my reasoning about the races really holds.

It would certianly be possible to better guard against races by using
Linux-specific renameat2 with RENAME_EXCHANGE or RENAME_NOREPLACE.

Or by using link and relying on it not overwriting existing files -- but
that would need a filesystem that supports hard links and directory can
be used in filesystems that don't.
This commit is contained in:
Joey Hess 2019-03-04 14:46:25 -04:00
parent 1ec9e1494c
commit 88ccfaa78c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 49 additions and 4 deletions

View file

@ -274,9 +274,8 @@ data ImportActions a = ImportActions
--
-- Since other things can modify the same file on the special
-- remote, this must take care to not overwrite such modifications,
-- and only overwrite a file that has the same ContentIdentifier
-- as was passed to it, unless listContents can recover an
-- overwritten file.
-- and only overwrite a file that has one of the ContentIdentifiers
-- passed to it, unless listContents can recover an overwritten file.
--
-- Also, since there can be concurrent writers, the implementation
-- needs to make sure that the ContentIdentifier it returns