CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FuseRemounter Class Reference

#include <fuse_remount.h>

Inheritance diagram for FuseRemounter:
Collaboration diagram for FuseRemounter:

Public Types

enum  Status {
  kStatusUp2Date = 0, kStatusDraining, kStatusMaintenance, kStatusFailGeneral,
  kStatusFailNoSpace
}
 

Public Member Functions

 FuseRemounter (MountPoint *mountpoint, cvmfs::InodeGenerationInfo *inode_generation_info, void **fuse_channel_or_session, bool fuse_notify_invalidation)
 
 ~FuseRemounter ()
 
void Spawn ()
 
Status Check ()
 
Status CheckSynchronously ()
 
Status ChangeRoot (const shash::Any &root_hash)
 
void TryFinish (const shash::Any &root_hash=shash::Any())
 
void EnterMaintenanceMode ()
 
bool IsCaching ()
 
bool IsInDrainoutMode ()
 
bool IsInMaintenanceMode ()
 
Fencefence ()
 
time_t catalogs_valid_until ()
 
void InvalidateDentry (uint64_t parent_ino, const NameString &name)
 

Private Member Functions

bool HasRemountTrigger ()
 
void SetAlarm (int timeout)
 
bool EnterCriticalSection ()
 
void LeaveCriticalSection ()
 
void SetOfflineMode (bool value)
 
- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Static Private Member Functions

static void * MainRemountTrigger (void *data)
 

Private Attributes

MountPointmountpoint_
 Not owned. More...
 
cvmfs::InodeGenerationInfoinode_generation_info_
 Not owned. More...
 
FuseInvalidatorinvalidator_
 
FuseInvalidator::Handle invalidator_handle_
 
Fencefence_
 
Fence fence_maintenance_
 
pthread_t thread_remount_trigger_
 
int pipe_remount_trigger_ [2]
 
bool offline_mode_
 
time_t catalogs_valid_until_
 
atomic_int32 drainout_mode_
 
atomic_int32 maintenance_mode_
 
atomic_int32 critical_section_
 

Detailed Description

Orchestrates an orderly remount of a new snapshot revision in the Fuse module. Remounting always happens as a result of calling Check() followed by a call to TryFinish(). The Check() method is either called from the remount trigger or from the TalkManager. The TryFinish() method is either called from a fuse callback function or from CheckSynchronously(). If a new root file catalog is available online and the kernel caches got flushed, the actual heavy-lifting of applying the new catalog takes place in TryFinish();

Remounting is inherently asynchronous because the kernel caches need to be flushed. We do this through the FuseInvalidator. Once the FuseInvalidor is ready (either by waiting or by active eviction), we flush all user-level caches and reload a new root catalog.

Definition at line 38 of file fuse_remount.h.

Member Enumeration Documentation

Enumerator
kStatusUp2Date 
kStatusDraining 
kStatusMaintenance 
kStatusFailGeneral 
kStatusFailNoSpace 

Definition at line 40 of file fuse_remount.h.

Constructor & Destructor Documentation

FuseRemounter::FuseRemounter ( MountPoint mountpoint,
cvmfs::InodeGenerationInfo inode_generation_info,
void **  fuse_channel_or_session,
bool  fuse_notify_invalidation 
)

Definition at line 163 of file fuse_remount.cc.

FuseRemounter::~FuseRemounter ( )

Definition at line 183 of file fuse_remount.cc.

Here is the call graph for this function:

Member Function Documentation

time_t FuseRemounter::catalogs_valid_until ( )
inline

Definition at line 68 of file fuse_remount.h.

Referenced by ExpiresMagicXattr::PrepareValueFenced().

Here is the caller graph for this function:

FuseRemounter::Status FuseRemounter::ChangeRoot ( const shash::Any root_hash)

Definition at line 30 of file fuse_remount.cc.

Referenced by TalkManager::MainResponder().

Here is the call graph for this function:

Here is the caller graph for this function:

FuseRemounter::Status FuseRemounter::Check ( )

Executed by the trigger thread, or triggered from cvmfs_talk. Moves into drainout mode if a new catalog is available online.

Definition at line 70 of file fuse_remount.cc.

Referenced by MainRemountTrigger(), and TalkManager::MainResponder().

Here is the call graph for this function:

Here is the caller graph for this function:

FuseRemounter::Status FuseRemounter::CheckSynchronously ( )

Used from the TalkManager. Continuously calls 'check' until it returns with "up to date" or a failure.

Definition at line 133 of file fuse_remount.cc.

Referenced by TalkManager::MainResponder().

Here is the call graph for this function:

Here is the caller graph for this function:

bool FuseRemounter::EnterCriticalSection ( )
inlineprivate

Definition at line 80 of file fuse_remount.h.

Referenced by TryFinish().

Here is the caller graph for this function:

void FuseRemounter::EnterMaintenanceMode ( )

Definition at line 149 of file fuse_remount.cc.

Referenced by MaintenanceMode().

Here is the caller graph for this function:

bool FuseRemounter::HasRemountTrigger ( )
inlineprivate

Definition at line 77 of file fuse_remount.h.

Referenced by SetAlarm(), and ~FuseRemounter().

Here is the caller graph for this function:

void FuseRemounter::InvalidateDentry ( uint64_t  parent_ino,
const NameString name 
)
inline

Definition at line 70 of file fuse_remount.h.

Referenced by cvmfs::cvmfs_getattr().

Here is the call graph for this function:

Here is the caller graph for this function:

bool FuseRemounter::IsCaching ( )
inline

Definition at line 60 of file fuse_remount.h.

Referenced by cvmfs::GetKcacheTimeout().

Here is the caller graph for this function:

bool FuseRemounter::IsInDrainoutMode ( )
inline

Definition at line 64 of file fuse_remount.h.

Referenced by cvmfs::GetReloadStatus(), and TryFinish().

Here is the caller graph for this function:

bool FuseRemounter::IsInMaintenanceMode ( )
inline

Definition at line 65 of file fuse_remount.h.

Referenced by cvmfs::GetReloadStatus(), and TryFinish().

Here is the caller graph for this function:

void FuseRemounter::LeaveCriticalSection ( )
inlineprivate

Definition at line 83 of file fuse_remount.h.

Referenced by TryFinish().

Here is the caller graph for this function:

void * FuseRemounter::MainRemountTrigger ( void *  data)
staticprivate

Triggers the Check() method when the catalog TTL expires. Works essentially as an alarm() timer.

Definition at line 199 of file fuse_remount.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseRemounter::SetAlarm ( int  timeout)
private

Definition at line 243 of file fuse_remount.cc.

Referenced by Spawn(), and TryFinish().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseRemounter::SetOfflineMode ( bool  value)
private

Definition at line 257 of file fuse_remount.cc.

Referenced by Spawn(), and TryFinish().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseRemounter::Spawn ( )

Definition at line 273 of file fuse_remount.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseRemounter::TryFinish ( const shash::Any root_hash = shash::Any())

Applies a previously started remount operation. This is called from the fuse callbacks or from CheckSynchronously(). Usually, the method quits immediately except when a new catalog is available and the kernel caches are flushed.

Definition at line 296 of file fuse_remount.cc.

Referenced by cvmfs::cvmfs_getattr(), cvmfs::cvmfs_lookup(), and cvmfs::cvmfs_opendir().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

time_t FuseRemounter::catalogs_valid_until_
private

Stores the deadline after which the remount trigger will look again for an updated version. Can be MountPoint::kIndefiniteDeadline if a fixed root catalog is used. Only for information purposes ('expires' xattr). TODO(jblomer): access to this field should be locked

Definition at line 121 of file fuse_remount.h.

Referenced by catalogs_valid_until(), Spawn(), and TryFinish().

atomic_int32 FuseRemounter::critical_section_
private

Only one thread must perform the actual remount (stopping user-level caches, loading new catalog, etc.). This is used to protect TyrFinish() from concurrent execution.

Definition at line 143 of file fuse_remount.h.

Referenced by EnterCriticalSection(), FuseRemounter(), and LeaveCriticalSection().

atomic_int32 FuseRemounter::drainout_mode_
private

In drainout mode, the fuse module sets the timeout of meta data replies to zero. If supported by Fuse, the FuseInvalidator will evict all active entries from the kernel cache. Drainout mode is left only once the new root catalog is active (after TryFinish()).

Moving into drainout mode is a two-steps procedure. Going from zero to one the handle of the FuseInvalidator is prepared, from one to two is the actual move into drainout mode.

Definition at line 132 of file fuse_remount.h.

Referenced by FuseRemounter(), IsCaching(), IsInDrainoutMode(), and TryFinish().

Fence* FuseRemounter::fence_
private

Ensures that within a fuse callback all operations take place on the same catalog revision.

Definition at line 98 of file fuse_remount.h.

Referenced by fence(), TryFinish(), and ~FuseRemounter().

Fence FuseRemounter::fence_maintenance_
private

This fence makes sure that Check() and TryFinish() have been left after the maintenance mode flag was set.

Definition at line 103 of file fuse_remount.h.

Referenced by TryFinish().

cvmfs::InodeGenerationInfo* FuseRemounter::inode_generation_info_
private

Not owned.

Definition at line 88 of file fuse_remount.h.

Referenced by TryFinish().

FuseInvalidator* FuseRemounter::invalidator_
private

Definition at line 89 of file fuse_remount.h.

Referenced by InvalidateDentry(), Spawn(), and ~FuseRemounter().

FuseInvalidator::Handle FuseRemounter::invalidator_handle_
private

Used to query whether the kernel cache invalidation is done.

Definition at line 93 of file fuse_remount.h.

Referenced by TryFinish().

atomic_int32 FuseRemounter::maintenance_mode_
private

in maintenance mode, cache timeout is 0 and catalogs are not reloaded. Maintenance mode is entered when the fuse module gets reloaded.

Definition at line 137 of file fuse_remount.h.

Referenced by FuseRemounter(), IsCaching(), and IsInMaintenanceMode().

MountPoint* FuseRemounter::mountpoint_
private

Not owned.

Definition at line 87 of file fuse_remount.h.

Referenced by SetOfflineMode(), Spawn(), and TryFinish().

bool FuseRemounter::offline_mode_
private

Indicates whether the last reload attempt failed. If so, the short term TTL is active.

Definition at line 114 of file fuse_remount.h.

Referenced by SetOfflineMode(), and Spawn().

int FuseRemounter::pipe_remount_trigger_[2]
private

The thread that triggers the reload of the root catalog is controlled through this pipe.

Definition at line 109 of file fuse_remount.h.

Referenced by FuseRemounter(), HasRemountTrigger(), MainRemountTrigger(), SetAlarm(), Spawn(), and ~FuseRemounter().

pthread_t FuseRemounter::thread_remount_trigger_
private

Definition at line 104 of file fuse_remount.h.

Referenced by FuseRemounter(), Spawn(), and ~FuseRemounter().


The documentation for this class was generated from the following files: