race condition bugs
dot at dotat.at
Mon Aug 9 11:12:16 GMT 2004
We're using rsync to update the tables on our email relays, and very
occasionally we get an error in the logs saying that a table has the wrong
permissions. This is because of race conditions in finish_transfer() which
mean that it does not update files atomically. This makes rsync not
entirely safe to use in our situation, where the files being synced are
frequently opened for short periods :-(
The specific problems are:
(1) The permissions on the file are fixed as the last operation. They
should be fixed before the file is atomically renamed into place. I
believe this is the one we are hitting, which occurs about once every few
(2) If the rename fails because it is cross-device, it is copied into
place before the permissions are fixed. This should only occur if the user
has specified a temporary directory. It is probably worth noting in the
documentation that atomic updates are not possible in this situation.
Fixing rsync to update the file atomically may cause problems if the
target filesystem is short on space, which is probably the reason for
using the --temp-dir option in the first place.
f.a.n.finch <dot at dotat.at> http://dotat.at/
BERWICK ON TWEED TO WHITBY: WEST OR SOUTHWEST 2 OR 3 INCREASING 3 OR 4. FAIR.
GOOD. SLIGHT OR SMOOTH.
More information about the rsync