Revert "upload: Moving locking code to earlier stage"

This reverts commit d9bce40f66b960e3a438b0b0e6473057c7387c67.

Stupid change from my own.