![]() |
CernVM-FS
2.10.0
|
#include <fuse_remount.h>
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 () |
Fence * | fence () |
time_t | catalogs_valid_until () |
Private Member Functions | |
bool | HasRemountTrigger () |
void | SetAlarm (int timeout) |
bool | EnterCriticalSection () |
void | LeaveCriticalSection () |
void | SetOfflineMode (bool value) |
![]() | |
SingleCopy () | |
Static Private Member Functions | |
static void * | MainRemountTrigger (void *data) |
Private Attributes | |
MountPoint * | mountpoint_ |
Not owned. More... | |
cvmfs::InodeGenerationInfo * | inode_generation_info_ |
Not owned. More... | |
FuseInvalidator * | invalidator_ |
FuseInvalidator::Handle | invalidator_handle_ |
Fence * | fence_ |
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_ |
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.
Enumerator | |
---|---|
kStatusUp2Date | |
kStatusDraining | |
kStatusMaintenance | |
kStatusFailGeneral | |
kStatusFailNoSpace |
Definition at line 40 of file fuse_remount.h.
FuseRemounter::FuseRemounter | ( | MountPoint * | mountpoint, |
cvmfs::InodeGenerationInfo * | inode_generation_info, | ||
void ** | fuse_channel_or_session, | ||
bool | fuse_notify_invalidation | ||
) |
Definition at line 162 of file fuse_remount.cc.
FuseRemounter::~FuseRemounter | ( | ) |
|
inline |
Definition at line 68 of file fuse_remount.h.
Referenced by ExpiresMagicXattr::PrepareValueFenced().
FuseRemounter::Status FuseRemounter::ChangeRoot | ( | const shash::Any & | root_hash | ) |
Definition at line 30 of file fuse_remount.cc.
Referenced by TalkManager::MainResponder().
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().
FuseRemounter::Status FuseRemounter::CheckSynchronously | ( | ) |
Used from the TalkManager. Continously calls 'check' until it returns with "up to date" or a failure.
Definition at line 132 of file fuse_remount.cc.
Referenced by TalkManager::MainResponder().
|
inlineprivate |
Definition at line 76 of file fuse_remount.h.
Referenced by TryFinish().
void FuseRemounter::EnterMaintenanceMode | ( | ) |
Definition at line 148 of file fuse_remount.cc.
Referenced by MaintenanceMode().
|
inline |
Definition at line 67 of file fuse_remount.h.
Referenced by cvmfs::cvmfs_forget(), cvmfs::cvmfs_getattr(), cvmfs::cvmfs_getxattr(), cvmfs::cvmfs_listxattr(), cvmfs::cvmfs_lookup(), cvmfs::cvmfs_open(), cvmfs::cvmfs_opendir(), cvmfs::cvmfs_readlink(), cvmfs::cvmfs_statfs(), cvmfs::Evict(), and cvmfs::Pin().
|
inlineprivate |
Definition at line 73 of file fuse_remount.h.
Referenced by SetAlarm(), and ~FuseRemounter().
|
inline |
Definition at line 60 of file fuse_remount.h.
Referenced by cvmfs::GetKcacheTimeout().
|
inline |
Definition at line 64 of file fuse_remount.h.
Referenced by cvmfs::GetReloadStatus(), and TryFinish().
|
inline |
Definition at line 65 of file fuse_remount.h.
Referenced by cvmfs::GetReloadStatus(), and TryFinish().
|
inlineprivate |
Definition at line 79 of file fuse_remount.h.
Referenced by TryFinish().
|
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().
|
private |
Definition at line 243 of file fuse_remount.cc.
Referenced by Spawn(), and TryFinish().
|
private |
Definition at line 257 of file fuse_remount.cc.
Referenced by Spawn(), and TryFinish().
void FuseRemounter::Spawn | ( | ) |
Definition at line 273 of file fuse_remount.cc.
Referenced by Spawn().
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().
|
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 117 of file fuse_remount.h.
Referenced by catalogs_valid_until(), Spawn(), and TryFinish().
|
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 139 of file fuse_remount.h.
Referenced by EnterCriticalSection(), FuseRemounter(), and LeaveCriticalSection().
|
private |
In drainout mode, the fuse module sets the timeout of meta data replys 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 128 of file fuse_remount.h.
Referenced by FuseRemounter(), IsCaching(), IsInDrainoutMode(), and TryFinish().
|
private |
Ensures that within a fuse callback all operations take place on the same catalog revision.
Definition at line 94 of file fuse_remount.h.
Referenced by fence(), TryFinish(), and ~FuseRemounter().
|
private |
This fence makes sure that Check() and TryFinish() have been left after the maintenance mode flag was set.
Definition at line 99 of file fuse_remount.h.
Referenced by TryFinish().
|
private |
|
private |
Definition at line 85 of file fuse_remount.h.
Referenced by Spawn(), and ~FuseRemounter().
|
private |
Used to query whether the kernel cache invalidation is done.
Definition at line 89 of file fuse_remount.h.
Referenced by TryFinish().
|
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 133 of file fuse_remount.h.
Referenced by FuseRemounter(), IsCaching(), and IsInMaintenanceMode().
|
private |
Not owned.
Definition at line 83 of file fuse_remount.h.
Referenced by SetOfflineMode(), Spawn(), and TryFinish().
|
private |
Indicates whether the last reload attempt failed. If so, the short term TTL is active.
Definition at line 110 of file fuse_remount.h.
Referenced by SetOfflineMode(), and Spawn().
|
private |
The thread that triggers the reload of the root catalog is controlled through this pipe.
Definition at line 105 of file fuse_remount.h.
Referenced by FuseRemounter(), HasRemountTrigger(), MainRemountTrigger(), SetAlarm(), Spawn(), and ~FuseRemounter().
|
private |
Definition at line 100 of file fuse_remount.h.
Referenced by FuseRemounter(), Spawn(), and ~FuseRemounter().