its gonna be tough trying to avoid a race condition across multiple servers.
i can think of a few things you could do to minimize the race conditions, but not prevent them.
could you have 1 server be a master, and the other a slave/mirror?
like for example, uploading to server B, doesnt directly save the file. server B, being the slave, would need to contact server A and hand the file to A, and let A decide if it should save it or not.