Before rename do fsync(2)
Before rename do fsync(2)

In this way, we ensure that the temporary file is fully written
to disk before the rename makes it take over the position of the
old file.

Signed-off-by: Klaus Aehlig <4ce51de36d9068cd7db2eec1151e0f3f95419008@google.com>
Reviewed-by: Petr Pudlak <9d19625f8ee825a2c398462ed335cbcf98f79c32@google.com>

ganeti/ganeti,grnet/snf-ganeti,leshchevds/ganeti,mbakke/ganeti,leshchevds/ganeti,grnet/snf-ganeti,apyrgio/ganeti,onponomarev/ganeti,ganeti/ganeti,yiannist/ganeti,ganeti/ganeti,mbakke/ganeti,yiannist/ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,dimara/ganeti,leshchevds/ganeti,apyrgio/ganeti,yiannist/ganeti,ganeti-github-testing/ganeti-test-1,bitemyapp/ganeti,mbakke/ganeti,dimara/ganeti,andir/ganeti,bitemyapp/ganeti,onponomarev/ganeti,andir/ganeti