Bug 10081 - Multiple rsync instances conflict
Multiple rsync instances conflict
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
All All
: P5 minor
: ---
Assigned To: Wayne Davison
Rsync QA Contact
Depends on:
  Show dependency treegraph
Reported: 2013-08-12 15:58 UTC by Dmitry Yu Okunev
Modified: 2015-02-11 10:48 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Yu Okunev 2013-08-12 15:58:49 UTC
When running multiple instances of rsync with "--backup" option on same file (for example in case of intersecting include-files), few of them can exit with exitcode "23".

It happens due to nonatomicity of robust_unlink()&do_open() operation in copy_file(). While one of instances is proceeding between robust_unlink() and do_open(), another instance can run do_open(). So the first instance will fail on do_open() due to flag "O_EXCL".

I suggest to remove the flag "O_EXCL" if copy_file() is called from make_backup() function.

Overwriting of "backuped" file is fine behavior, so why not to permit it even for this special case?
Comment 1 Dmitry Yu Okunev 2014-01-02 11:01:10 UTC
I can write a patch. Is this required? I can make my modification to be optional, if this required.
Comment 2 devurandom 2015-02-11 10:48:03 UTC
I assume this is not being considered, because the backup needs to be restored in case the new file is corrupted? So overwriting it would be bad?