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

#include <fuse_evict.h>

Inheritance diagram for FuseInvalidator:
Collaboration diagram for FuseInvalidator:

Classes

class  Handle
 

Public Member Functions

 FuseInvalidator (MountPoint *mountpoint, void **fuse_channel_or_session, bool fuse_notify_invalidation)
 
 ~FuseInvalidator ()
 
void Spawn ()
 
void InvalidateInodes (Handle *handle)
 
void InvalidateDentry (uint64_t parent_ino, const NameString &name)
 

Static Public Member Functions

static bool HasFuseNotifyInval ()
 

Private Member Functions

 FRIEND_TEST (T_FuseInvalidator, StartStop)
 
 FRIEND_TEST (T_FuseInvalidator, InvalidateTimeout)
 
 FRIEND_TEST (T_FuseInvalidator, InvalidateOps)
 
 FuseInvalidator (glue::InodeTracker *inode_tracker, glue::DentryTracker *dentry_tracker, void **fuse_channel_or_session, bool fuse_notify_invalidation)
 
- Private Member Functions inherited from SingleCopy
 SingleCopy ()
 

Static Private Member Functions

static void * MainInvalidator (void *data)
 

Private Attributes

MountPointmount_point_
 
glue::InodeTrackerinode_tracker_
 
glue::DentryTrackerdentry_tracker_
 
void ** fuse_channel_or_session_
 
bool spawned_
 
int pipe_ctrl_ [2]
 
pthread_t thread_invalidator_
 
atomic_int32 terminated_
 
BigVector< uint64_t > evict_list_
 

Static Private Attributes

static const unsigned kTimeoutSafetyMarginSec = 1
 
static const unsigned kCheckTimeoutFreqMs = 100
 
static const unsigned kCheckTimeoutFreqOps = 256
 
static bool g_fuse_notify_invalidation_ = true
 

Friends

class T_FuseInvalidator
 

Detailed Description

This class can poke all known dentries out of the kernel caches. This allows for faster remount/reload of the fuse module because caches don't need to drain out by timeout. If the fuse library doesn't provide fuse_lowlevel_notify_inval_entry, it falls back to waiting for drainout.

Evicting entries from the cache must be done from a separate thread to avoid a deadlock in the fuse callbacks (see Fuse documentation).

Definition at line 34 of file fuse_evict.h.

Constructor & Destructor Documentation

FuseInvalidator::FuseInvalidator ( MountPoint mountpoint,
void **  fuse_channel_or_session,
bool  fuse_notify_invalidation 
)

Definition at line 69 of file fuse_evict.cc.

Here is the call graph for this function:

FuseInvalidator::~FuseInvalidator ( )

Definition at line 103 of file fuse_evict.cc.

Here is the call graph for this function:

FuseInvalidator::FuseInvalidator ( glue::InodeTracker inode_tracker,
glue::DentryTracker dentry_tracker,
void **  fuse_channel_or_session,
bool  fuse_notify_invalidation 
)
private

CONSTRUCTOR ONLY FOR UNITTESTS - mountpoint will illegally be null ( we do not want to construct a full mountpoint in the unittest )

Definition at line 85 of file fuse_evict.cc.

Here is the call graph for this function:

Member Function Documentation

FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
StartStop   
)
private
FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
InvalidateTimeout   
)
private
FuseInvalidator::FRIEND_TEST ( T_FuseInvalidator  ,
InvalidateOps   
)
private
bool FuseInvalidator::HasFuseNotifyInval ( )
static

Technically, also libfuse 2.8 has support. Libfuse 2.8 comes with EL6, which had bugs reported related to the fuse_notify_inval_...() functions. Since just waiting for the timeout works perfectly fine, there is no reason to optimize for forced cache eviction too aggressively.

TODO(jblomer): could we have libfuse 2.9 or higher with a very old kernel that doesn't support active invalidation? How old does the kernel need to be? Probably that situation is never triggered in practice.

Definition at line 54 of file fuse_evict.cc.

Referenced by MainInvalidator(), and MaintenanceMode().

Here is the caller graph for this function:

void FuseInvalidator::InvalidateDentry ( uint64_t  parent_ino,
const NameString name 
)

Definition at line 121 of file fuse_evict.cc.

Referenced by FuseRemounter::InvalidateDentry().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseInvalidator::InvalidateInodes ( Handle handle)

Definition at line 114 of file fuse_evict.cc.

Here is the call graph for this function:

void * FuseInvalidator::MainInvalidator ( void *  data)
staticprivate

Definition at line 132 of file fuse_evict.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

void FuseInvalidator::Spawn ( )

Definition at line 312 of file fuse_evict.cc.

Referenced by FuseRemounter::Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class T_FuseInvalidator
friend

Definition at line 35 of file fuse_evict.h.

Member Data Documentation

glue::DentryTracker* FuseInvalidator::dentry_tracker_
private

Definition at line 104 of file fuse_evict.h.

Referenced by MainInvalidator().

BigVector<uint64_t> FuseInvalidator::evict_list_
private

Definition at line 117 of file fuse_evict.h.

Referenced by MainInvalidator().

void** FuseInvalidator::fuse_channel_or_session_
private

libfuse2 uses struct fuse_chan, libfuse3 uses struct fuse_session

Definition at line 108 of file fuse_evict.h.

Referenced by MainInvalidator().

bool FuseInvalidator::g_fuse_notify_invalidation_ = true
staticprivate

Definition at line 119 of file fuse_evict.h.

Referenced by FuseInvalidator(), and HasFuseNotifyInval().

glue::InodeTracker* FuseInvalidator::inode_tracker_
private

Definition at line 103 of file fuse_evict.h.

Referenced by MainInvalidator().

const unsigned FuseInvalidator::kCheckTimeoutFreqMs = 100
staticprivate

If caches are drained out by timeout, set a polling interval.

Definition at line 92 of file fuse_evict.h.

Referenced by MainInvalidator(), and FuseInvalidator::Handle::WaitFor().

const unsigned FuseInvalidator::kCheckTimeoutFreqOps = 256
staticprivate

If caches are actively drained out, check every so many operations if the caches are anyway drained out by timeout.

Definition at line 97 of file fuse_evict.h.

Referenced by MainInvalidator().

const unsigned FuseInvalidator::kTimeoutSafetyMarginSec = 1
staticprivate

Add one second to the caller-provided timeout to be on the safe side.

Definition at line 88 of file fuse_evict.h.

MountPoint* FuseInvalidator::mount_point_
private

Definition at line 101 of file fuse_evict.h.

Referenced by MainInvalidator().

int FuseInvalidator::pipe_ctrl_[2]
private
bool FuseInvalidator::spawned_
private

Definition at line 109 of file fuse_evict.h.

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

atomic_int32 FuseInvalidator::terminated_
private

An invalidation run can take some time. Allow for early cancellation if thread should be shut down.

Definition at line 116 of file fuse_evict.h.

Referenced by FuseInvalidator(), MainInvalidator(), and ~FuseInvalidator().

pthread_t FuseInvalidator::thread_invalidator_
private

Definition at line 111 of file fuse_evict.h.

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


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