Fix race condition in namespace directory creation
What does this MR do?
Fixes a race condition in lib/gitlab/shell.rb add_namespace method that can occur when multiple repos are created simultaneously for a new user. The namespace directory can be created in the time between checking for its existence and attempting to create it, which currently causes an error.
Are there points in the code the reviewer needs to double check?
No.
Why was this MR needed?
We have external tooling that creates repos for our users via API, sometimes several repos at a time. A new user hit a failure when simultaneously creating three repos due to the race condition addressed here.
Screenshots (if relevant)
N/A
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
None.