Commit 059e11d8 authored by Robin Bobbitt's avatar Robin Bobbitt

Fix race condition in namespace directory creation

parent 2faf955c
---
title: Fix project creation failure due to race condition in namespace directory creation
merge_request: 10268
author: Robin Bobbitt
...@@ -174,7 +174,10 @@ module Gitlab ...@@ -174,7 +174,10 @@ module Gitlab
# add_namespace("/path/to/storage", "gitlab") # add_namespace("/path/to/storage", "gitlab")
# #
def add_namespace(storage, name) def add_namespace(storage, name)
FileUtils.mkdir_p(full_path(storage, name), mode: 0770) unless exists?(storage, name) path = full_path(storage, name)
FileUtils.mkdir_p(path, mode: 0770) unless exists?(storage, name)
rescue Errno::EEXIST => e
Rails.logger.warn("Directory exists as a file: #{e} at: #{path}")
end end
# Remove directory from repositories storage # Remove directory from repositories storage
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment