Commit c2b35320 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'namespace-race-condition' into 'master'

Fix race condition in namespace directory creation

See merge request !10268
parents e98536fb 059e11d8
---
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