summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-04-03 20:44:24 +0000
committerDouwe Maan <douwe@gitlab.com>2017-04-03 20:44:24 +0000
commitc2b35320e05c5e0cb3bdc11fa1418ed5f3e5c76f (patch)
tree6c3cabb29591b10dd8a39b4e8b03e8285b7955e6
parente98536fb384d76ed7e13238bebbca91b682f5172 (diff)
parent059e11d87f1948b146febc1b3e93ac5a52863d2b (diff)
downloadgitlab-ce-c2b35320e05c5e0cb3bdc11fa1418ed5f3e5c76f.tar.gz
Merge branch 'namespace-race-condition' into 'master'
Fix race condition in namespace directory creation See merge request !10268
-rw-r--r--changelogs/unreleased/namespace-race-condition.yml4
-rw-r--r--lib/gitlab/shell.rb5
2 files changed, 8 insertions, 1 deletions
diff --git a/changelogs/unreleased/namespace-race-condition.yml b/changelogs/unreleased/namespace-race-condition.yml
new file mode 100644
index 00000000000..2a76b6c74e8
--- /dev/null
+++ b/changelogs/unreleased/namespace-race-condition.yml
@@ -0,0 +1,4 @@
+---
+title: Fix project creation failure due to race condition in namespace directory creation
+merge_request: 10268
+author: Robin Bobbitt
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb
index da8d8ddb8ed..9864a9c7f1a 100644
--- a/lib/gitlab/shell.rb
+++ b/lib/gitlab/shell.rb
@@ -174,7 +174,10 @@ module Gitlab
# add_namespace("/path/to/storage", "gitlab")
#
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
# Remove directory from repositories storage