CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mountpoint.cc
Go to the documentation of this file.
1 
4 #include "cvmfs_config.h"
5 #include "mountpoint.h"
6 
7 #include <errno.h>
8 #include <fcntl.h>
9 #include <inttypes.h>
10 #include <stdint.h>
11 #include <unistd.h>
12 
13 #include <algorithm>
14 #include <cassert>
15 #include <climits>
16 #include <cstring>
17 #include <vector>
18 
19 #include "duplex_fuse.h" // NOLINT
20 
21 #ifndef CVMFS_LIBCVMFS
22 #ifdef FUSE_CAP_EXPORT_SUPPORT
23 #define CVMFS_NFS_SUPPORT
24 #else
25 #warning "No NFS support, Fuse too old"
26 #endif
27 #endif
28 
29 #include "authz/authz_curl.h"
30 #include "authz/authz_fetch.h"
31 #include "authz/authz_session.h"
32 #include "backoff.h"
33 #include "cache.h"
34 #include "cache_extern.h"
35 #include "cache_posix.h"
36 #include "cache_ram.h"
37 #include "cache_stream.h"
38 #include "cache_tiered.h"
39 #include "catalog.h"
40 #include "catalog_mgr_client.h"
41 #include "clientctx.h"
42 #include "crypto/signature.h"
43 #include "duplex_sqlite3.h"
44 #include "fetch.h"
45 #include "file_chunk.h"
46 #include "globals.h"
47 #include "glue_buffer.h"
48 #include "google/protobuf/stubs/common.h"
49 #include "history.h"
50 #include "history_sqlite.h"
51 #include "lru_md.h"
52 #include "manifest.h"
53 #include "manifest_fetch.h"
54 #include "network/download.h"
55 #include "nfs_maps.h"
56 #ifdef CVMFS_NFS_SUPPORT
57 #include "nfs_maps_leveldb.h"
58 #include "nfs_maps_sqlite.h"
59 #endif
60 #include "options.h"
61 #include "quota_posix.h"
63 #include "sqlitemem.h"
64 #include "sqlitevfs.h"
65 #include "statistics.h"
66 #include "telemetry_aggregator.h"
67 #include "tracer.h"
68 #include "util/concurrency.h"
69 #include "util/logging.h"
70 #include "util/platform.h"
71 #include "util/pointer.h"
72 #include "util/posix.h"
73 #include "util/string.h"
74 #include "util/uuid.h"
75 #include "wpad.h"
76 
77 using namespace std; // NOLINT
78 
79 
80 bool FileSystem::g_alive = false;
81 const char *FileSystem::kDefaultCacheBase = "/var/lib/cvmfs";
82 const char *FileSystem::kDefaultCacheMgrInstance = "default";
83 
84 
85 FileSystem::IoErrorInfo::IoErrorInfo() : counter_(NULL), timestamp_last_(0) { }
86 
88  counter_->Set(0);
89  timestamp_last_ = 0;
90 }
91 
93  perf::Inc(counter_);
94  timestamp_last_ = time(NULL);
95 }
96 
98 
99 int64_t FileSystem::IoErrorInfo::count() { return counter_->Get(); }
100 
101 time_t FileSystem::IoErrorInfo::timestamp_last() { return timestamp_last_; }
102 
103 
104 
109 bool FileSystem::CheckInstanceName(const std::string &instance) {
110  if (instance.length() > 24)
111  return false;
112  sanitizer::CacheInstanceSanitizer instance_sanitizer;
113  if (!instance_sanitizer.IsValid(instance)) {
114  boot_error_ = "invalid instance name (" + instance + "), " +
115  "only characters a-z, A-Z, 0-9, _ are allowed";
117  return false;
118  }
119  return true;
120 }
121 
122 
128 {
129  if (settings.is_alien && settings.is_shared) {
130  boot_error_ = "Failure: shared local disk cache and alien cache mutually "
131  "exclusive. Please turn off shared local disk cache.";
133  return false;
134  }
135  if (settings.is_alien && settings.is_managed) {
136  boot_error_ = "Failure: quota management and alien cache mutually "
137  "exclusive. Please turn off quota limit.";
139  return false;
140  }
141 
142  if (type_ == kFsLibrary) {
143  if (settings.is_shared || settings.is_managed) {
144  boot_error_ = "Failure: libcvmfs supports only unmanaged exclusive cache "
145  "or alien cache.";
147  return false;
148  }
149  }
150 
151  if (settings.cache_base_defined && settings.cache_dir_defined) {
152  boot_error_ =
153  "'CVMFS_CACHE_BASE' and 'CVMFS_CACHE_DIR' are mutually exclusive";
155  return false;
156  }
157 
158  return true;
159 }
160 
161 
168  file_system(new FileSystem(fs_info));
169 
170  file_system->SetupGlobalEnvironmentParams();
171 
172  file_system->SetupLogging();
173  LogCvmfs(kLogCvmfs, kLogDebug, "Options:\n%s",
174  file_system->options_mgr()->Dump().c_str());
175 
176  file_system->CreateStatistics();
177  file_system->SetupSqlite();
178  if (!file_system->DetermineNfsMode())
179  return file_system.Release();
180  if (!file_system->SetupWorkspace())
181  return file_system.Release();
182 
183  // Redirect SQlite temp directory to workspace (global variable)
184  unsigned length_tempdir = file_system->workspace_.length() + 1;
185  sqlite3_temp_directory = static_cast<char *>(sqlite3_malloc(length_tempdir));
186  snprintf(sqlite3_temp_directory,
187  length_tempdir,
188  "%s",
189  file_system->workspace_.c_str());
190 
191  if (!file_system->TriageCacheMgr())
192  return file_system.Release();
193  file_system->SetupUuid();
194  if (!file_system->SetupNfsMaps())
195  return file_system.Release();
196  bool retval = sqlite::RegisterVfsRdOnly(
197  file_system->cache_mgr_,
198  file_system->statistics_,
200  assert(retval);
201  file_system->has_custom_sqlitevfs_ = true;
202 
204 
205  file_system->boot_status_ = loader::kFailOk;
206  return file_system.Release();
207 }
208 
209 
212 
213  // Register the ShortString's static counters
214  statistics_->Register("pathstring.n_instances", "Number of instances");
215  statistics_->Register("pathstring.n_overflows", "Number of overflows");
216  statistics_->Register("namestring.n_instances", "Number of instances");
217  statistics_->Register("namestring.n_overflows", "Number of overflows");
218  statistics_->Register("linkstring.n_instances", "Number of instances");
219  statistics_->Register("linkstring.n_overflows", "Number of overflows");
220 
221  // Callback counters
222  n_fs_open_ = statistics_->Register("cvmfs.n_fs_open",
223  "Overall number of file open operations");
224  n_fs_dir_open_ = statistics_->Register("cvmfs.n_fs_dir_open",
225  "Overall number of directory open operations");
226  n_fs_lookup_ = statistics_->Register("cvmfs.n_fs_lookup",
227  "Number of lookups");
228  n_fs_lookup_negative_ = statistics_->Register("cvmfs.n_fs_lookup_negative",
229  "Number of negative lookups");
230  n_fs_stat_ = statistics_->Register("cvmfs.n_fs_stat", "Number of stats");
231  n_fs_stat_stale_ = statistics_->Register("cvmfs.n_fs_stat_stale",
232  "Number of stats for stale (open, meanwhile changed) regular files");
233  n_fs_statfs_ = statistics_->Register("cvmfs.n_fs_statfs",
234  "Overall number of statsfs calls");
235  n_fs_statfs_cached_ = statistics_->Register("cvmfs.n_fs_statfs_cached",
236  "Number of statsfs calls that accessed the cached statfs info");
237  n_fs_read_ = statistics_->Register("cvmfs.n_fs_read", "Number of files read");
238  n_fs_readlink_ = statistics_->Register("cvmfs.n_fs_readlink",
239  "Number of links read");
240  n_fs_forget_ = statistics_->Register("cvmfs.n_fs_forget",
241  "Number of inode forgets");
242  n_fs_inode_replace_ = statistics_->Register("cvmfs.n_fs_inode_replace",
243  "Number of stale inodes that got replaced by an up-to-date version");
244  no_open_files_ = statistics_->Register("cvmfs.no_open_files",
245  "Number of currently opened files");
246  no_open_dirs_ = statistics_->Register("cvmfs.no_open_dirs",
247  "Number of currently opened directories");
248  io_error_info_.SetCounter(statistics_->Register("cvmfs.n_io_error",
249  "Number of I/O errors"));
250  n_eio_total_ = statistics_->Register("eio.total",
251  "EIO returned to calling process. Sum of individual eio counters");
252  n_eio_01_ = statistics_->Register("eio.01",
253  "EIO returned to calling process. cvmfs.cc:cvmfs_lookup()");
254  n_eio_02_ = statistics_->Register("eio.02",
255  "EIO returned to calling process. cvmfs.cc:ReplyNegative()");
256  n_eio_03_ = statistics_->Register("eio.03",
257  "EIO returned to calling process. cvmfs.cc:cvmfs_opendir()");
258  n_eio_04_ = statistics_->Register("eio.04",
259  "EIO returned to calling process. cvmfs.cc:cvmfs_open()");
260  n_eio_05_ = statistics_->Register("eio.05",
261  "EIO returned to calling process. cvmfs.cc:cvmfs_read()");
262  n_eio_06_ = statistics_->Register("eio.06",
263  "EIO returned to calling process. cvmfs.cc:cvmfs_open()");
264  n_eio_07_ = statistics_->Register("eio.07",
265  "EIO returned to calling process. cvmfs.cc:cvmfs_read()");
266  n_eio_08_ = statistics_->Register("eio.08",
267  "EIO returned to calling process. cvmfs.cc:cvmfs_read()");
268 
269  string optarg;
270  if (options_mgr_->GetValue("CVMFS_INSTRUMENT_FUSE", &optarg) &&
271  options_mgr_->IsOn(optarg))
272  {
274  }
275 
276  hist_fs_lookup_ = new Log2Histogram(30);
277  hist_fs_forget_ = new Log2Histogram(30);
284  hist_fs_open_ = new Log2Histogram(30);
285  hist_fs_read_ = new Log2Histogram(30);
287 }
288 
289 
295  const string &instance
296 ) {
297  string optarg;
299 
300  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_REFCOUNT", instance),
301  &optarg)
302  && options_mgr_->IsOn(optarg))
303  {
304  settings.do_refcount = true;
305  }
306 
307  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_SHARED", instance),
308  &optarg)
309  && options_mgr_->IsOn(optarg))
310  {
311  settings.is_shared = true;
312  }
313  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_SERVER_MODE", instance),
314  &optarg)
315  && options_mgr_->IsOn(optarg))
316  {
317  settings.avoid_rename = true;
318  }
319 
320  if (type_ == kFsFuse)
321  settings.quota_limit = kDefaultQuotaLimit;
322  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_QUOTA_LIMIT", instance),
323  &optarg))
324  {
325  settings.quota_limit = String2Int64(optarg) * 1024 * 1024;
326  }
327  if (settings.quota_limit > 0)
328  settings.is_managed = true;
329 
330  settings.cache_path = kDefaultCacheBase;
331  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_BASE", instance),
332  &optarg))
333  {
334  settings.cache_path = MakeCanonicalPath(optarg);
335  settings.cache_base_defined = true;
336  }
337  if (settings.is_shared) {
338  settings.cache_path += "/shared";
339  } else {
340  settings.cache_path += "/" + name_;
341  }
342 
343  // CheckCacheMode makes sure that CVMFS_CACHE_DIR and CVMFS_CACHE_BASE are
344  // not set at the same time.
345  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_DIR", instance),
346  &optarg))
347  {
348  settings.cache_dir_defined = true;
349  settings.cache_path = optarg;
350  }
351  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_ALIEN", instance),
352  &optarg))
353  {
354  settings.is_alien = true;
355  settings.cache_path = optarg;
356  }
357  // We already changed the cwd to the workspace
358  // Which is only done if using FUSE
359  if ((type_ == kFsFuse) && (settings.cache_path == workspace_fullpath_)) {
360  settings.cache_path = ".";
361  }
362 
363  // The cache workspace usually is the cache directory, unless explicitly
364  // set otherwise
365  settings.workspace = settings.cache_path;
366  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_WORKSPACE", instance),
367  &optarg) ||
368  options_mgr_->GetValue("CVMFS_WORKSPACE", &optarg))
369  {
370  // Used for the shared quota manager
371  settings.workspace = optarg;
372  }
373 
374  return settings;
375 }
376 
377 
379  string optarg;
380 
381  if (options_mgr_->GetValue("CVMFS_NFS_SOURCE", &optarg) &&
382  options_mgr_->IsOn(optarg))
383  {
384  nfs_mode_ |= kNfsMaps;
385  if (options_mgr_->GetValue("CVMFS_NFS_SHARED", &optarg)) {
387  nfs_maps_dir_ = optarg;
388  }
389  }
390 
391  if ((type_ == kFsLibrary) && (nfs_mode_ != kNfsNone)) {
392  boot_error_ = "Failure: libcvmfs does not support NFS export.";
394  return false;
395  }
396  return true;
397 }
398 
399 
401  : name_(fs_info.name)
402  , exe_path_(fs_info.exe_path)
403  , type_(fs_info.type)
404  , options_mgr_(fs_info.options_mgr)
405  , wait_workspace_(fs_info.wait_workspace)
406  , foreground_(fs_info.foreground)
407  , n_fs_open_(NULL)
408  , n_fs_dir_open_(NULL)
409  , n_fs_lookup_(NULL)
410  , n_fs_lookup_negative_(NULL)
411  , n_fs_stat_(NULL)
412  , n_fs_stat_stale_(NULL)
413  , n_fs_statfs_(NULL)
414  , n_fs_statfs_cached_(NULL)
415  , n_fs_read_(NULL)
416  , n_fs_readlink_(NULL)
417  , n_fs_forget_(NULL)
418  , n_fs_inode_replace_(NULL)
419  , no_open_files_(NULL)
420  , no_open_dirs_(NULL)
421  , n_eio_total_(NULL)
422  , n_eio_01_(NULL)
423  , n_eio_02_(NULL)
424  , n_eio_03_(NULL)
425  , n_eio_04_(NULL)
426  , n_eio_05_(NULL)
427  , n_eio_06_(NULL)
428  , n_eio_07_(NULL)
429  , n_eio_08_(NULL)
430  , statistics_(NULL)
431  , fd_workspace_lock_(-1)
432  , found_previous_crash_(false)
434  , cache_mgr_(NULL)
435  , uuid_cache_(NULL)
436  , nfs_maps_(NULL)
437  , has_custom_sqlitevfs_(false)
438 {
439  assert(!g_alive);
440  g_alive = true;
441  g_uid = geteuid();
442  g_gid = getegid();
443 
444  string optarg;
445  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_SERVER_MODE",
447  &optarg)
448  && options_mgr_->IsOn(optarg))
449  {
450  g_raw_symlinks = true;
451  }
452 }
453 
454 
457 
460 
461  delete uuid_cache_;
462  delete nfs_maps_;
463  delete cache_mgr_;
464 
465  if (sqlite3_temp_directory) {
466  sqlite3_free(sqlite3_temp_directory);
467  sqlite3_temp_directory = NULL;
468  }
469 
470  if (!path_crash_guard_.empty())
471  unlink(path_crash_guard_.c_str());
472  if (!path_workspace_lock_.empty())
473  unlink(path_workspace_lock_.c_str());
474  if (fd_workspace_lock_ >= 0)
476 
477  sqlite3_shutdown();
479 
480  delete hist_fs_lookup_;
481  delete hist_fs_forget_multi_;
482  delete hist_fs_forget_;
483  delete hist_fs_getattr_;
484  delete hist_fs_readlink_;
485  delete hist_fs_opendir_;
486  delete hist_fs_releasedir_;
487  delete hist_fs_readdir_;
488  delete hist_fs_open_;
489  delete hist_fs_read_;
490  delete hist_fs_release_;
491  delete statistics_;
492 
493  SetLogSyslogPrefix("");
494  SetLogMicroSyslog("");
495  SetLogDebugFile("");
496  google::protobuf::ShutdownProtobufLibrary();
497  g_alive = false;
498 }
499 
500 
502  path_workspace_lock_ = workspace_ + "/lock." + name_;
504  if (fd_workspace_lock_ >= 0)
505  return true;
506 
507  if (fd_workspace_lock_ == -1) {
508  boot_error_ = "could not acquire workspace lock (" +
509  StringifyInt(errno) + ")";
511  return false;
512  }
513 
514  assert(fd_workspace_lock_ == -2);
515 
516  if (!wait_workspace_) {
518  return false;
519  }
520 
522  if (fd_workspace_lock_ < 0) {
523  boot_error_ = "could not acquire workspace lock (" +
524  StringifyInt(errno) + ")";
526  return false;
527  }
528  return true;
529 }
530 
531 
533  void *user_data __attribute__((unused)),
534  int sqlite_extended_error,
535  const char *message)
536 {
537  int log_dest = kLogDebug;
538  int sqlite_error = sqlite_extended_error & 0xFF;
539  switch (sqlite_error) {
540  case SQLITE_INTERNAL:
541  case SQLITE_PERM:
542  case SQLITE_NOMEM:
543  case SQLITE_IOERR:
544  case SQLITE_CORRUPT:
545  case SQLITE_FULL:
546  case SQLITE_CANTOPEN:
547  case SQLITE_MISUSE:
548  case SQLITE_FORMAT:
549  case SQLITE_NOTADB:
550  log_dest |= kLogSyslogErr;
551  break;
552  case SQLITE_WARNING:
553  case SQLITE_NOTICE:
554  default:
555  break;
556  }
557  LogCvmfs(kLogCvmfs, log_dest, "SQlite3: %s (%d)",
558  message, sqlite_extended_error);
559 }
560 
561 
568  const string &generic_parameter,
569  const string &instance)
570 {
571  assert(HasPrefix(generic_parameter, "CVMFS_CACHE_", false));
572 
573  if (instance == kDefaultCacheMgrInstance) {
574  // Compatibility parameter names
575  if ((generic_parameter == "CVMFS_CACHE_SHARED") &&
576  !options_mgr_->IsDefined(generic_parameter))
577  {
578  return "CVMFS_SHARED_CACHE";
579  }
580  if ((generic_parameter == "CVMFS_CACHE_ALIEN") &&
581  !options_mgr_->IsDefined(generic_parameter))
582  {
583  return "CVMFS_ALIEN_CACHE";
584  }
585  if ((generic_parameter == "CVMFS_CACHE_SERVER_MODE") &&
586  !options_mgr_->IsDefined(generic_parameter))
587  {
588  return "CVMFS_SERVER_CACHE_MODE";
589  }
590  if ((generic_parameter == "CVMFS_CACHE_QUOTA_LIMIT") &&
591  !options_mgr_->IsDefined(generic_parameter))
592  {
593  return "CVMFS_QUOTA_LIMIT";
594  }
595  return generic_parameter;
596  }
597 
598  return "CVMFS_CACHE_" + instance + "_" + generic_parameter.substr(12);
599 }
600 
601 
604  n_eio_total_->Set(0);
605  n_eio_01_->Set(0);
606  n_eio_02_->Set(0);
607  n_eio_03_->Set(0);
608  n_eio_04_->Set(0);
609  n_eio_05_->Set(0);
610  n_eio_06_->Set(0);
611  n_eio_07_->Set(0);
612  n_eio_08_->Set(0);
613 }
614 
615 
619 CacheManager *FileSystem::SetupCacheMgr(const string &instance) {
620  if (constructed_instances_.find(instance) != constructed_instances_.end()) {
621  boot_error_ = "circular cache definition: " + instance;
623  return NULL;
624  }
625  constructed_instances_.insert(instance);
626 
627  LogCvmfs(kLogCvmfs, kLogDebug, "setting up cache manager instance %s",
628  instance.c_str());
629  string instance_type;
630  if (instance == kDefaultCacheMgrInstance) {
631  instance_type = "posix";
632  } else {
633  options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_TYPE", instance),
634  &instance_type);
635  }
636  if (instance_type == "posix") {
637  return SetupPosixCacheMgr(instance);
638  } else if (instance_type == "ram") {
639  return SetupRamCacheMgr(instance);
640  } else if (instance_type == "tiered") {
641  return SetupTieredCacheMgr(instance);
642  } else if (instance_type == "external") {
643  return SetupExternalCacheMgr(instance);
644  } else {
645  boot_error_ = "invalid cache manager type for '" + instance + "':" +
646  instance_type;
648  return NULL;
649  }
650 }
651 
652 
654  string optarg;
655  unsigned nfiles = kDefaultNfiles;
656  if (options_mgr_->GetValue("CVMFS_NFILES", &optarg))
657  nfiles = String2Uint64(optarg);
658  vector<string> cmd_line;
659  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_CMDLINE", instance),
660  &optarg))
661  {
662  cmd_line = SplitString(optarg, ',');
663  }
664 
665  if (!options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_LOCATOR", instance),
666  &optarg))
667  {
668  boot_error_ = MkCacheParm("CVMFS_CACHE_LOCATOR", instance) + " missing";
670  return NULL;
671  }
672 
674  ExternalCacheManager::CreatePlugin(optarg, cmd_line));
675  if (!plugin_handle->IsValid()) {
676  boot_error_ = plugin_handle->error_msg();
678  return NULL;
679  }
681  plugin_handle->fd_connection(), nfiles, name_ + ":" + instance);
682  if (cache_mgr == NULL) {
683  boot_error_ = "failed to create external cache manager for " + instance;
685  return NULL;
686  }
687  cache_mgr->AcquireQuotaManager(ExternalQuotaManager::Create(cache_mgr));
688  return cache_mgr;
689 }
690 
691 
694  if (!CheckPosixCacheSettings(settings))
695  return NULL;
697  settings.cache_path,
698  settings.is_alien,
701  settings.do_refcount));
702  if (!cache_mgr.IsValid()) {
703  boot_error_ = "Failed to setup posix cache '" + instance + "' in " +
704  settings.cache_path + ": " + strerror(errno);
706  return NULL;
707  }
708 
709  // Sentinel file for future use
710  // Might be a read-only cache
711  const bool ignore_failure = settings.is_alien;
712  CreateFile(settings.cache_path + "/.cvmfscache", 0600, ignore_failure);
713 
714  if (settings.is_managed) {
715  if (!SetupPosixQuotaMgr(settings, cache_mgr.weak_ref()))
716  return NULL;
717  }
718  return cache_mgr.Release();
719 }
720 
721 
722 CacheManager *FileSystem::SetupRamCacheMgr(const string &instance) {
723  string optarg;
724  unsigned nfiles = kDefaultNfiles;
725  if (options_mgr_->GetValue("CVMFS_NFILES", &optarg)) {
726  nfiles = String2Uint64(optarg);
727  }
728  uint64_t sz_cache_bytes;
729  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_SIZE", instance),
730  &optarg))
731  {
732  if (HasSuffix(optarg, "%", false)) {
733  sz_cache_bytes = platform_memsize() * String2Uint64(optarg)/100;
734  } else {
735  sz_cache_bytes = String2Uint64(optarg) * 1024 * 1024;
736  }
737  } else {
738  sz_cache_bytes = platform_memsize() >> 5; // ~3%
739  }
741  if (options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_MALLOC", instance),
742  &optarg))
743  {
744  if (optarg == "libc") {
746  } else if (optarg == "heap") {
748  } else {
749  boot_error_ = "Failure: unknown malloc " +
750  MkCacheParm("CVMFS_CACHE_MALLOC", instance) + "=" + optarg;
752  return NULL;
753  }
754  }
755  sz_cache_bytes = RoundUp8(std::max(static_cast<uint64_t>(40 * 1024 * 1024),
756  sz_cache_bytes));
758  sz_cache_bytes,
759  nfiles,
760  alloc,
761  perf::StatisticsTemplate("cache." + instance, statistics_));
762  if (cache_mgr == NULL) {
763  boot_error_ = "failed to create ram cache manager for " + instance;
765  return NULL;
766  }
767  cache_mgr->AcquireQuotaManager(new NoopQuotaManager());
768  return cache_mgr;
769 }
770 
771 
773  string optarg;
774  if (!options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_UPPER", instance),
775  &optarg))
776  {
777  boot_error_ = MkCacheParm("CVMFS_CACHE_UPPER", instance) + " missing";
779  return NULL;
780  }
781  UniquePtr<CacheManager> upper(SetupCacheMgr(optarg));
782  if (!upper.IsValid())
783  return NULL;
784 
785  if (!options_mgr_->GetValue(MkCacheParm("CVMFS_CACHE_LOWER", instance),
786  &optarg))
787  {
788  boot_error_ = MkCacheParm("CVMFS_CACHE_LOWER", instance) + " missing";
790  return NULL;
791  }
792  UniquePtr<CacheManager> lower(SetupCacheMgr(optarg));
793  if (!lower.IsValid())
794  return NULL;
795 
796  CacheManager *tiered =
797  TieredCacheManager::Create(upper.Release(), lower.Release());
798  if (tiered == NULL) {
799  boot_error_ = "Failed to setup tiered cache manager " + instance;
801  return NULL;
802  }
803  if (options_mgr_->GetValue(
804  MkCacheParm("CVMFS_CACHE_LOWER_READONLY", instance), &optarg) &&
805  options_mgr_->IsOn(optarg))
806  {
807  static_cast<TieredCacheManager*>(tiered)->SetLowerReadOnly();
808  }
809  return tiered;
810 }
811 
812 
814  path_crash_guard_ = workspace_ + "/running." + name_;
815  platform_stat64 info;
816  int retval = platform_stat(path_crash_guard_.c_str(), &info);
817  if (retval == 0) {
818  found_previous_crash_ = true;
820  "looks like cvmfs has been crashed previously");
821  }
822  retval = open(path_crash_guard_.c_str(), O_RDONLY | O_CREAT, 0600);
823  if (retval < 0) {
824  boot_error_ = "could not open running sentinel (" +
825  StringifyInt(errno) + ")";
827  return false;
828  }
829  close(retval);
830  return true;
831 }
832 
833 
835  if (type_ == kFsFuse) {
836  // Try to jump to workspace / cache directory. This tests, if it is
837  // accessible and it brings speed later on.
838  int retval = chdir(workspace_.c_str());
839  if (retval != 0) {
840  boot_error_ = "workspace " + workspace_ + " is unavailable";
842  return false;
843  }
844  workspace_ = ".";
845  return true;
846  }
847 
848  // Note: as of version 2.4 support for CVMFS_CWD_CACHE is dropped due to
849  // disproportionate large complexity to configure correctly. This affects
850  // only libcvmfs, mostly the legacy part.
851  // string optarg;
852  // if (options_mgr_->GetValue("CVMFS_CWD_CACHE", &optarg) &&
853  // options_mgr_->IsOn(optarg))
854  // {
855  // ...
856  // }
857  return true;
858 }
859 
860 
865  setenv("CVMFS_ARCH", GetArch().c_str(), 1 /* overwrite */);
866 }
867 
868 
870  const OptionsManager &options_mgr, const std::string &prefix)
871 {
873 
874  string optarg;
875  if (options_mgr.GetValue("CVMFS_SYSLOG_LEVEL", &optarg))
877  if (options_mgr.GetValue("CVMFS_SYSLOG_FACILITY", &optarg))
879  if (options_mgr.GetValue("CVMFS_USYSLOG", &optarg))
880  SetLogMicroSyslog(optarg);
881  if (options_mgr.GetValue("CVMFS_DEBUGLOG", &optarg))
882  SetLogDebugFile(optarg);
883  if (options_mgr.GetValue("CVMFS_SYSLOG_PREFIX", &optarg)) {
884  SetLogSyslogPrefix(optarg);
885  } else {
886  SetLogSyslogPrefix(prefix);
887  }
888 }
889 
890 
893 }
894 
895 
897 #ifdef CVMFS_NFS_SUPPORT
898  if (!IsHaNfsSource())
900 
901  string no_nfs_sentinel;
902  if (cache_mgr_->id() == kPosixCacheManager) {
903  PosixCacheManager *posix_cache_mgr =
904  reinterpret_cast<PosixCacheManager *>(cache_mgr_);
905  no_nfs_sentinel = posix_cache_mgr->cache_path() + "/no_nfs_maps." + name_;
906  if (!IsNfsSource()) {
907  // Might be a read-only cache
908  const bool ignore_failure = posix_cache_mgr->alien_cache();
909  CreateFile(no_nfs_sentinel, 0600, ignore_failure);
910  return true;
911  }
912  } else {
913  if (IsNfsSource()) {
914  boot_error_ = "NFS source only works with POSIX cache manager.";
916  return false;
917  }
918  return true;
919  }
920 
922  assert(IsNfsSource());
923  if (!no_nfs_sentinel.empty() && FileExists(no_nfs_sentinel)) {
924  boot_error_ = "Cache was used without NFS maps before. "
925  "It has to be wiped out.";
927  return false;
928  }
929 
930  // nfs maps need to be protected by workspace lock
931  PosixCacheManager *posix_cache_mgr =
932  reinterpret_cast<PosixCacheManager *>(cache_mgr_);
933  if (posix_cache_mgr->cache_path() != workspace_) {
934  boot_error_ = "Cache directory and workspace must be identical for "
935  "NFS export";
937  return false;
938  }
939 
940  string inode_cache_dir = nfs_maps_dir_ + "/nfs_maps." + name_;
941  if (!MkdirDeep(inode_cache_dir, 0700)) {
942  boot_error_ = "Failed to initialize NFS maps";
944  return false;
945  }
946 
947  // TODO(jblomer): make this a manager class
948  if (IsHaNfsSource()) {
950  inode_cache_dir,
953  statistics_);
954  } else {
956  inode_cache_dir,
959  statistics_);
960  }
961 
962  if (nfs_maps_ == NULL) {
963  boot_error_ = "Failed to initialize NFS maps";
965  return false;
966  }
967 
968  string optarg;
969  if (options_mgr_->GetValue("CVMFS_NFS_INTERLEAVED_INODES", &optarg)) {
970  vector<string> tokens = SplitString(optarg, '%');
971  if (tokens.size() != 2) {
972  boot_error_ =
973  "invalid format for CVMFS_NFS_INTERLEAVED_INODES: " + optarg;
975  return false;
976  }
978  String2Uint64(tokens[0]));
979  }
980 
981  return true;
982 
983 #else
984  return true;
985 #endif
986 }
987 
988 
991  CacheManager *cache_mgr
992 ) {
993  assert(settings.quota_limit >= 0);
994  int64_t quota_threshold = settings.quota_limit / 2;
995  string cache_workspace = settings.cache_path;
996  if (settings.cache_path != settings.workspace) {
998  "using workspace %s to protect cache database in %s",
999  settings.workspace.c_str(), settings.cache_path.c_str());
1000  cache_workspace += ":" + settings.workspace;
1001  }
1002  PosixQuotaManager *quota_mgr;
1003 
1004  if (settings.is_shared) {
1005  quota_mgr = PosixQuotaManager::CreateShared(
1006  exe_path_,
1007  cache_workspace,
1008  settings.quota_limit,
1009  quota_threshold,
1010  foreground_);
1011  if (quota_mgr == NULL) {
1012  boot_error_ = "Failed to initialize shared lru cache";
1014  return false;
1015  }
1016  } else {
1017  quota_mgr = PosixQuotaManager::Create(
1018  cache_workspace,
1019  settings.quota_limit,
1020  quota_threshold,
1022  if (quota_mgr == NULL) {
1023  boot_error_ = "Failed to initialize lru cache";
1025  return false;
1026  }
1027  }
1028 
1029  if (quota_mgr->GetSize() > quota_mgr->GetCapacity()) {
1031  "cache is already beyond quota size "
1032  "(size: %" PRId64 ", capacity: %" PRId64 "), cleaning up",
1033  quota_mgr->GetSize(), quota_mgr->GetCapacity());
1034  if (!quota_mgr->Cleanup(quota_threshold)) {
1035  delete quota_mgr;
1036  boot_error_ = "Failed to clean up cache";
1038  return false;
1039  }
1040  }
1041 
1042  int retval = cache_mgr->AcquireQuotaManager(quota_mgr);
1043  assert(retval);
1045  "CernVM-FS: quota initialized, current size %luMB",
1046  quota_mgr->GetSize() / (1024 * 1024));
1047  return true;
1048 }
1049 
1050 
1052  // Make sure SQlite starts clean after initialization
1053  sqlite3_shutdown();
1054 
1055  int retval;
1056  retval = sqlite3_config(SQLITE_CONFIG_LOG, FileSystem::LogSqliteError, NULL);
1057  assert(retval == SQLITE_OK);
1058  retval = sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
1059  assert(retval == SQLITE_OK);
1061 
1062  // Disable SQlite3 file locking
1063  retval = sqlite3_vfs_register(sqlite3_vfs_find("unix-none"), 1);
1064  assert(retval == SQLITE_OK);
1065 }
1066 
1067 
1069  string optarg;
1070  // This is very similar to "determine cache dir". It's for backward
1071  // compatibility with classic cache configuration where there was no
1072  // distinction between workspace and cache.
1073  // Complicated cache configurations should explicitly set CVMFS_WORKSPACE.
1075  if (options_mgr_->GetValue("CVMFS_CACHE_BASE", &optarg))
1076  workspace_ = MakeCanonicalPath(optarg);
1077  if (options_mgr_->GetValue("CVMFS_SHARED_CACHE", &optarg) &&
1078  options_mgr_->IsOn(optarg))
1079  {
1080  workspace_ += "/shared";
1081  } else {
1082  workspace_ += "/" + name_;
1083  }
1084  if (options_mgr_->GetValue("CVMFS_CACHE_DIR", &optarg)) {
1085  if (options_mgr_->IsDefined("CVMFS_CACHE_BASE")) {
1086  boot_error_ =
1087  "'CVMFS_CACHE_BASE' and 'CVMFS_CACHE_DIR' are mutually exclusive";
1089  return false;
1090  }
1091  workspace_ = optarg;
1092  }
1093  if (options_mgr_->GetValue("CVMFS_WORKSPACE", &optarg))
1094  workspace_ = optarg;
1096 
1097  // If workspace and alien cache are the same directory, we need to open
1098  // permission now to 0770 to avoid a race when fixing it later
1099  const int mode = 0770;
1100  if (!MkdirDeep(workspace_, mode, false)) {
1101  boot_error_ = "cannot create workspace directory " + workspace_;
1103  return false;
1104  }
1105 
1106  if (!LockWorkspace())
1107  return false;
1108  if (!SetupCwd())
1109  return false;
1110  if (!SetupCrashGuard())
1111  return false;
1112 
1113  return true;
1114 }
1115 
1116 
1119  if (uuid_cache_ == NULL) {
1121  "failed to load/store %s/uuid", workspace_.c_str());
1123  assert(uuid_cache_ != NULL);
1124  }
1125 }
1126 
1127 
1133  if ((cache_mgr_ != NULL) &&
1134  (cache_mgr_->id() == kPosixCacheManager)) {
1135  PosixCacheManager *posix_cache_mgr =
1136  reinterpret_cast<PosixCacheManager *>(cache_mgr_);
1137  posix_cache_mgr->TearDown2ReadOnly();
1138  }
1139 
1140  unlink(path_crash_guard_.c_str());
1141  LogCvmfs(kLogCache, kLogSyslog, "switch to read-only cache mode");
1142  SetLogMicroSyslog("");
1143 }
1144 
1145 
1146 void FileSystem::RemapCatalogFd(int from, int to) {
1147  sqlite::RegisterFdMapping(from, to);
1148 }
1149 
1151  cache_mgr_ = new_cache_mgr;
1152  sqlite::ReplaceCacheManager(new_cache_mgr);
1153 }
1154 
1155 
1158  string instance;
1159  if (options_mgr_->GetValue("CVMFS_CACHE_PRIMARY", &instance) &&
1160  !instance.empty())
1161  {
1162  if (!CheckInstanceName(instance))
1163  return false;
1164  cache_mgr_instance_ = instance;
1165  }
1166 
1168  if (cache_mgr_ == NULL)
1169  return false;
1170 
1171  std::string optarg;
1172  if (options_mgr_->GetValue("CVMFS_STREAMING_CACHE", &optarg) &&
1173  options_mgr_->IsOn(optarg))
1174  {
1175  unsigned nfiles = kDefaultNfiles;
1176  if (options_mgr_->GetValue("CVMFS_NFILES", &optarg))
1177  nfiles = String2Uint64(optarg);
1178  cache_mgr_ = new StreamingCacheManager(nfiles, cache_mgr_, NULL, NULL);
1179  }
1180 
1181  return true;
1182 }
1183 
1184 
1185 //------------------------------------------------------------------------------
1186 
1187 
1188 const char *MountPoint::kDefaultAuthzSearchPath = "/usr/libexec/cvmfs/authz";
1189 const char *MountPoint::kDefaultBlacklist = "/etc/cvmfs/blacklist";
1190 
1192  blacklist_paths_.clear();
1193  string blacklist;
1194  if (!options_mgr_->GetValue("CVMFS_BLACKLIST", &blacklist))
1195  blacklist = kDefaultBlacklist;
1196  blacklist_paths_.push_back(blacklist);
1197 
1198  bool append = false;
1199  if (FileExists(blacklist)) {
1200  if (!signature_mgr_->LoadBlacklist(blacklist, append)) {
1201  boot_error_ = "failed to load blacklist " + blacklist;
1203  return false;
1204  }
1205  append = true;
1206  }
1207 
1208  string config_repository_path;
1209  if (options_mgr_->HasConfigRepository(fqrn_, &config_repository_path)) {
1210  blacklist = config_repository_path + "blacklist";
1211  blacklist_paths_.push_back(blacklist);
1212  if (FileExists(blacklist)) {
1213  if (!signature_mgr_->LoadBlacklist(blacklist, append)) {
1214  boot_error_ = "failed to load blacklist from config repository";
1216  return false;
1217  }
1218  }
1219  }
1220 
1221  return true;
1222 }
1223 
1224 
1230  bool result = true;
1231  bool append = false;
1232  for (unsigned i = 0; i < blacklist_paths_.size(); ++i) {
1233  string blacklist = blacklist_paths_[i];
1234  if (FileExists(blacklist)) {
1235  bool retval = signature_mgr_->LoadBlacklist(blacklist, append);
1236  // TODO(jblomer): this can leave us with a half-loaded blacklist
1237  if (!retval)
1238  return false;
1239  append = true;
1240  }
1241  }
1242  return result;
1243 }
1244 
1254  cache_symlinks_ = false;
1255 }
1256 
1262  fuse_expire_entry_ = true;
1263 }
1264 
1265 
1271  const string &fqrn,
1272  FileSystem *file_system,
1273  OptionsManager *options_mgr)
1274 {
1275  if (options_mgr == NULL)
1276  options_mgr = file_system->options_mgr();
1277  UniquePtr<MountPoint> mountpoint(new MountPoint(
1278  fqrn, file_system, options_mgr));
1279 
1280  // At this point, we have a repository name, the type (fuse or library) and
1281  // an options manager (which can be the same than the FileSystem's one).
1282 
1283  mountpoint->CreateStatistics();
1284  mountpoint->CreateAuthz();
1285  mountpoint->backoff_throttle_ = new BackoffThrottle();
1286 
1287  if (!mountpoint->CreateSignatureManager() || !mountpoint->CheckBlacklists())
1288  return mountpoint.Release();
1289  if (!mountpoint->CreateDownloadManagers())
1290  return mountpoint.Release();
1291  if (file_system->cache_mgr()->id() == kStreamingCacheManager) {
1292  StreamingCacheManager *streaming_cachemgr =
1293  dynamic_cast<StreamingCacheManager *>(file_system->cache_mgr());
1294  streaming_cachemgr->SetRegularDownloadManager(mountpoint->download_mgr());
1295  streaming_cachemgr->SetExternalDownloadManager(
1296  mountpoint->external_download_mgr());
1297  }
1298  if (!mountpoint->CreateResolvConfWatcher()) {
1299  return mountpoint.Release();
1300  }
1301  mountpoint->CreateFetchers();
1302  if (!mountpoint->CreateCatalogManager())
1303  return mountpoint.Release();
1304  if (!mountpoint->CreateTracer())
1305  return mountpoint.Release();
1306 
1307  mountpoint->ReEvaluateAuthz();
1308  mountpoint->CreateTables();
1309  if (!mountpoint->SetupBehavior())
1310  return mountpoint.Release();
1311 
1312  mountpoint->boot_status_ = loader::kFailOk;
1313  return mountpoint.Release();
1314 }
1315 
1316 
1318  string optarg;
1319  string authz_helper;
1320  if (options_mgr_->GetValue("CVMFS_AUTHZ_HELPER", &optarg))
1321  authz_helper = optarg;
1322  string authz_search_path(kDefaultAuthzSearchPath);
1323  if (options_mgr_->GetValue("CVMFS_AUTHZ_SEARCH_PATH", &optarg))
1324  authz_search_path = optarg;
1325 
1327  fqrn_,
1328  authz_helper,
1329  authz_search_path,
1330  options_mgr_);
1331  assert(authz_fetcher_ != NULL);
1332 
1335  statistics_);
1336  assert(authz_session_mgr_ != NULL);
1337 
1339  assert(authz_attachment_ != NULL);
1340 }
1341 
1342 
1344  string optarg;
1345 
1347 
1349  if (!SetupOwnerMaps())
1350  return false;
1351  shash::Any root_hash;
1352  if (!DetermineRootHash(&root_hash))
1353  return false;
1354 
1355  bool retval;
1356  if (root_hash.IsNull()) {
1357  retval = catalog_mgr_->Init();
1358  } else {
1359  fixed_catalog_ = true;
1360  bool alt_root_path =
1361  options_mgr_->GetValue("CVMFS_ALT_ROOT_PATH", &optarg) &&
1362  options_mgr_->IsOn(optarg);
1363  retval = catalog_mgr_->InitFixed(root_hash, alt_root_path);
1364  }
1365  if (!retval) {
1366  boot_error_ = "Failed to initialize root file catalog";
1368  return false;
1369  }
1370 
1372  boot_error_ = "repository revision blacklisted";
1374  return false;
1375  }
1376 
1377  if (options_mgr_->GetValue("CVMFS_AUTO_UPDATE", &optarg) &&
1378  !options_mgr_->IsOn(optarg))
1379  {
1380  fixed_catalog_ = true;
1381  }
1382 
1383  if (options_mgr_->GetValue("CVMFS_CATALOG_WATERMARK", &optarg)) {
1385  } else {
1386  unsigned soft_limit;
1387  unsigned hard_limit;
1388  GetLimitNoFile(&soft_limit, &hard_limit);
1389  catalog_mgr_->SetCatalogWatermark(soft_limit / 4);
1390  }
1391 
1392  if (catalog_mgr_->volatile_flag()) {
1393  LogCvmfs(kLogCvmfs, kLogDebug, "content of repository flagged as VOLATILE");
1394  }
1395 
1396  return true;
1397 }
1398 
1399 
1401  string optarg;
1403  perf::StatisticsTemplate("download", statistics_));
1405 
1406  // must be set before proxy and host chains are being initialized
1407  // error output is handled in SetShardingPolicy
1408  if (options_mgr_->GetValue("CVMFS_PROXY_SHARDING_POLICY", &optarg)) {
1409  if (optarg.compare("EXTERNAL") == 0) {
1412  }
1413  }
1414 
1415  if (options_mgr_->GetValue("CVMFS_FAILOVER_INDEFINITELY", &optarg) &&
1416  options_mgr_->IsOn(optarg)) {
1418  }
1419 
1420  if (options_mgr_->GetValue("CVMFS_SERVER_URL", &optarg)) {
1421  download_mgr_->SetHostChain(optarg);
1422  }
1423 
1424  if (options_mgr_->GetValue("_CVMFS_DEVEL_IGNORE_SIGNATURE_FAILURES", &optarg)
1425  && options_mgr_->IsOn(optarg)) {
1428  "Development option: Activate ignore signature failures during download. "
1429  "DO NOT USE IN PRODUCTION");
1430  }
1431 
1433  SetupHttpTuning();
1434 
1435  string forced_proxy_template;
1436  if (options_mgr_->GetValue("CVMFS_PROXY_TEMPLATE", &optarg))
1437  forced_proxy_template = optarg;
1439  forced_proxy_template);
1440 
1441  string proxies;
1442  if (options_mgr_->GetValue("CVMFS_HTTP_PROXY", &optarg))
1443  proxies = optarg;
1445  proxies,
1446  file_system_->workspace() + "/proxies" + GetUniqFileSuffix(),
1447  download_mgr_);
1448  if (proxies == "") {
1449  boot_error_ = "failed to discover HTTP proxy servers";
1451  return false;
1452  }
1453  string fallback_proxies;
1454  if (options_mgr_->GetValue("CVMFS_FALLBACK_PROXY", &optarg))
1455  fallback_proxies = optarg;
1456  download_mgr_->SetProxyChain(proxies, fallback_proxies,
1458 
1459  bool do_geosort = options_mgr_->GetValue("CVMFS_USE_GEOAPI", &optarg) &&
1460  options_mgr_->IsOn(optarg);
1461  if (do_geosort) {
1463  }
1464  if (options_mgr_->GetValue("CVMFS_MAX_SERVERS", &optarg)) {
1465  unsigned max_servers = String2Uint64(optarg);
1466  std::vector<std::string> host_chain;
1467  download_mgr_->GetHostInfo(&host_chain, NULL, NULL);
1468  if (max_servers > 0 && max_servers < host_chain.size()) {
1469  host_chain.resize(max_servers);
1470  download_mgr_->SetHostChain(host_chain);
1471  }
1472  }
1473 
1474  if (options_mgr_->GetValue("CVMFS_USE_SSL_SYSTEM_CA", &optarg) &&
1475  options_mgr_->IsOn(optarg)) {
1477  }
1478 
1479  if (options_mgr_->GetValue("CVMFS_PROXY_SHARD", &optarg) &&
1480  options_mgr_->IsOn(optarg)) {
1482  }
1483 
1484  // configure http tracing header
1485  if (options_mgr_->GetValue("CVMFS_HTTP_TRACING", &optarg) &&
1486  options_mgr_->IsOn(optarg)) {
1488  if (options_mgr_->GetValue("CVMFS_HTTP_TRACING_HEADERS", &optarg)) {
1489  if (optarg.size() > 1000) {
1491  "CVMFS_HTTP_TRACING_HEADERS too large ( max 1000 chars, given %ld )",
1492  optarg.size());
1493  } else {
1494  std::vector<std::string> tokens = SplitString(optarg, '|');
1495  sanitizer::AlphaNumSanitizer sanitizer;
1496 
1497  for (unsigned int i = 0; i < tokens.size(); i++) {
1498  std::string token = Trim(tokens[i]);
1499 
1500  std::vector<std::string> key_val = SplitString(token, ':');
1501 
1502  if (key_val.size() != 2) {
1504  "Http tracing header: Skipping current token part of "
1505  "CVMFS_HTTP_TRACING_HEADERS! Invalid "
1506  "<key:value> pair. Token: %s", token.c_str());
1507  continue;
1508  }
1509 
1510  std::string prefix = "X-CVMFS-";
1511  std::string key = Trim(key_val[0]);
1512 
1513  if (!sanitizer.IsValid(key)) {
1515  "Http tracing header: Skipping current token part of "
1516  "CVMFS_HTTP_TRACING_HEADERS! Invalid key. Only alphanumeric keys "
1517  "are allowed (a-z, A-Z, 0-9). Token: %s", token.c_str());
1518  continue;
1519  }
1520 
1521  std::string final_token = prefix + key + ": " + Trim(key_val[1]);
1522 
1523  download_mgr_->AddHTTPTracingHeader(final_token);
1524  }
1525  }
1526  }
1527  }
1528 
1529  return SetupExternalDownloadMgr(do_geosort);
1530 }
1531 
1533  std::string roaming_value;
1534  options_mgr_->GetValue("CVMFS_DNS_ROAMING", &roaming_value);
1535  if (options_mgr_->IsDefined("CVMFS_DNS_ROAMING") &&
1536  options_mgr_->IsOn(roaming_value)) {
1538  "DNS roaming is enabled for this repository.");
1539  // Create a file watcher to update the DNS settings of the download
1540  // managers when there are changes to /etc/resolv.conf
1542 
1543  if (resolv_conf_watcher_) {
1544  ResolvConfEventHandler *handler =
1546  resolv_conf_watcher_->RegisterHandler("/etc/resolv.conf", handler);
1547  }
1548  } else {
1550  "DNS roaming is disabled for this repository.");
1551  }
1552  return true;
1553 }
1554 
1556  fetcher_ = new cvmfs::Fetcher(
1558  download_mgr_,
1561 
1566  perf::StatisticsTemplate("fetch-external", statistics_));
1567 }
1568 
1569 
1571  string optarg;
1573  signature_mgr_->Init();
1574 
1575  string public_keys;
1576  if (options_mgr_->GetValue("CVMFS_PUBLIC_KEY", &optarg)) {
1577  public_keys = optarg;
1578  } else if (options_mgr_->GetValue("CVMFS_KEYS_DIR", &optarg)) {
1579  // Collect .pub files from CVMFS_KEYS_DIR
1580  public_keys = JoinStrings(FindFilesBySuffix(optarg, ".pub"), ":");
1581  } else {
1582  public_keys =
1583  JoinStrings(FindFilesBySuffix("/etc/cvmfs/keys", ".pub"), ":");
1584  }
1585 
1586  if (!signature_mgr_->LoadPublicRsaKeys(public_keys)) {
1587  boot_error_ = "failed to load public key(s)";
1589  return false;
1590  }
1591 
1592  if (public_keys.size() > 0) {
1593  LogCvmfs(kLogCvmfs, kLogDebug, "CernVM-FS: using public key(s) %s",
1594  public_keys.c_str());
1595  } else {
1596  LogCvmfs(kLogCvmfs, kLogDebug | kLogSyslogWarn, "no public key loaded");
1597  }
1598 
1599  return true;
1600 }
1601 
1602 
1606  return;
1607 
1608  // TODO(jblomer): this should be registered by the tracker
1609  statistics_->Register("inode_tracker.n_insert",
1610  "overall number of accessed inodes");
1611  statistics_->Register("inode_tracker.n_remove",
1612  "overall number of evicted inodes");
1613  statistics_->Register("inode_tracker.no_reference",
1614  "currently active inodes");
1615  statistics_->Register("inode_tracker.n_hit_inode",
1616  "overall number of inode lookups");
1617  statistics_->Register("inode_tracker.n_hit_path",
1618  "overall number of successful path lookups");
1619  statistics_->Register("inode_tracker.n_miss_path",
1620  "overall number of unsuccessful path lookups");
1621 
1622  statistics_->Register("dentry_tracker.n_insert",
1623  "overall number of added negative cache entries");
1624  statistics_->Register("dentry_tracker.n_remove",
1625  "overall number of evicted negative cache entries");
1626  statistics_->Register("dentry_tracker.n_prune",
1627  "overall number of prune calls");
1628 
1629  statistics_->Register("page_cache_tracker.n_insert",
1630  "overall number of added page cache entries");
1631  statistics_->Register("page_cache_tracker.n_remove",
1632  "overall number of evicted page cache entries");
1633  statistics_->Register("page_cache_tracker.n_open_direct",
1634  "overall number of direct I/O open calls");
1635  statistics_->Register("page_cache_tracker.n_open_flush",
1636  "overall number of open calls where the file's page cache gets flushed");
1637  statistics_->Register("page_cache_tracker.n_open_cached",
1638  "overall number of open calls where the file's page cache is reused");
1639 }
1640 
1641 
1644  // Libcvmfs simplified tables
1647  return;
1648  }
1649 
1650  chunk_tables_ = new ChunkTables();
1651 
1652  string optarg;
1653  uint64_t mem_cache_size = kDefaultMemcacheSize;
1654  if (options_mgr_->GetValue("CVMFS_MEMCACHE_SIZE", &optarg))
1655  mem_cache_size = String2Uint64(optarg) * 1024 * 1024;
1656 
1657  const double memcache_unit_size =
1658  (static_cast<double>(kInodeCacheFactor) * lru::Md5PathCache::GetEntrySize())
1660  const unsigned memcache_num_units =
1661  mem_cache_size / static_cast<unsigned>(memcache_unit_size);
1662  // Number of cache entries must be a multiple of 64
1663  const unsigned mask_64 = ~((1 << 6) - 1);
1664  inode_cache_ = new lru::InodeCache(memcache_num_units & mask_64, statistics_);
1665  path_cache_ = new lru::PathCache(memcache_num_units & mask_64, statistics_);
1666  md5path_cache_ = new lru::Md5PathCache((memcache_num_units * 7) & mask_64,
1667  statistics_);
1668 
1672  if (file_system_->IsNfsSource())
1674 }
1675 
1685  string optarg;
1686  tracer_ = new Tracer();
1687  if (options_mgr_->GetValue("CVMFS_TRACEFILE", &optarg)) {
1689  boot_error_ = "tracer is only supported in the fuse module";
1691  return false;
1692  }
1693  string tracebuffer_file = optarg;
1694  uint64_t tracebuffer_size = kTracerBufferSize;
1695  uint64_t tracebuffer_threshold = kTracerFlushThreshold;
1696 
1697  if (options_mgr_->GetValue("CVMFS_TRACEBUFFER", &optarg)) {
1698  tracebuffer_size = String2Uint64(optarg);
1699  }
1700  if (options_mgr_->GetValue("CVMFS_TRACEBUFFER_THRESHOLD",
1701  &optarg)) {
1702  tracebuffer_threshold = String2Uint64(optarg);
1703  }
1704  assert(tracebuffer_size <= INT_MAX
1705  && tracebuffer_threshold <= INT_MAX);
1707  "Initialising tracer with buffer size %" PRIu64 " and threshold %" PRIu64,
1708  tracebuffer_size, tracebuffer_threshold);
1709  tracer_->Activate(tracebuffer_size, tracebuffer_threshold,
1710  tracebuffer_file);
1711  }
1712  return true;
1713 }
1714 
1715 
1717  string optarg;
1718  if (options_mgr_->GetValue("CVMFS_ROOT_HASH", &optarg)) {
1719  *root_hash = MkFromHexPtr(shash::HexPtr(optarg), shash::kSuffixCatalog);
1720  return true;
1721  }
1722 
1723  if (!options_mgr_->IsDefined("CVMFS_REPOSITORY_TAG") &&
1724  !options_mgr_->IsDefined("CVMFS_REPOSITORY_DATE"))
1725  {
1726  root_hash->SetNull();
1727  return true;
1728  }
1729 
1730  string history_path;
1731  if (!FetchHistory(&history_path))
1732  return false;
1733  UnlinkGuard history_file(history_path);
1735  history::SqliteHistory::Open(history_path));
1736  if (!tag_db.IsValid()) {
1738  "failed to open history database (%s)", history_path.c_str());
1739  boot_error_ = "failed to open history database";
1741  return false;
1742  }
1743 
1745  bool retval;
1746  if (!options_mgr_->GetValue("CVMFS_REPOSITORY_TAG", &repository_tag_)) {
1747  string repository_date;
1748  // options_mgr_->IsDefined("CVMFS_REPOSITORY_DATE") must be true
1749  options_mgr_->GetValue("CVMFS_REPOSITORY_DATE", &repository_date);
1750  time_t repository_utctime = IsoTimestamp2UtcTime(repository_date);
1751  if (repository_utctime == 0) {
1752  boot_error_ = "invalid timestamp in CVMFS_REPOSITORY_DATE: " +
1753  repository_date + ". Use YYYY-MM-DDTHH:MM:SSZ";
1755  return false;
1756  }
1757  retval = tag_db->GetByDate(repository_utctime, &tag);
1758  if (!retval) {
1759  boot_error_ = "no repository state as early as utc timestamp " +
1760  StringifyTime(repository_utctime, true);
1762  return false;
1763  }
1765  "time stamp %s UTC resolved to tag '%s'",
1766  StringifyTime(repository_utctime, true).c_str(),
1767  tag.name.c_str());
1768  repository_tag_ = tag.name;
1769  } else {
1770  retval = tag_db->GetByName(repository_tag_, &tag);
1771  if (!retval) {
1772  boot_error_ = "no such tag: " + repository_tag_;
1774  return false;
1775  }
1776  }
1777  LogCvmfs(kLogCvmfs, kLogDebug, "mounting tag %s", tag.name.c_str());
1778 
1779  *root_hash = tag.root_hash;
1780  return true;
1781 }
1782 
1783 
1784 bool MountPoint::FetchHistory(std::string *history_path) {
1785  manifest::Failures retval_mf;
1786  manifest::ManifestEnsemble ensemble;
1787  retval_mf = manifest::Fetch("", fqrn_, 0, NULL, signature_mgr_, download_mgr_,
1788  &ensemble);
1789  if (retval_mf != manifest::kFailOk) {
1790  boot_error_ = "Failed to fetch manifest";
1792  return false;
1793  }
1794  shash::Any history_hash = ensemble.manifest->history();
1795  if (history_hash.IsNull()) {
1796  boot_error_ = "No history";
1798  return false;
1799  }
1800 
1801  CacheManager::Label label;
1803  label.path = fqrn_;
1804  int fd = fetcher_->Fetch(CacheManager::LabeledObject(history_hash, label));
1805  if (fd < 0) {
1806  boot_error_ = "failed to download history: " + StringifyInt(-fd);
1808  return false;
1809  }
1810  // We have the custom sqlite vfs driver installed
1811  *history_path = "@" + StringifyInt(fd);
1812  return true;
1813 }
1814 
1815 
1817  unsigned max_ttl;
1818  {
1819  MutexLockGuard lock_guard(lock_max_ttl_);
1820  max_ttl = max_ttl_sec_;
1821  }
1822  const unsigned catalog_ttl_sec = catalog_mgr_->GetTTL();
1823 
1824  return max_ttl ? std::min(max_ttl, catalog_ttl_sec) : catalog_ttl_sec;
1825 }
1826 
1827 
1829  MutexLockGuard lock_guard(lock_max_ttl_);
1830  return max_ttl_sec_ / 60;
1831 }
1832 
1833 
1839  return "." + file_system_->name() + "-" + fqrn_;
1840 }
1841 
1842 
1844  const string &fqrn,
1845  FileSystem *file_system,
1846  OptionsManager *options_mgr)
1847  : fqrn_(fqrn)
1848  , uuid_(cvmfs::Uuid::Create(""))
1849  , file_system_(file_system)
1850  , options_mgr_(options_mgr)
1851  , statistics_(NULL)
1852  , telemetry_aggr_(NULL)
1853  , authz_fetcher_(NULL)
1854  , authz_session_mgr_(NULL)
1855  , authz_attachment_(NULL)
1856  , backoff_throttle_(NULL)
1857  , signature_mgr_(NULL)
1858  , download_mgr_(NULL)
1859  , external_download_mgr_(NULL)
1860  , fetcher_(NULL)
1861  , external_fetcher_(NULL)
1862  , inode_annotation_(NULL)
1863  , catalog_mgr_(NULL)
1864  , chunk_tables_(NULL)
1865  , simple_chunk_tables_(NULL)
1866  , inode_cache_(NULL)
1867  , path_cache_(NULL)
1868  , md5path_cache_(NULL)
1869  , tracer_(NULL)
1870  , inode_tracker_(NULL)
1871  , dentry_tracker_(NULL)
1872  , page_cache_tracker_(NULL)
1873  , statfs_cache_(NULL)
1874  , resolv_conf_watcher_(NULL)
1875  , max_ttl_sec_(kDefaultMaxTtlSec)
1876  , kcache_timeout_sec_(static_cast<double>(kDefaultKCacheTtlSec))
1877  , fixed_catalog_(false)
1878  , enforce_acls_(false)
1879  , cache_symlinks_(false)
1880  , fuse_expire_entry_(false)
1881  , has_membership_req_(false)
1882  , talk_socket_path_(std::string("./cvmfs_io.") + fqrn)
1883  , talk_socket_uid_(0)
1884  , talk_socket_gid_(0)
1885 {
1886  int retval = pthread_mutex_init(&lock_max_ttl_, NULL);
1887  assert(retval == 0);
1888 }
1889 
1890 
1892  pthread_mutex_destroy(&lock_max_ttl_);
1893 
1894  delete page_cache_tracker_;
1895  delete dentry_tracker_;
1896  delete inode_tracker_;
1897  delete tracer_;
1898  delete md5path_cache_;
1899  delete path_cache_;
1900  delete inode_cache_;
1901  delete simple_chunk_tables_;
1902  delete chunk_tables_;
1903 
1904  delete catalog_mgr_;
1905  delete inode_annotation_;
1906  delete external_fetcher_;
1907  delete fetcher_;
1908 
1909  delete external_download_mgr_;
1910  delete download_mgr_;
1911 
1912  if (signature_mgr_ != NULL) {
1913  signature_mgr_->Fini();
1914  delete signature_mgr_;
1915  }
1916 
1917  if (resolv_conf_watcher_ != NULL) {
1919  delete resolv_conf_watcher_;
1920  }
1921 
1922  delete backoff_throttle_;
1923  delete authz_attachment_;
1924  delete authz_session_mgr_;
1925  delete authz_fetcher_;
1926  delete telemetry_aggr_;
1927  delete statistics_;
1928  delete uuid_;
1929 
1930  delete statfs_cache_;
1931 }
1932 
1933 
1935  string old_membership_req = membership_req_;
1937  if (old_membership_req != membership_req_) {
1940  }
1941 }
1942 
1943 
1944 void MountPoint::SetMaxTtlMn(unsigned value_minutes) {
1945  MutexLockGuard lock_guard(lock_max_ttl_);
1946  max_ttl_sec_ = value_minutes * 60;
1947 }
1948 
1950  string optarg;
1951 
1952  if (options_mgr_->GetValue("CVMFS_MAX_TTL", &optarg))
1953  SetMaxTtlMn(String2Uint64(optarg));
1954 
1955  if (options_mgr_->GetValue("CVMFS_KCACHE_TIMEOUT", &optarg)) {
1956  // Can be negative and should then be interpreted as 0.0
1958  std::max(0.0, static_cast<double>(String2Int64(optarg)));
1959  }
1960  LogCvmfs(kLogCvmfs, kLogDebug, "kernel caches expire after %d seconds",
1961  static_cast<int>(kcache_timeout_sec_));
1962 
1963  uint64_t statfs_time_cache_valid = 0;
1964  if (options_mgr_->GetValue("CVMFS_STATFS_CACHE_TIMEOUT", &optarg)) {
1965  statfs_time_cache_valid = static_cast<uint64_t>(String2Uint64(optarg));
1966  }
1967  LogCvmfs(kLogCvmfs, kLogDebug, "statfs cache expires after %d seconds",
1968  static_cast<int>(statfs_time_cache_valid));
1969  statfs_cache_ = new StatfsCache(statfs_time_cache_valid);
1970 
1971  MagicXattrManager::EVisibility xattr_visibility =
1973  if (options_mgr_->GetValue("CVMFS_HIDE_MAGIC_XATTRS", &optarg)) {
1974  if (options_mgr_->IsOn(optarg))
1975  xattr_visibility = MagicXattrManager::kVisibilityNever;
1976  else if (options_mgr_->IsOff(optarg))
1977  xattr_visibility = MagicXattrManager::kVisibilityAlways;
1978  }
1979  if (options_mgr_->GetValue("CVMFS_MAGIC_XATTRS_VISIBILITY", &optarg)) {
1980  if (ToUpper(optarg) == "ROOTONLY") {
1981  xattr_visibility = MagicXattrManager::kVisibilityRootOnly;
1982  } else if (ToUpper(optarg) == "NEVER") {
1983  xattr_visibility = MagicXattrManager::kVisibilityNever;
1984  } else if (ToUpper(optarg) == "ALWAYS") {
1985  xattr_visibility = MagicXattrManager::kVisibilityAlways;
1986  } else {
1988  "unsupported setting: CVMFS_MAGIC_XATTRS_VISIBILITY=%s",
1989  optarg.c_str());
1990  }
1991  }
1992 
1993  std::set<gid_t> protected_xattr_gids;
1994  if (options_mgr_->GetValue("CVMFS_XATTR_PRIVILEGED_GIDS", &optarg)) {
1995  std::vector<string> tmp = SplitString(optarg, ',');
1996 
1997  for (size_t i = 0; i < tmp.size(); i++) {
1998  std::string trimmed = Trim(tmp[i]);
2000  "Privileged gid for xattr added: %s", trimmed.c_str());
2001  protected_xattr_gids.insert(static_cast<gid_t>(String2Uint64(trimmed)));
2002  }
2003  }
2004  std::set<std::string> protected_xattrs;
2005  if (options_mgr_->GetValue("CVMFS_XATTR_PROTECTED_XATTRS", &optarg)) {
2006  std::vector<string> tmp = SplitString(optarg, ',');
2007 
2008  for (size_t i = 0; i < tmp.size(); i++) {
2009  std::string trimmed = Trim(tmp[i]);
2011  "Protected xattr added: %s", trimmed.c_str());
2012  protected_xattrs.insert(trimmed);
2013  }
2014 
2015  // root has always access to xattr
2016  if (protected_xattr_gids.count(0) < 1) {
2017  protected_xattr_gids.insert(0);
2019  "Automatically added root to have access to protected xattrs.");
2020  }
2021  }
2022  magic_xattr_mgr_ = new MagicXattrManager(this, xattr_visibility,
2023  protected_xattrs, protected_xattr_gids);
2024 
2025 
2026  if (options_mgr_->GetValue("CVMFS_ENFORCE_ACLS", &optarg)
2027  && options_mgr_->IsOn(optarg))
2028  {
2029  enforce_acls_ = true;
2030  }
2031 
2032  if (options_mgr_->GetValue("CVMFS_CACHE_SYMLINKS", &optarg)
2033  && options_mgr_->IsOn(optarg))
2034  {
2035  cache_symlinks_ = true;
2036  }
2037 
2038 
2039 
2040  if (options_mgr_->GetValue("CVMFS_TALK_SOCKET", &optarg)) {
2041  talk_socket_path_ = optarg;
2042  }
2043  if (options_mgr_->GetValue("CVMFS_TALK_OWNER", &optarg)) {
2044  bool retval = GetUidOf(optarg, &talk_socket_uid_, &talk_socket_gid_);
2045  if (!retval) {
2046  boot_error_ = "unknown owner of cvmfs_talk socket: " + optarg;
2048  return false;
2049  }
2050  }
2051 
2052  // this can be later be changed to switch through different
2053  // telemetryAggregators
2054  if (options_mgr_->GetValue("CVMFS_TELEMETRY_SEND", &optarg)
2055  && options_mgr_->IsOn(optarg)) {
2056  int telemetry_send_rate_sec = kDefaultTelemetrySendRateSec;
2057  if (options_mgr_->GetValue("CVMFS_TELEMETRY_RATE", &optarg)) {
2058  telemetry_send_rate_sec = static_cast<int>(String2Uint64(optarg));
2059 
2060  // minimum send rate: 5sec
2061  if (telemetry_send_rate_sec < kMinimumTelemetrySendRateSec) {
2062  telemetry_send_rate_sec = kMinimumTelemetrySendRateSec;
2063  }
2064 
2066  telemetry_send_rate_sec,
2067  options_mgr_,
2068  fqrn_,
2071  "Enable telemetry to report every %d seconds",
2072  telemetry_send_rate_sec);
2073  }
2074  }
2075 
2076  return true;
2077 }
2078 
2079 
2085  string optarg;
2086  unsigned dns_timeout_ms = download::DownloadManager::kDnsDefaultTimeoutMs;
2087  unsigned dns_retries = download::DownloadManager::kDnsDefaultRetries;
2088  if (options_mgr_->GetValue("CVMFS_DNS_TIMEOUT", &optarg))
2089  dns_timeout_ms = String2Uint64(optarg) * 1000;
2090  if (options_mgr_->GetValue("CVMFS_DNS_RETRIES", &optarg))
2091  dns_retries = String2Uint64(optarg);
2092  manager->SetDnsParameters(dns_retries, dns_timeout_ms);
2093 
2094  // Rest has to be after SetDnsParameters because SetDnsParameters might
2095  // construct a new resolver object
2096 
2097  unsigned dns_min_ttl = dns::Resolver::kDefaultMinTtl;
2098  unsigned dns_max_ttl = dns::Resolver::kDefaultMaxTtl;
2099  if (options_mgr_->GetValue("CVMFS_DNS_MIN_TTL", &optarg))
2100  dns_min_ttl = String2Uint64(optarg);
2101  if (options_mgr_->GetValue("CVMFS_DNS_MAX_TTL", &optarg))
2102  dns_max_ttl = String2Uint64(optarg);
2103  manager->SetDnsTtlLimits(dns_min_ttl, dns_max_ttl);
2104 
2105  if (options_mgr_->GetValue("CVMFS_DNS_SERVER", &optarg)) {
2106  download_mgr_->SetDnsServer(optarg);
2107  }
2108 
2109  if (options_mgr_->GetValue("CVMFS_IPFAMILY_PREFER", &optarg)) {
2110  switch (String2Int64(optarg)) {
2111  case 4:
2113  break;
2114  case 6:
2116  break;
2117  }
2118  }
2119  if (options_mgr_->GetValue("CVMFS_MAX_IPADDR_PER_PROXY", &optarg))
2120  manager->SetMaxIpaddrPerProxy(String2Uint64(optarg));
2121 }
2122 
2123 
2125  string optarg;
2127  download_mgr_->Clone(perf::StatisticsTemplate("download-external",
2128  statistics_), "external");
2129 
2130  unsigned timeout;
2131  unsigned timeout_direct;
2132  download_mgr_->GetTimeout(&timeout, &timeout_direct);
2133  if (options_mgr_->GetValue("CVMFS_EXTERNAL_TIMEOUT", &optarg)) {
2134  timeout = String2Uint64(optarg);
2135  }
2136  if (options_mgr_->GetValue("CVMFS_EXTERNAL_TIMEOUT_DIRECT", &optarg)) {
2137  timeout_direct = String2Uint64(optarg);
2138  }
2139  external_download_mgr_->SetTimeout(timeout, timeout_direct);
2140 
2141  if (options_mgr_->GetValue("CVMFS_EXTERNAL_URL", &optarg)) {
2143  if (dogeosort) {
2144  std::vector<std::string> host_chain;
2145  external_download_mgr_->GetHostInfo(&host_chain, NULL, NULL);
2146  download_mgr_->GeoSortServers(&host_chain);
2147  external_download_mgr_->SetHostChain(host_chain);
2148  }
2149  } else {
2151  }
2152 
2153  if (options_mgr_->GetValue("CVMFS_EXTERNAL_MAX_SERVERS", &optarg)) {
2154  unsigned max_servers = String2Uint64(optarg);
2155  std::vector<std::string> host_chain;
2156  external_download_mgr_->GetHostInfo(&host_chain, NULL, NULL);
2157  if (max_servers > 0 && max_servers < host_chain.size()) {
2158  host_chain.resize(max_servers);
2159  external_download_mgr_->SetHostChain(host_chain);
2160  }
2161  }
2162 
2163  string proxies = "DIRECT";
2164  if (options_mgr_->GetValue("CVMFS_EXTERNAL_HTTP_PROXY", &optarg)) {
2166  optarg,
2167  file_system_->workspace() + "/proxies-external" + GetUniqFileSuffix(),
2169  if (proxies == "") {
2170  boot_error_ = "failed to discover external HTTP proxy servers";
2172  return false;
2173  }
2174  }
2175  string fallback_proxies;
2176  if (options_mgr_->GetValue("CVMFS_EXTERNAL_FALLBACK_PROXY", &optarg))
2177  fallback_proxies = optarg;
2179  proxies, fallback_proxies, download::DownloadManager::kSetProxyBoth);
2180 
2181  return true;
2182 }
2183 
2184 
2186  string optarg;
2187 
2188  // TODO(jblomer): avoid double default settings
2189 
2190  unsigned timeout = kDefaultTimeoutSec;
2191  unsigned timeout_direct = kDefaultTimeoutSec;
2192  if (options_mgr_->GetValue("CVMFS_TIMEOUT", &optarg))
2193  timeout = String2Uint64(optarg);
2194  if (options_mgr_->GetValue("CVMFS_TIMEOUT_DIRECT", &optarg))
2195  timeout_direct = String2Uint64(optarg);
2196  download_mgr_->SetTimeout(timeout, timeout_direct);
2197 
2198  unsigned max_retries = kDefaultRetries;
2199  unsigned backoff_init = kDefaultBackoffInitMs;
2200  unsigned backoff_max = kDefaultBackoffMaxMs;
2201  if (options_mgr_->GetValue("CVMFS_MAX_RETRIES", &optarg))
2202  max_retries = String2Uint64(optarg);
2203  if (options_mgr_->GetValue("CVMFS_BACKOFF_INIT", &optarg))
2204  backoff_init = String2Uint64(optarg) * 1000;
2205  if (options_mgr_->GetValue("CVMFS_BACKOFF_MAX", &optarg))
2206  backoff_max = String2Uint64(optarg) * 1000;
2207  download_mgr_->SetRetryParameters(max_retries, backoff_init, backoff_max);
2208 
2209  if (options_mgr_->GetValue("CVMFS_LOW_SPEED_LIMIT", &optarg))
2211  if (options_mgr_->GetValue("CVMFS_PROXY_RESET_AFTER", &optarg))
2213  if (options_mgr_->GetValue("CVMFS_HOST_RESET_AFTER", &optarg))
2215 
2216  if (options_mgr_->GetValue("CVMFS_FOLLOW_REDIRECTS", &optarg) &&
2217  options_mgr_->IsOn(optarg))
2218  {
2220  }
2221  if (options_mgr_->GetValue("CVMFS_SEND_INFO_HEADER", &optarg) &&
2222  options_mgr_->IsOn(optarg))
2223  {
2225  }
2226 }
2227 
2228 
2230  string optarg;
2231 
2232  if (file_system_->IsNfsSource()) {
2234  } else {
2236  }
2237  if (options_mgr_->GetValue("CVMFS_INITIAL_GENERATION", &optarg)) {
2239  }
2240 
2243  }
2244 }
2245 
2246 
2248  string optarg;
2249  catalog::OwnerMap uid_map;
2250  catalog::OwnerMap gid_map;
2251 
2252  if (options_mgr_->GetValue("CVMFS_UID_MAP", &optarg)) {
2253  if (!uid_map.Read(optarg)) {
2254  boot_error_ = "failed to parse uid map " + optarg;
2256  return false;
2257  }
2258  }
2259  if (options_mgr_->GetValue("CVMFS_GID_MAP", &optarg)) {
2260  if (!gid_map.Read(optarg)) {
2261  boot_error_ = "failed to parse gid map " + optarg;
2263  return false;
2264  }
2265  }
2266  catalog_mgr_->SetOwnerMaps(uid_map, gid_map);
2267 
2268  // TODO(jblomer): make local to catalog manager
2269  if (options_mgr_->GetValue("CVMFS_CLAIM_OWNERSHIP", &optarg) &&
2270  options_mgr_->IsOn(optarg))
2271  {
2272  g_claim_ownership = true;
2273  }
2274  if (options_mgr_->GetValue("CVMFS_WORLD_READABLE", &optarg) &&
2275  options_mgr_->IsOn(optarg))
2276  {
2277  g_world_readable = true;
2278  }
2279 
2280 
2281 
2282  return true;
2283 }
perf::Counter * n_eio_07_
Definition: mountpoint.h:353
IoErrorInfo io_error_info_
Definition: mountpoint.h:355
OptionsManager * options_mgr()
Definition: mountpoint.h:247
std::string exe_path()
Definition: mountpoint.h:207
static const unsigned kDnsDefaultTimeoutMs
Definition: download.h:155
bool GetVOMSAuthz(std::string *authz) const
void SetLogSyslogFacility(const int local_facility)
Definition: logging.cc:183
FileSystem * file_system_
Definition: mountpoint.h:627
Counter * Register(const std::string &name, const std::string &desc)
Definition: statistics.cc:160
void SetCounter(perf::Counter *c)
Definition: mountpoint.cc:97
void RegisterFdMapping(int from, int to)
Definition: sqlitevfs.cc:541
std::string nfs_maps_dir_
Definition: mountpoint.h:412
void SetLogSyslogLevel(const int level)
Definition: logging.cc:151
bool IsNull() const
Definition: hash.h:383
bool foreground_
Definition: mountpoint.h:330
void Activate(const int buffer_size, const int flush_threshold, const std::string &trace_file)
Definition: tracer.cc:25
download::DownloadManager * download_mgr_
Definition: repository.h:141
struct stat64 platform_stat64
perf::Counter * n_eio_08_
Definition: mountpoint.h:354
Log2Histogram * hist_fs_forget_multi_
Definition: mountpoint.h:360
perf::Counter * n_fs_statfs_cached_
Definition: mountpoint.h:339
static FileWatcher * Create()
Definition: file_watcher.cc:44
void SetupInodeAnnotation()
Definition: mountpoint.cc:2229
bool SetupCwd()
Definition: mountpoint.cc:834
catalog::InodeAnnotation * inode_annotation_
Definition: mountpoint.h:644
static NfsMapsSqlite * Create(const std::string &db_dir, const uint64_t root_inode, const bool rebuild, perf::Statistics *statistics_)
void TearDown2ReadOnly()
Definition: cache_posix.cc:613
std::string workspace_fullpath_
Definition: mountpoint.h:382
bool DetermineNfsMode()
Definition: mountpoint.cc:378
static SqliteHistory * Open(const std::string &file_name)
void SetHostChain(const std::string &host_list)
static const unsigned kTracerFlushThreshold
Definition: mountpoint.h:589
virtual uint64_t GetSize()
Definition: quota_posix.cc:721
static Publisher * Create(const SettingsPublisher &settings)
uid_t talk_socket_uid_
Definition: mountpoint.h:675
void SetLowSpeedLimit(const unsigned low_speed_limit)
Definition: download.cc:2057
perf::Counter * n_fs_stat_stale_
Definition: mountpoint.h:337
Log2Histogram * hist_fs_opendir_
Definition: mountpoint.h:363
bool LockWorkspace()
Definition: mountpoint.cc:501
bool CreateTracer()
Definition: mountpoint.cc:1684
bool wait_workspace_
Definition: mountpoint.h:329
virtual bool Cleanup(const uint64_t leave_size)
Definition: quota_posix.cc:125
double kcache_timeout_sec_
Definition: mountpoint.h:662
signature::SignatureManager * signature_mgr_
Definition: mountpoint.h:639
void CreateFile(const std::string &path, const int mode, const bool ignore_failure)
Definition: posix.cc:280
perf::Counter * n_fs_lookup_
Definition: mountpoint.h:334
std::string name
Definition: history.h:88
AuthzSessionManager * authz_session_mgr_
Definition: mountpoint.h:636
static const unsigned kDefaultRetries
Definition: mountpoint.h:582
string Trim(const string &raw, bool trim_newline)
Definition: string.cc:428
string JoinStrings(const vector< string > &strings, const string &joint)
Definition: string.cc:325
perf::Statistics * statistics_
Definition: mountpoint.h:356
download::DownloadManager * download_mgr_
Definition: mountpoint.h:640
static const unsigned kDefaultTimeoutSec
Definition: mountpoint.h:581
std::string exe_path_
Definition: mountpoint.h:323
bool CheckInstanceName(const std::string &instance)
Definition: mountpoint.cc:109
perf::Statistics * statistics_
Definition: mountpoint.h:633
Log2Histogram * hist_fs_readlink_
Definition: mountpoint.h:362
static void SetupLoggingStandalone(const OptionsManager &options_mgr, const std::string &prefix)
Definition: mountpoint.cc:869
void SetProxyChain(const std::string &proxy_list, const std::string &fallback_proxy_list, const ProxySetModes set_mode)
Definition: download.cc:2593
std::string fqrn() const
Definition: mountpoint.h:512
static NfsMapsLeveldb * Create(const std::string &leveldb_dir, const uint64_t root_inode, const bool rebuild, perf::Statistics *statistics)
gid_t talk_socket_gid_
Definition: mountpoint.h:676
void SetupSqlite()
Definition: mountpoint.cc:1051
perf::Counter * n_eio_total_
Definition: mountpoint.h:346
bool IsOn(const std::string &param_value) const
Definition: options.cc:409
std::string GetUniqFileSuffix()
Definition: mountpoint.cc:1838
StatfsCache * statfs_cache_
Definition: mountpoint.h:656
download::DownloadManager * external_download_mgr_
Definition: mountpoint.h:641
MagicXattrManager * magic_xattr_mgr_
Definition: mountpoint.h:655
bool fuse_expire_entry_
Definition: mountpoint.h:666
CacheManager * SetupCacheMgr(const std::string &instance)
Definition: mountpoint.cc:619
const SettingsPublisher & settings() const
Definition: repository.h:317
perf::Statistics * statistics_
Definition: repository.h:139
void SetupHttpTuning()
Definition: mountpoint.cc:2185
static const char * kDefaultBlacklist
Definition: mountpoint.h:590
virtual bool AcquireQuotaManager(QuotaManager *quota_mgr)
Definition: cache_extern.cc:85
unsigned max_ttl_sec_
Definition: mountpoint.h:660
static const unsigned kDefaultMaxTtl
Definition: dns.h:182
bool CreateDownloadManagers()
Definition: mountpoint.cc:1400
std::string talk_socket_path_
Definition: mountpoint.h:674
perf::Counter * n_fs_stat_
Definition: mountpoint.h:336
perf::Counter * n_eio_05_
Definition: mountpoint.h:351
perf::Counter * no_open_files_
Definition: mountpoint.h:344
assert((mem||(size==0))&&"Out Of Memory")
void ReplaceCacheManager(CacheManager *new_cache_mgr)
Definition: sqlitevfs.cc:546
static const int kLabelHistory
Definition: cache.h:87
void SetupLogging()
Definition: mountpoint.cc:891
static void SetupGlobalEnvironmentParams()
Definition: mountpoint.cc:864
int fd_workspace_lock_
Definition: mountpoint.h:383
void CreateStatistics()
Definition: mountpoint.cc:1603
bool UnregisterVfsRdOnly()
Definition: sqlitevfs.cc:522
CacheManager * SetupRamCacheMgr(const std::string &instance)
Definition: mountpoint.cc:722
bool cache_symlinks_
Definition: mountpoint.h:665
static void LogSqliteError(void *user_data __attribute__((unused)), int sqlite_extended_error, const char *message)
Definition: mountpoint.cc:532
static void CleanupInstance()
Definition: sqlitemem.cc:170
void EnableFuseExpireEntry()
Definition: mountpoint.cc:1261
static const unsigned kNfsMaps
Definition: mountpoint.h:182
std::string workspace_
Definition: mountpoint.h:376
string StringifyTime(const time_t seconds, const bool utc)
Definition: string.cc:105
PosixCacheSettings DeterminePosixCacheSettings(const std::string &instance)
Definition: mountpoint.cc:294
void SetDnsServer(const std::string &address)
Definition: download.cc:1985
int platform_stat(const char *path, platform_stat64 *buf)
void AssignGlobalArenas()
Definition: sqlitemem.cc:137
DownloadManager * Clone(const perf::StatisticsTemplate &statistics, const std::string &cloned_name)
Definition: download.cc:2997
bool has_membership_req_
Definition: mountpoint.h:672
virtual CacheManagerIds id()=0
void SetLogMicroSyslog(const std::string &filename)
Definition: logging.cc:272
bool IsOff(const std::string &param_value) const
Definition: options.cc:416
perf::Counter * n_eio_01_
Definition: mountpoint.h:347
void ReEvaluateAuthz()
Definition: mountpoint.cc:1934
bool HasConfigRepository(const std::string &fqrn, std::string *config_path)
Definition: options.cc:256
std::set< std::string > constructed_instances_
Definition: mountpoint.h:411
bool DetermineRootHash(shash::Any *root_hash)
Definition: mountpoint.cc:1716
#define SetLogDebugFile(filename)
void SetTimeout(const unsigned seconds_proxy, const unsigned seconds_direct)
Definition: download.cc:2043
bool CreateCatalogManager()
Definition: mountpoint.cc:1343
struct cvmcache_object_info __attribute__
Definition: atomic.h:24
void RemapCatalogFd(int from, int to)
Definition: mountpoint.cc:1146
static const unsigned kNfsNone
Definition: mountpoint.h:178
std::string path_crash_guard_
Definition: mountpoint.h:389
IntegerMap< uint64_t > OwnerMap
Definition: catalog.h:41
catalog::WritableCatalogManager * catalog_mgr_
Definition: repository.h:385
bool SetupWorkspace()
Definition: mountpoint.cc:1068
static const char * kDefaultAuthzSearchPath
Definition: mountpoint.h:573
Type type()
Definition: mountpoint.h:249
FileSystem(const FileSystemInfo &fs_info)
Definition: mountpoint.cc:400
static const unsigned kLibPathCacheSize
Definition: mountpoint.h:561
void SetFqrn(const std::string &fqrn)
Definition: download.h:219
std::string boot_error_
Definition: mountpoint.h:88
OptionsManager * options_mgr_
Definition: mountpoint.h:631
Log2Histogram * hist_fs_getattr_
Definition: mountpoint.h:361
bool IsValid(const std::string &input) const
Definition: sanitizer.cc:114
Log2Histogram * hist_fs_releasedir_
Definition: mountpoint.h:364
Definition: tracer.h:35
bool FileExists(const std::string &path)
Definition: posix.cc:802
void ReplaceCacheManager(CacheManager *new_cache_mgr)
Definition: mountpoint.cc:1150
void DisableCacheSymlinks()
Definition: mountpoint.cc:1253
void SetDnsTtlLimits(const unsigned min_seconds, const unsigned max_seconds)
Definition: download.cc:2022
std::string cache_path()
Definition: cache_posix.h:107
perf::Counter * n_fs_readlink_
Definition: mountpoint.h:341
uint64_t platform_memsize()
int64_t String2Int64(const string &value)
Definition: string.cc:222
void SetMaxTtlMn(unsigned value_minutes)
Definition: mountpoint.cc:1944
string ToUpper(const string &mixed_case)
Definition: string.cc:476
static const unsigned kDefaultBackoffInitMs
Definition: mountpoint.h:583
perf::Counter * n_fs_forget_
Definition: mountpoint.h:342
MountPoint(const std::string &fqrn, FileSystem *file_system, OptionsManager *options_mgr)
Definition: mountpoint.cc:1843
void GetLimitNoFile(unsigned *soft_limit, unsigned *hard_limit)
Definition: posix.cc:1491
Tracer * tracer_
Definition: mountpoint.h:651
static TelemetryAggregator * Create(Statistics *statistics, int send_rate, OptionsManager *options_mgr, const std::string &fqrn, const TelemetrySelector type)
void SetProxyGroupResetDelay(const unsigned seconds)
Definition: download.cc:2907
static CacheManager * Create(CacheManager *upper_cache, CacheManager *lower_cache)
static bool g_alive
Definition: mountpoint.h:257
static const unsigned kDefaultNumConnections
Definition: mountpoint.h:577
void Set(const int64_t val)
Definition: statistics.h:33
void TearDown2ReadOnly()
Definition: mountpoint.cc:1132
gid_t g_gid
Definition: globals.cc:14
uuid_t uuid
Definition: uuid.h:41
static const unsigned kNfsMapsHa
Definition: mountpoint.h:186
lru::Md5PathCache * md5path_cache_
Definition: mountpoint.h:650
std::string name_
Definition: mountpoint.h:322
vector< string > SplitString(const string &str, char delim)
Definition: string.cc:290
std::string Dump()
Definition: options.cc:454
bool RegisterVfsRdOnly(CacheManager *cache_mgr, perf::Statistics *statistics, const VfsOptions options)
Definition: sqlitevfs.cc:453
static AuthzSessionManager * Create(AuthzFetcher *authz_fetcher, perf::Statistics *statistics)
std::string membership_req_
Definition: mountpoint.h:671
glue::DentryTracker * dentry_tracker_
Definition: mountpoint.h:653
int Fetch(const CacheManager::LabeledObject &object, const std::string &alt_url="")
Definition: fetch.cc:81
perf::Counter * n_fs_read_
Definition: mountpoint.h:340
signature::SignatureManager * signature_mgr_
Definition: repository.h:140
perf::Counter * n_eio_06_
Definition: mountpoint.h:352
static const char * kDefaultCacheMgrInstance
Definition: mountpoint.h:261
bool HasSuffix(const std::string &str, const std::string &suffix, const bool ignore_case)
Definition: string.cc:281
virtual uint64_t GetCapacity()
Definition: quota_posix.cc:626
glue::PageCacheTracker * page_cache_tracker_
Definition: mountpoint.h:654
bool SetShardingPolicy(const ShardingPolicySelector type)
Definition: download.cc:2978
bool found_previous_crash_
Definition: mountpoint.h:395
const char kSuffixCatalog
Definition: hash.h:54
loader::Failures boot_status_
Definition: mountpoint.h:87
Failures Fetch(const std::string &base_url, const std::string &repository_name, const uint64_t minimum_timestamp, const shash::Any *base_catalog, signature::SignatureManager *signature_manager, download::DownloadManager *download_manager, ManifestEnsemble *ensemble)
bool TriageCacheMgr()
Definition: mountpoint.cc:1156
bool CheckPosixCacheSettings(const PosixCacheSettings &settings)
Definition: mountpoint.cc:126
perf::TelemetryAggregator * telemetry_aggr_
Definition: mountpoint.h:634
perf::Counter * n_fs_inode_replace_
Definition: mountpoint.h:343
bool IsNfsSource()
Definition: mountpoint.h:195
ChunkTables * chunk_tables_
Definition: mountpoint.h:646
CacheManager * cache_mgr()
Definition: mountpoint.h:205
uid_t g_uid
Definition: globals.cc:13
void SetupDnsTuning(download::DownloadManager *manager)
Definition: mountpoint.cc:2084
cvmfs::Uuid * uuid_cache_
Definition: mountpoint.h:422
unsigned GetEffectiveTtlSec()
Definition: mountpoint.cc:1816
int TryLockFile(const std::string &path)
Definition: posix.cc:924
bool MkdirDeep(const std::string &path, const mode_t mode, bool verify_writable)
Definition: posix.cc:857
int LockFile(const std::string &path)
Definition: posix.cc:982
void SetIpPreference(const dns::IpPreference preference)
Definition: download.cc:2032
static const unsigned kDefaultBackoffMaxMs
Definition: mountpoint.h:584
lru::InodeCache * inode_cache_
Definition: mountpoint.h:648
CacheManager * SetupPosixCacheMgr(const std::string &instance)
Definition: mountpoint.cc:692
download::DownloadManager * download_mgr()
Definition: mountpoint.h:503
perf::Counter * n_fs_open_
Definition: mountpoint.h:332
static uint64_t RoundUp8(const uint64_t size)
Definition: smalloc.h:37
bool SetupPosixQuotaMgr(const PosixCacheSettings &settings, CacheManager *cache_mgr)
Definition: mountpoint.cc:989
static SqliteMemoryManager * GetInstance()
Definition: sqlitemem.h:137
static PosixQuotaManager * Create(const std::string &cache_workspace, const uint64_t limit, const uint64_t cleanup_threshold, const bool rebuild_database)
Definition: quota_posix.cc:230
unsigned nfs_mode_
Definition: mountpoint.h:416
void SetRetryParameters(const unsigned max_retries, const unsigned backoff_init_ms, const unsigned backoff_max_ms)
Definition: download.cc:2926
string StringifyInt(const int64_t value)
Definition: string.cc:78
Type type_
Definition: mountpoint.h:324
static const unsigned kInodeCacheFactor
Definition: mountpoint.h:565
void SetMaxIpaddrPerProxy(unsigned limit)
Definition: download.cc:2937
void EnableIgnoreSignatureFailures()
Definition: download.cc:2962
std::string GetArch()
Definition: posix.cc:1457
void Inc(class Counter *counter)
Definition: statistics.h:50
bool HasPrefix(const string &str, const string &prefix, const bool ignore_case)
Definition: string.cc:267
perf::Counter * n_eio_04_
Definition: mountpoint.h:350
Log2Histogram * hist_fs_readdir_
Definition: mountpoint.h:365
bool GetValue(const std::string &key, std::string *value) const
Definition: options.cc:376
cvmfs::Uuid * uuid_
Definition: mountpoint.h:623
void SetExternalDownloadManager(download::DownloadManager *download_mgr)
Definition: cache_stream.h:39
OptionsManager * options_mgr_
Definition: cvmfs.cc:152
bool LoadBlacklist(const std::string &path_blacklist, bool append)
Definition: signature.cc:547
BackoffThrottle * backoff_throttle_
Definition: mountpoint.h:638
AuthzAttachment * authz_attachment_
Definition: mountpoint.h:637
void SetProxyTemplates(const std::string &direct, const std::string &forced)
Definition: download.cc:2943
SimpleChunkTables * simple_chunk_tables_
Definition: mountpoint.h:647
bool InitFixed(const shash::Any &root_hash, bool alternative_path)
perf::Counter * n_eio_03_
Definition: mountpoint.h:349
static const unsigned kDefaultNfiles
Definition: mountpoint.h:260
static FileSystem * Create(const FileSystemInfo &fs_info)
Definition: mountpoint.cc:166
bool has_custom_sqlitevfs_
Definition: mountpoint.h:433
perf::Counter * n_fs_statfs_
Definition: mountpoint.h:338
bool ReloadBlacklists()
Definition: mountpoint.cc:1229
std::string name()
Definition: mountpoint.h:234
time_t IsoTimestamp2UtcTime(const std::string &iso8601)
Definition: string.cc:198
static Uuid * Create(const std::string &store_path)
Definition: uuid.cc:23
void CreateStatistics()
Definition: mountpoint.cc:210
pthread_mutex_t lock_max_ttl_
Definition: mountpoint.h:661
void CreateAuthz()
Definition: mountpoint.cc:1317
bool g_raw_symlinks
Definition: globals.cc:12
bool g_world_readable
Definition: globals.cc:15
static const char * kDefaultCacheBase
Definition: mountpoint.h:258
void SetNull()
Definition: hash.h:400
string ResolveProxyDescription(const string &cvmfs_proxies, const std::string &path_fallback_cache, DownloadManager *download_manager)
Definition: wpad.cc:207
uint64_t String2Uint64(const string &value)
Definition: string.cc:228
static const unsigned kTracerBufferSize
Definition: mountpoint.h:588
void SetupUuid()
Definition: mountpoint.cc:1117
perf::Counter * n_eio_02_
Definition: mountpoint.h:348
catalog::ClientCatalogManager * catalog_mgr_
Definition: mountpoint.h:645
bool CreateSignatureManager()
Definition: mountpoint.cc:1570
std::string fqrn_
Definition: mountpoint.h:622
unsigned GetMaxTtlMn()
Definition: mountpoint.cc:1828
std::string error_msg() const
Definition: cache_extern.h:45
bool GetUidOf(const std::string &username, uid_t *uid, gid_t *main_gid)
Definition: posix.cc:1355
bool SetupBehavior()
Definition: mountpoint.cc:1949
static ExternalCacheManager * Create(int fd_connection, unsigned max_open_fds, const std::string &ident)
AuthzFetcher * authz_fetcher_
Definition: mountpoint.h:635
bool FetchHistory(std::string *history_path)
Definition: mountpoint.cc:1784
perf::Statistics * statistics()
Definition: mountpoint.h:248
bool enforce_acls_
Definition: mountpoint.h:664
bool IsHaNfsSource()
Definition: mountpoint.h:196
void CreateTables()
Definition: mountpoint.cc:1642
shash::Any history() const
Definition: manifest.h:135
bool SetupCrashGuard()
Definition: mountpoint.cc:813
static const unsigned kDefaultQuotaLimit
Definition: mountpoint.h:259
static PosixQuotaManager * CreateShared(const std::string &exe_path, const std::string &cache_workspace, const uint64_t limit, const uint64_t cleanup_threshold, bool foreground)
Definition: quota_posix.cc:262
void ResetErrorCounters()
Definition: mountpoint.cc:602
Definition: mutex.h:42
Log2Histogram * hist_fs_lookup_
Definition: mountpoint.h:358
shash::Any root_hash
Definition: history.h:89
bool LoadPublicRsaKeys(const std::string &path_list)
Definition: signature.cc:305
void SetRegularDownloadManager(download::DownloadManager *download_mgr)
Definition: cache_stream.h:36
void RegisterHandler(const std::string &file_path, EventHandler *handler)
Definition: file_watcher.cc:56
void GetTimeout(unsigned *seconds_proxy, unsigned *seconds_direct)
Definition: download.cc:2066
static const unsigned kDefaultMemcacheSize
Definition: mountpoint.h:569
FileSystem * file_system_
Definition: cvmfs.cc:127
std::string repository_tag_
Definition: mountpoint.h:667
static const unsigned kDefaultMinTtl
Definition: dns.h:177
bool SetupOwnerMaps()
Definition: mountpoint.cc:2247
void SetDnsParameters(const unsigned retries, const unsigned timeout_ms)
Definition: download.cc:2004
bool CreateResolvConfWatcher()
Definition: mountpoint.cc:1532
Any MkFromHexPtr(const HexPtr hex, const char suffix)
Definition: hash.cc:83
static ExternalQuotaManager * Create(ExternalCacheManager *cache_mgr)
Log2Histogram * hist_fs_read_
Definition: mountpoint.h:367
void SetCatalogWatermark(unsigned limit)
static bool g_is_enabled
Definition: algorithm.h:201
bool SetupNfsMaps()
Definition: mountpoint.cc:896
std::string path
Definition: cache.h:133
bool CheckBlacklists()
Definition: mountpoint.cc:1191
std::vector< std::string > blacklist_paths_
Definition: mountpoint.h:668
cvmfs::Fetcher * fetcher_
Definition: mountpoint.h:642
file_watcher::FileWatcher * resolv_conf_watcher_
Definition: mountpoint.h:658
static PosixCacheManager * Create(const std::string &cache_path, const bool alien_cache, const RenameWorkarounds rename_workaround=kRenameNormal, const bool do_refcount=false)
Definition: cache_posix.cc:272
static const unsigned kDnsDefaultRetries
Definition: download.h:154
bool GeoSortServers(std::vector< std::string > *servers, std::vector< uint64_t > *output_order=NULL)
Definition: download.cc:2306
bool SetupExternalDownloadMgr(bool dogeosort)
Definition: mountpoint.cc:2124
void SetOwnerMaps(const OwnerMap &uid_map, const OwnerMap &gid_map)
CacheManager * SetupExternalCacheMgr(const std::string &instance)
Definition: mountpoint.cc:653
static void CleanupInstance()
Definition: clientctx.cc:18
perf::Counter * n_fs_lookup_negative_
Definition: mountpoint.h:335
Log2Histogram * hist_fs_open_
Definition: mountpoint.h:366
virtual bool AcquireQuotaManager(QuotaManager *quota_mgr)=0
std::string cache_mgr_instance_
Definition: mountpoint.h:406
std::string path_workspace_lock_
Definition: mountpoint.h:384
virtual void IncGeneration(const uint64_t by)=0
Log2Histogram * hist_fs_release_
Definition: mountpoint.h:368
void SetLogSyslogPrefix(const std::string &prefix)
Definition: logging.cc:241
std::string MakeCanonicalPath(const std::string &path)
Definition: posix.cc:98
static const int kDefaultTelemetrySendRateSec
Definition: mountpoint.h:594
OptionsManager * options_mgr_
Definition: mountpoint.h:328
perf::Counter * no_open_dirs_
Definition: mountpoint.h:345
glue::InodeTracker * inode_tracker_
Definition: mountpoint.h:652
bool fixed_catalog_
Definition: mountpoint.h:663
static PluginHandle * CreatePlugin(const std::string &locator, const std::vector< std::string > &cmd_line)
bool IsDefined(const std::string &key)
Definition: options.cc:370
static const int kMinimumTelemetrySendRateSec
Definition: mountpoint.h:595
void GetHostInfo(std::vector< std::string > *host_chain, std::vector< int > *rtt, unsigned *current_host)
Definition: download.cc:2110
void set_membership(const std::string &m)
Definition: authz_curl.h:25
Statistics * Fork()
Definition: statistics.cc:47
CacheManager * SetupTieredCacheMgr(const std::string &instance)
Definition: mountpoint.cc:772
std::vector< std::string > FindFilesBySuffix(const std::string &dir, const std::string &suffix)
Definition: posix.cc:1135
std::string workspace()
Definition: mountpoint.h:251
bool g_claim_ownership
Definition: globals.cc:11
lru::PathCache * path_cache_
Definition: mountpoint.h:649
CacheManager * cache_mgr_
Definition: mountpoint.h:417
void AddHTTPTracingHeader(const std::string &header)
Definition: download.cc:2970
void SetCredentialsAttachment(CredentialsAttachment *ca)
Definition: download.cc:1969
static ClientCtx * GetInstance()
Definition: clientctx.cc:45
virtual bool AcquireQuotaManager(QuotaManager *quota_mgr)
Definition: cache_ram.cc:73
cvmfs::Uuid * uuid_cache()
Definition: mountpoint.h:250
cvmfs::Fetcher * external_fetcher_
Definition: mountpoint.h:643
perf::Counter * n_fs_dir_open_
Definition: mountpoint.h:333
std::string MkCacheParm(const std::string &generic_parameter, const std::string &instance)
Definition: mountpoint.cc:567
void UnlockFile(const int filedes)
Definition: posix.cc:1006
NfsMaps * nfs_maps_
Definition: mountpoint.h:428
download::DownloadManager * external_download_mgr()
Definition: mountpoint.h:504
void CreateFetchers()
Definition: mountpoint.cc:1555
void SetInodeAnnotation(InodeAnnotation *new_annotation)
virtual void SetInodeResidue(unsigned residue_class, unsigned remainder)
Definition: nfs_maps.h:31
void SetHostResetDelay(const unsigned seconds)
Definition: download.cc:2917
static MountPoint * Create(const std::string &fqrn, FileSystem *file_system, OptionsManager *options_mgr=NULL)
Definition: mountpoint.cc:1270
Log2Histogram * hist_fs_forget_
Definition: mountpoint.h:359
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)
Definition: logging.cc:528