glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

leases.h File Reference
#include "config.h"
#include <glusterfs/common-utils.h>
#include <glusterfs/glusterfs.h>
#include <glusterfs/xlator.h>
#include <glusterfs/call-stub.h>
#include <glusterfs/logging.h>
#include <glusterfs/client_t.h>
#include <glusterfs/lkowner.h>
#include <glusterfs/locking.h>
#include <glusterfs/upcall-utils.h>
#include "timer-wheel.h"
#include "leases-mem-types.h"
#include "leases-messages.h"
Include dependency graph for leases.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _leases_private
 
struct  _lease_client
 
struct  _lease_inode
 
struct  _lease_fd_ctx
 
struct  _lease_inode_ctx
 
struct  _lease_id_entry
 
struct  __fop_stub
 
struct  __lease_timer_data
 

Macros

#define _CONFIG_H
 
#define RECALL_LEASE_LK_TIMEOUT   "60"
 
#define DATA_MODIFY_FOP   0x0001
 
#define BLOCKING_FOP   0x0002
 
#define BLOCK_FOP   0x0001
 
#define WIND_FOP   0x0002
 
#define EXIT_IF_LEASES_OFF(this, label)
 
#define EXIT_IF_INTERNAL_FOP(frame, xdata, label)
 
#define GET_LEASE_ID(xdata, lease_id, client_uid)
 
#define GET_FLAGS(fop, fd_flags)
 
#define GET_FLAGS_LK(cmd, l_type, fd_flags)
 
#define LEASE_BLOCK_FOP(inode, fop_name, frame, this, params...)
 

Typedefs

typedef struct _leases_private leases_private_t
 
typedef struct _lease_client lease_client_t
 
typedef struct _lease_inode lease_inode_t
 
typedef struct _lease_fd_ctx lease_fd_ctx_t
 
typedef struct _lease_inode_ctx lease_inode_ctx_t
 
typedef struct _lease_id_entry lease_id_entry_t
 
typedef struct __fop_stub fop_stub_t
 
typedef struct __lease_timer_data lease_timer_data_t
 

Functions

bool is_leases_enabled (xlator_t *this)
 
lease_inode_ctx_tlease_ctx_get (inode_t *inode, xlator_t *this)
 
int process_lease_req (call_frame_t *frame, xlator_t *this, inode_t *inode, struct gf_lease *lease)
 
int check_lease_conflict (call_frame_t *frame, inode_t *inode, const char *lease_id, uint32_t fop_flags)
 
int cleanup_client_leases (xlator_t *this, const char *client_uid)
 
void * expired_recall_cleanup (void *data)
 

Macro Definition Documentation

◆ _CONFIG_H

#define _CONFIG_H

Definition at line 15 of file leases.h.

◆ BLOCK_FOP

#define BLOCK_FOP   0x0001

Definition at line 39 of file leases.h.

◆ BLOCKING_FOP

#define BLOCKING_FOP   0x0002

Definition at line 37 of file leases.h.

◆ DATA_MODIFY_FOP

#define DATA_MODIFY_FOP   0x0001

Definition at line 36 of file leases.h.

◆ EXIT_IF_INTERNAL_FOP

#define EXIT_IF_INTERNAL_FOP (   frame,
  xdata,
  label 
)
Value:
do { \
if (frame->root->pid < 0) \
goto label; \
if (xdata && dict_get(xdata, GLUSTERFS_INTERNAL_FOP_KEY)) \
goto label; \
} while (0)

Definition at line 48 of file leases.h.

◆ EXIT_IF_LEASES_OFF

#define EXIT_IF_LEASES_OFF (   this,
  label 
)
Value:
do { \
if (!is_leases_enabled(this)) \
goto label; \
} while (0)

Definition at line 42 of file leases.h.

◆ GET_FLAGS

#define GET_FLAGS (   fop,
  fd_flags 
)
Value:
do { \
if ((fd_flags & (O_WRONLY | O_RDWR)) && fop == GF_FOP_OPEN) \
fop_flags = DATA_MODIFY_FOP; \
\
if (fop == GF_FOP_UNLINK || fop == GF_FOP_RENAME || \
fop == GF_FOP_TRUNCATE || fop == GF_FOP_FTRUNCATE || \
fop == GF_FOP_FLUSH || fop == GF_FOP_FSYNC || \
fop == GF_FOP_WRITE || fop == GF_FOP_FALLOCATE || \
fop == GF_FOP_DISCARD || fop == GF_FOP_ZEROFILL || \
fop == GF_FOP_SETATTR || fop == GF_FOP_FSETATTR || \
fop == GF_FOP_LINK) \
fop_flags = DATA_MODIFY_FOP; \
\
if (!(fd_flags & (O_NONBLOCK | O_NDELAY))) \
fop_flags |= BLOCKING_FOP; \
\
} while (0)

Definition at line 67 of file leases.h.

◆ GET_FLAGS_LK

#define GET_FLAGS_LK (   cmd,
  l_type,
  fd_flags 
)
Value:
do { \
/* TODO: handle F_RESLK_LCK and other glusterfs_lk_recovery_cmds_t */ \
if ((cmd == F_SETLKW || cmd == F_SETLKW64 || cmd == F_SETLK || \
cmd == F_SETLK64) && \
l_type == F_WRLCK) \
fop_flags = DATA_MODIFY_FOP; \
\
if (fd_flags & (O_NONBLOCK | O_NDELAY) && \
(cmd == F_SETLKW || cmd == F_SETLKW64)) \
fop_flags |= BLOCKING_FOP; \
\
} while (0)

Definition at line 86 of file leases.h.

◆ GET_LEASE_ID

#define GET_LEASE_ID (   xdata,
  lease_id,
  client_uid 
)
Value:
do { \
int ret_val = -1; \
ret_val = dict_get_bin(xdata, "lease-id", (void **)&lease_id); \
if (ret_val) { \
ret_val = 0; \
gf_msg_debug("leases", 0, "Lease id is not set for client:%s", \
client_uid); \
} \
} while (0)

Definition at line 56 of file leases.h.

◆ LEASE_BLOCK_FOP

#define LEASE_BLOCK_FOP (   inode,
  fop_name,
  frame,
  this,
  params... 
)

Definition at line 100 of file leases.h.

◆ RECALL_LEASE_LK_TIMEOUT

#define RECALL_LEASE_LK_TIMEOUT   "60"

Definition at line 34 of file leases.h.

◆ WIND_FOP

#define WIND_FOP   0x0002

Definition at line 40 of file leases.h.

Typedef Documentation

◆ fop_stub_t

typedef struct __fop_stub fop_stub_t

Definition at line 1 of file leases.h.

◆ lease_client_t

typedef struct _lease_client lease_client_t

Definition at line 1 of file leases.h.

◆ lease_fd_ctx_t

typedef struct _lease_fd_ctx lease_fd_ctx_t

Definition at line 1 of file leases.h.

◆ lease_id_entry_t

Definition at line 1 of file leases.h.

◆ lease_inode_ctx_t

Definition at line 1 of file leases.h.

◆ lease_inode_t

typedef struct _lease_inode lease_inode_t

Definition at line 1 of file leases.h.

◆ lease_timer_data_t

Definition at line 1 of file leases.h.

◆ leases_private_t

Definition at line 1 of file leases.h.

Function Documentation

◆ check_lease_conflict()

◆ cleanup_client_leases()

◆ expired_recall_cleanup()

◆ is_leases_enabled()

bool is_leases_enabled ( xlator_t this)

◆ lease_ctx_get()

◆ process_lease_req()

dict_get_bin
int dict_get_bin(dict_t *this, char *key, void **bin)
Definition: dict.c:2559
GF_FOP_LINK
@ GF_FOP_LINK
Definition: glusterfs-fops.h:26
GF_FOP_FSYNC
@ GF_FOP_FSYNC
Definition: glusterfs-fops.h:33
dict_get
data_t * dict_get(dict_t *this, char *key)
Definition: dict.c:544
GLUSTERFS_INTERNAL_FOP_KEY
#define GLUSTERFS_INTERNAL_FOP_KEY
Definition: glusterfs.h:166
GF_FOP_WRITE
@ GF_FOP_WRITE
Definition: glusterfs-fops.h:30
GF_FOP_FALLOCATE
@ GF_FOP_FALLOCATE
Definition: glusterfs-fops.h:63
BLOCKING_FOP
#define BLOCKING_FOP
Definition: leases.h:37
GF_FOP_FTRUNCATE
@ GF_FOP_FTRUNCATE
Definition: glusterfs-fops.h:41
is_leases_enabled
bool is_leases_enabled(xlator_t *this)
Definition: leases-internal.c:55
GF_FOP_OPEN
@ GF_FOP_OPEN
Definition: glusterfs-fops.h:28
GF_FOP_RENAME
@ GF_FOP_RENAME
Definition: glusterfs-fops.h:25
GF_FOP_UNLINK
@ GF_FOP_UNLINK
Definition: glusterfs-fops.h:22
GF_FOP_ZEROFILL
@ GF_FOP_ZEROFILL
Definition: glusterfs-fops.h:65
GF_FOP_SETATTR
@ GF_FOP_SETATTR
Definition: glusterfs-fops.h:55
GF_FOP_TRUNCATE
@ GF_FOP_TRUNCATE
Definition: glusterfs-fops.h:27
GF_FOP_DISCARD
@ GF_FOP_DISCARD
Definition: glusterfs-fops.h:64
GF_FOP_FLUSH
@ GF_FOP_FLUSH
Definition: glusterfs-fops.h:32
DATA_MODIFY_FOP
#define DATA_MODIFY_FOP
Definition: leases.h:36
GF_FOP_FSETATTR
@ GF_FOP_FSETATTR
Definition: glusterfs-fops.h:56