summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorRobin Bobbitt <ryehle@us.ibm.com>2017-03-27 16:22:01 -0400
committerRobin Bobbitt <ryehle@us.ibm.com>2017-04-03 09:35:12 -0400
commit059e11d87f1948b146febc1b3e93ac5a52863d2b (patch)
treec59fccec2d62eb7d9e35ac2c475f15edc637486f /lib/gitlab
parent2faf955c241ce7e99111f8fd0cae2e7ab6167e5a (diff)
downloadgitlab-ce-059e11d87f1948b146febc1b3e93ac5a52863d2b.tar.gz
Fix race condition in namespace directory creation
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/shell.rb5
1 files changed, 4 insertions, 1 deletions
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