CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fuse_remount.h
Go to the documentation of this file.
1 
5 #ifndef CVMFS_FUSE_REMOUNT_H_
6 #define CVMFS_FUSE_REMOUNT_H_
7 
8 #include <pthread.h>
9 
10 #include <ctime>
11 
12 #include "atomic.h"
13 #include "duplex_fuse.h"
14 #include "fence.h"
15 #include "fuse_evict.h"
16 #include "hash.h"
17 #include "util/single_copy.h"
18 
19 namespace cvmfs {
20 struct InodeGenerationInfo;
21 }
22 class MountPoint;
23 
39  public:
40  enum Status {
46  };
47 
48  FuseRemounter(MountPoint *mountpoint,
49  cvmfs::InodeGenerationInfo *inode_generation_info,
50  void **fuse_channel_or_session,
51  bool fuse_notify_invalidation);
53  void Spawn();
54 
55  Status Check();
57  Status ChangeRoot(const shash::Any &root_hash);
58  void TryFinish(const shash::Any &root_hash = shash::Any());
59  void EnterMaintenanceMode();
60  bool IsCaching() {
61  return (atomic_read32(&maintenance_mode_) == 0) &&
62  (atomic_read32(&drainout_mode_) == 0);
63  }
64  bool IsInDrainoutMode() { return atomic_read32(&drainout_mode_) == 2; }
65  bool IsInMaintenanceMode() { return atomic_read32(&maintenance_mode_) == 1; }
66 
67  Fence *fence() { return fence_; }
69 
70  private:
71  static void *MainRemountTrigger(void *data);
72 
73  bool HasRemountTrigger() { return pipe_remount_trigger_[0] >= 0; }
74  void SetAlarm(int timeout);
75 
77  return atomic_cas32(&critical_section_, 0, 1);
78  }
79  void LeaveCriticalSection() { atomic_dec32(&critical_section_); /* 1 -> 0 */ }
80 
81  void SetOfflineMode(bool value);
82 
140 }; // class FuseRemounter
141 
142 #endif // CVMFS_FUSE_REMOUNT_H_
bool IsCaching()
Definition: fuse_remount.h:60
atomic_int32 critical_section_
Definition: fuse_remount.h:139
bool IsInDrainoutMode()
Definition: fuse_remount.h:64
int pipe_remount_trigger_[2]
Definition: fuse_remount.h:105
void TryFinish(const shash::Any &root_hash=shash::Any())
void EnterMaintenanceMode()
bool HasRemountTrigger()
Definition: fuse_remount.h:73
FuseInvalidator::Handle invalidator_handle_
Definition: fuse_remount.h:89
static void * MainRemountTrigger(void *data)
Fence fence_maintenance_
Definition: fuse_remount.h:99
bool EnterCriticalSection()
Definition: fuse_remount.h:76
time_t catalogs_valid_until()
Definition: fuse_remount.h:68
Status Check()
Definition: fuse_remount.cc:70
atomic_int32 drainout_mode_
Definition: fuse_remount.h:128
MountPoint * mountpoint_
Not owned.
Definition: fuse_remount.h:83
Fence * fence()
Definition: fuse_remount.h:67
int32_t atomic_int32
Definition: atomic.h:17
cvmfs::InodeGenerationInfo * inode_generation_info_
Not owned.
Definition: fuse_remount.h:84
FuseInvalidator * invalidator_
Definition: fuse_remount.h:85
time_t catalogs_valid_until_
Definition: fuse_remount.h:117
Status CheckSynchronously()
Fence * fence_
Definition: fuse_remount.h:94
Status ChangeRoot(const shash::Any &root_hash)
Definition: fuse_remount.cc:30
void SetOfflineMode(bool value)
bool IsInMaintenanceMode()
Definition: fuse_remount.h:65
pthread_t thread_remount_trigger_
Definition: fuse_remount.h:100
Definition: fence.h:25
void SetAlarm(int timeout)
void LeaveCriticalSection()
Definition: fuse_remount.h:79
FuseRemounter(MountPoint *mountpoint, cvmfs::InodeGenerationInfo *inode_generation_info, void **fuse_channel_or_session, bool fuse_notify_invalidation)
atomic_int32 maintenance_mode_
Definition: fuse_remount.h:133