Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2019-07-11 00:36:49 +0300
committerJohn Cai <jcai@gitlab.com>2019-07-16 23:54:01 +0300
commit8765d537373679ccbb219ee400c277384972c742 (patch)
tree1e3da00083accf8077e55731ef9904c0fdd09075 /lib/gitlab/gitaly_client.rb
parent3d9dc7dbf846f693c8c38667388950d7a14c2f0a (diff)
Wrap rugged calls with access disk block
Whenever we use the rugged implementation, we are going straight to disk so we want to bypass the disk access check.
Diffstat (limited to 'lib/gitlab/gitaly_client.rb')
-rw-r--r--lib/gitlab/gitaly_client.rb25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb
index 091351e5cb2..3cafa49ec51 100644
--- a/lib/gitlab/gitaly_client.rb
+++ b/lib/gitlab/gitaly_client.rb
@@ -388,21 +388,20 @@ module Gitlab
end
def self.can_use_disk?(storage)
- false
- # cached_value = MUTEX.synchronize do
- # @can_use_disk ||= {}
- # @can_use_disk[storage]
- # end
+ cached_value = MUTEX.synchronize do
+ @can_use_disk ||= {}
+ @can_use_disk[storage]
+ end
- # return cached_value unless cached_value.nil?
+ return cached_value if cached_value.present?
- # gitaly_filesystem_id = filesystem_id(storage)
- # direct_filesystem_id = filesystem_id_from_disk(storage)
+ gitaly_filesystem_id = filesystem_id(storage)
+ direct_filesystem_id = filesystem_id_from_disk(storage)
- # MUTEX.synchronize do
- # @can_use_disk[storage] = gitaly_filesystem_id.present? &&
- # gitaly_filesystem_id == direct_filesystem_id
- # end
+ MUTEX.synchronize do
+ @can_use_disk[storage] = gitaly_filesystem_id.present? &&
+ gitaly_filesystem_id == direct_filesystem_id
+ end
end
def self.filesystem_id(storage)
@@ -415,7 +414,7 @@ module Gitlab
metadata_file = File.read(storage_metadata_file_path(storage))
metadata_hash = JSON.parse(metadata_file)
metadata_hash['gitaly_filesystem_id']
- rescue Errno::ENOENT, JSON::ParserError
+ rescue Errno::ENOENT, Errno::ACCESS, JSON::ParserError
nil
end