]> git.tuebingen.mpg.de Git - dss.git/commit
Don't create two snapshots in the same second.
authorAndre Noll <maan@systemlinux.org>
Mon, 1 Oct 2012 17:10:02 +0000 (19:10 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 1 Oct 2012 17:10:02 +0000 (19:10 +0200)
commit42263e3bce7826703a531d0113d706fe3f3536a4
treed99e83d685f0e3c2fc782bf25a17531aa9ccf8ea
parent6c76799c7334a12926dc1cf0c32670423cbc954f
Don't create two snapshots in the same second.

This can only happen if all of the follwing are true:

(a) source and destination directories are small
(b) rsync completes successfully within one second
(c) At most two snapshots are missing

In this case the rename() call which changes the snapshot name from
*-incomplete to the proper name fails for the second snapshot with
EEXIST. This is because the previous snapshot name coincides with
the name of the second snapshot.

The fix is a bit ugly but also non-invasive and simple: Just sleep
one second in this case.
dss.c