nfs-ganesha 1.4
Defines | Functions | Variables

state_lock.c File Reference

#include <unistd.h>
#include <sys/types.h>
#include <sys/param.h>
#include <time.h>
#include <pthread.h>
#include <string.h>
#include "log.h"
#include "HashData.h"
#include "HashTable.h"
#include "fsal.h"
#include "nfs_core.h"
#include "nfs4.h"
#include "sal_functions.h"
#include "cache_inode_lru.h"

Go to the source code of this file.

Defines

#define STATE_ERR_MAX   100

Functions

state_status_t state_lock_init (state_status_t *pstatus)
bool_t lock_owner_is_nlm (state_lock_entry_t *lock_entry)
state_status_t do_lock_op (cache_entry_t *pentry, fsal_op_context_t *pcontext, exportlist_t *pexport, fsal_lock_op_t lock_op, state_owner_t *powner, fsal_lock_param_t *plock, state_owner_t **holder, fsal_lock_param_t *conflict, bool_t overlap)
const char * str_lockt (fsal_lock_t ltype)
const char * str_blocking (state_blocking_t blocking)
const char * str_blocked (state_blocking_t blocked)
void LogLock (log_components_t component, log_levels_t debug, const char *reason, cache_entry_t *pentry, fsal_op_context_t *pcontext, state_owner_t *powner, fsal_lock_param_t *plock)
void LogLockDesc (log_components_t component, log_levels_t debug, const char *reason, cache_entry_t *pentry, void *powner, fsal_lock_param_t *plock)
void dump_all_locks (const char *label)
state_lock_entry_tstate_lock_entry_t_dup (fsal_op_context_t *pcontext, state_lock_entry_t *orig_entry)
void lock_entry_inc_ref (state_lock_entry_t *lock_entry)
void lock_entry_dec_ref (state_lock_entry_t *lock_entry)
const char * fsal_lock_op_str (fsal_lock_op_t op)
state_status_t do_unlock_no_owner (cache_entry_t *pentry, fsal_op_context_t *pcontext, exportlist_t *pexport, fsal_lock_param_t *plock)
void copy_conflict (state_lock_entry_t *found_entry, state_owner_t **holder, fsal_lock_param_t *conflict)
state_status_t state_test (cache_entry_t *pentry, fsal_op_context_t *pcontext, exportlist_t *pexport, state_owner_t *powner, fsal_lock_param_t *plock, state_owner_t **holder, fsal_lock_param_t *conflict, state_status_t *pstatus)
state_status_t state_lock (cache_entry_t *pentry, fsal_op_context_t *pcontext, exportlist_t *pexport, state_owner_t *powner, state_t *pstate, state_blocking_t blocking, state_block_data_t *block_data, fsal_lock_param_t *plock, state_owner_t **holder, fsal_lock_param_t *conflict, state_status_t *pstatus)
state_status_t state_unlock (cache_entry_t *pentry, fsal_op_context_t *pcontext, exportlist_t *pexport, state_owner_t *powner, state_t *pstate, fsal_lock_param_t *plock, state_status_t *pstatus)
state_status_t state_owner_unlock_all (fsal_op_context_t *pcontext, state_owner_t *powner, state_t *pstate, state_status_t *pstatus)
void state_lock_wipe (cache_entry_t *pentry)

Variables

state_owner_t unknown_owner

Detailed Description

This file contains functions used in lock management.

Definition in file state_lock.c.


Define Documentation

#define STATE_ERR_MAX   100

Definition at line 81 of file state_lock.c.


Function Documentation

void copy_conflict ( state_lock_entry_t found_entry,
state_owner_t **  holder,
fsal_lock_param_t conflict 
)

Definition at line 1936 of file state_lock.c.

state_status_t do_lock_op ( cache_entry_t pentry,
fsal_op_context_t pcontext,
exportlist_t pexport,
fsal_lock_op_t  lock_op,
state_owner_t powner,
fsal_lock_param_t plock,
state_owner_t **  holder,
fsal_lock_param_t conflict,
bool_t  overlap 
)

Definition at line 1855 of file state_lock.c.

state_status_t do_unlock_no_owner ( cache_entry_t pentry,
fsal_op_context_t pcontext,
exportlist_t pexport,
fsal_lock_param_t plock 
)

FSAL_unlock_no_owner: Handle FSAL unlock when owner is not supported.

When the FSAL doesn't support lock owners, we can't just arbitrarily unlock the entire range in the FSAL, we might have locks owned by other owners that still exist, either because there were several lock owners with read locks, or the client unlocked a larger range that is actually locked (some (most) clients will actually unlock the entire file when closing a file or terminating a process).

Basically, we want to create a list of ranges to unlock. To do so we create a dummy entry in a dummy list for the unlock range. Then we subtract each existing lock from the dummy list.

The list of unlock ranges will include ranges that the original onwer didn't actually have locks in. This behavior is actually helpful for some callers of FSAL_OP_UNLOCK.

Definition at line 1774 of file state_lock.c.

void dump_all_locks ( const char *  label)

Definition at line 397 of file state_lock.c.

const char* fsal_lock_op_str ( fsal_lock_op_t  op) [inline]

Definition at line 1742 of file state_lock.c.

void lock_entry_dec_ref ( state_lock_entry_t lock_entry)

Definition at line 521 of file state_lock.c.

void lock_entry_inc_ref ( state_lock_entry_t lock_entry)

Definition at line 513 of file state_lock.c.

bool_t lock_owner_is_nlm ( state_lock_entry_t lock_entry)

Definition at line 165 of file state_lock.c.

void LogLock ( log_components_t  component,
log_levels_t  debug,
const char *  reason,
cache_entry_t pentry,
fsal_op_context_t pcontext,
state_owner_t powner,
fsal_lock_param_t plock 
)

Definition at line 353 of file state_lock.c.

void LogLockDesc ( log_components_t  component,
log_levels_t  debug,
const char *  reason,
cache_entry_t pentry,
void *  powner,
fsal_lock_param_t plock 
)

Definition at line 380 of file state_lock.c.

state_status_t state_lock ( cache_entry_t pentry,
fsal_op_context_t pcontext,
exportlist_t pexport,
state_owner_t powner,
state_t pstate,
state_blocking_t  blocking,
state_block_data_t block_data,
fsal_lock_param_t plock,
state_owner_t **  holder,
fsal_lock_param_t conflict,
state_status_t pstatus 
)

state_lock: Attempt to acquire a lock

This function acquires the state lock on a file.

Definition at line 2061 of file state_lock.c.

state_lock_entry_t* state_lock_entry_t_dup ( fsal_op_context_t pcontext,
state_lock_entry_t orig_entry 
) [inline]

Definition at line 501 of file state_lock.c.

state_status_t state_lock_init ( state_status_t pstatus)

Definition at line 109 of file state_lock.c.

void state_lock_wipe ( cache_entry_t pentry)

Definition at line 3094 of file state_lock.c.

state_status_t state_owner_unlock_all ( fsal_op_context_t pcontext,
state_owner_t powner,
state_t pstate,
state_status_t pstatus 
)

state_owner_unlock_all: Release all locks held by a lock owner

Definition at line 2915 of file state_lock.c.

state_status_t state_test ( cache_entry_t pentry,
fsal_op_context_t pcontext,
exportlist_t pexport,
state_owner_t powner,
fsal_lock_param_t plock,
state_owner_t **  holder,
fsal_lock_param_t conflict,
state_status_t pstatus 
)

state_test: Test for lock availability

This function acquires the state lock on an entry and thus is only suitable for operations like lockt. If one wishes to use it as part of a larger lock or state operation one would need to split it out.

Definition at line 1967 of file state_lock.c.

state_status_t state_unlock ( cache_entry_t pentry,
fsal_op_context_t pcontext,
exportlist_t pexport,
state_owner_t powner,
state_t pstate,
fsal_lock_param_t plock,
state_status_t pstatus 
)

state_unlock: Release a lock

Definition at line 2457 of file state_lock.c.

const char* str_blocked ( state_blocking_t  blocked)

Definition at line 222 of file state_lock.c.

const char* str_blocking ( state_blocking_t  blocking)

Definition at line 209 of file state_lock.c.

const char* str_lockt ( fsal_lock_t  ltype)

Definition at line 197 of file state_lock.c.


Variable Documentation

Definition at line 101 of file state_lock.c.