summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client.h
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-09-30 02:25:31 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-30 11:19:24 -0700
commitaf18c636c44b1ea56296850e55afe0e4b2ce845c (patch)
tree40f8470ec000b96d61b3f8d53286aa0812c9d921 /xlators/protocol/client/src/client.h
parent760daf28898cbb8b5072551735bebee16450ba08 (diff)
protocol/client: cluster/afr: Support lock recovery and self heal.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 865 (Add locks recovery support in GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=865
Diffstat (limited to 'xlators/protocol/client/src/client.h')
-rw-r--r--xlators/protocol/client/src/client.h43
1 files changed, 40 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 84940de5f84..a31873a027b 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -33,7 +33,7 @@
/* FIXME: Needs to be defined in a common file */
#define CLIENT_CMD_CONNECT "trusted.glusterfs.client-connect"
#define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect"
-
+#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump"
struct clnt_options {
char *remote_subvolume;
int ping_timeout;
@@ -54,6 +54,10 @@ typedef struct clnt_conf {
rpc_clnt_prog_t *mgmt;
rpc_clnt_prog_t *handshake;
rpc_clnt_prog_t *dump;
+
+ uint64_t reopen_fd_count; /* Count of fds reopened after a
+ connection is established */
+ gf_lock_t rec_lock;
} clnt_conf_t;
typedef struct _client_fd_ctx {
@@ -68,8 +72,24 @@ typedef struct _client_fd_ctx {
char released;
int32_t flags;
int32_t wbflags;
+
+ pthread_mutex_t mutex;
+ struct list_head lock_list; /* List of all granted locks on this fd */
} clnt_fd_ctx_t;
+typedef struct _client_posix_lock {
+ fd_t *fd; /* The fd on which the lk operation was made */
+
+ struct flock user_flock; /* the flock supplied by the user */
+ off_t fl_start;
+ off_t fl_end;
+ short fl_type;
+ int32_t cmd; /* the cmd for the lock call */
+ uint64_t owner; /* lock owner from fuse */
+
+ struct list_head list; /* reference used to add to the fdctx list of locks */
+} client_posix_lock_t;
+
typedef struct client_local {
loc_t loc;
loc_t loc2;
@@ -79,6 +99,12 @@ typedef struct client_local {
uint32_t wbflags;
struct iobref *iobref;
fop_cbk_fn_t op;
+
+ client_posix_lock_t *client_lock;
+ uint64_t owner;
+ int32_t cmd;
+ struct list_head lock_list;
+ pthread_mutex_t mutex;
} clnt_local_t;
typedef struct client_args {
@@ -138,6 +164,17 @@ int unserialize_rsp_direntp (struct gfs3_readdirp_rsp *rsp, gf_dirent_t *entries
int clnt_readdir_rsp_cleanup (gfs3_readdir_rsp *rsp);
int clnt_readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp);
-
-
+int client_attempt_lock_recovery (xlator_t *this, clnt_fd_ctx_t *fdctx);
+int32_t delete_granted_locks_owner (fd_t *fd, uint64_t owner);
+int client_add_lock_for_recovery (fd_t *fd, struct flock *flock, uint64_t owner,
+ int32_t cmd);
+uint64_t decrement_reopen_fd_count (xlator_t *this, clnt_conf_t *conf);
+int32_t delete_granted_locks_fd (clnt_fd_ctx_t *fdctx);
+int32_t client_cmd_to_gf_cmd (int32_t cmd, int32_t *gf_cmd);
+void client_save_number_fds (clnt_conf_t *conf, int count);
+int dump_client_locks (inode_t *inode);
+int client_notify_parents_child_up (xlator_t *this);
+int32_t is_client_dump_locks_cmd (char *name);
+int32_t client_dump_locks (char *name, inode_t *inode,
+ dict_t *dict);
#endif /* !_CLIENT_H */