diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/protocol/legacy/client/src/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/server-helpers.c | 363 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/server-helpers.h | 24 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/server-protocol.c | 634 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/server-protocol.h | 16 | ||||
-rw-r--r-- | xlators/protocol/legacy/server/src/server-resolve.c | 46 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c | 21 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/ib-verbs/src/name.c | 24 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/ib-verbs/src/name.h | 20 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/socket/src/name.c | 30 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/socket/src/name.h | 24 | ||||
-rw-r--r-- | xlators/protocol/legacy/transport/socket/src/socket.c | 90 | ||||
-rw-r--r-- | xlators/protocol/lib/src/Makefile.am | 1 |
14 files changed, 499 insertions, 798 deletions
diff --git a/xlators/protocol/legacy/client/src/Makefile.am b/xlators/protocol/legacy/client/src/Makefile.am index b7c2f7c8f77..2ae64ebd0fd 100644 --- a/xlators/protocol/legacy/client/src/Makefile.am +++ b/xlators/protocol/legacy/client/src/Makefile.am @@ -18,4 +18,4 @@ AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \ CLEANFILES = install-data-hook: - ln -sf client.so $(DESTDIR)$(xlatordir)/client-old.so + ln -sf client-old.so $(DESTDIR)$(xlatordir)/client.so diff --git a/xlators/protocol/legacy/server/src/Makefile.am b/xlators/protocol/legacy/server/src/Makefile.am index d51b5d07f6a..3ef0b81bbe2 100644 --- a/xlators/protocol/legacy/server/src/Makefile.am +++ b/xlators/protocol/legacy/server/src/Makefile.am @@ -21,4 +21,4 @@ AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS) \ CLEANFILES = install-data-hook: - ln -sf server.so $(DESTDIR)$(xlatordir)/server-old.so + ln -sf server-old.so $(DESTDIR)$(xlatordir)/server.so diff --git a/xlators/protocol/legacy/server/src/server-helpers.c b/xlators/protocol/legacy/server/src/server-helpers.c index d07e841f287..7ab2ce88531 100644 --- a/xlators/protocol/legacy/server/src/server-helpers.c +++ b/xlators/protocol/legacy/server/src/server-helpers.c @@ -26,148 +26,6 @@ #include "server-helpers.h" -/* server_loc_fill - derive a loc_t for a given inode number - * - * NOTE: make sure that @loc is empty, because any pointers it holds with reference will - * be leaked after returning from here. - */ -int -server_loc_fill (loc_t *loc, server_state_t *state, - ino_t ino, ino_t par, - const char *name, const char *path) -{ - inode_t *inode = NULL; - inode_t *parent = NULL; - int32_t ret = -1; - char *dentry_path = NULL; - - - GF_VALIDATE_OR_GOTO ("server", loc, out); - GF_VALIDATE_OR_GOTO ("server", state, out); - GF_VALIDATE_OR_GOTO ("server", path, out); - - /* anything beyond this point is success */ - ret = 0; - loc->ino = ino; - inode = loc->inode; - if (inode == NULL) { - if (ino) - inode = inode_search (state->itable, ino, NULL); - - if ((inode == NULL) && - (par && name)) - inode = inode_search (state->itable, par, name); - - loc->inode = inode; - if (inode) - loc->ino = inode->ino; - } - - parent = loc->parent; - if (parent == NULL) { - if (inode) - parent = inode_parent (inode, par, name); - else - parent = inode_search (state->itable, par, NULL); - loc->parent = parent; - } - - if (name && parent) { - ret = inode_path (parent, name, &dentry_path); - if (ret < 0) { - gf_log (state->bound_xl->name, GF_LOG_DEBUG, - "failed to build path for %"PRId64"/%s: %s", - parent->ino, name, strerror (-ret)); - } - } else if (inode) { - ret = inode_path (inode, NULL, &dentry_path); - if (ret < 0) { - gf_log (state->bound_xl->name, GF_LOG_DEBUG, - "failed to build path for %"PRId64": %s", - inode->ino, strerror (-ret)); - } - } - - if (dentry_path) { - if (strcmp (dentry_path, path)) { - gf_log (state->bound_xl->name, GF_LOG_DEBUG, - "paths differ for inode(%"PRId64"): " - "client path = %s. dentry path = %s", - ino, path, dentry_path); - } - - loc->path = dentry_path; - loc->name = strrchr (loc->path, '/'); - if (loc->name) - loc->name++; - } else { - loc->path = gf_strdup (path); - loc->name = strrchr (loc->path, '/'); - if (loc->name) - loc->name++; - } - -out: - return ret; -} - -/* - * stat_to_str - convert struct iatt to a ASCII string - * @stbuf: struct iatt pointer - * - * not for external reference - */ -char * -stat_to_str (struct iatt *stbuf) -{ - int ret = 0; - char *tmp_buf = NULL; - - uint64_t dev = stbuf->ia_gen; - uint64_t ino = stbuf->ia_ino; - uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); - uint32_t nlink = stbuf->ia_nlink; - uint32_t uid = stbuf->ia_uid; - uint32_t gid = stbuf->ia_gid; - uint64_t rdev = stbuf->ia_rdev; - uint64_t size = stbuf->ia_size; - uint32_t blksize = stbuf->ia_blksize; - uint64_t blocks = stbuf->ia_blocks; - uint32_t atime = stbuf->ia_atime; - uint32_t mtime = stbuf->ia_mtime; - uint32_t ctime = stbuf->ia_ctime; - - uint32_t atime_nsec = stbuf->ia_atime_nsec; - uint32_t mtime_nsec = stbuf->ia_mtime_nsec; - uint32_t ctime_nsec = stbuf->ia_ctime_nsec; - - - ret = gf_asprintf (&tmp_buf, - GF_STAT_PRINT_FMT_STR, - dev, - ino, - mode, - nlink, - uid, - gid, - rdev, - size, - blksize, - blocks, - atime, - atime_nsec, - mtime, - mtime_nsec, - ctime, - ctime_nsec); - if (-1 == ret) { - gf_log ("protocol/server", GF_LOG_DEBUG, - "asprintf failed while setting up stat buffer string"); - return NULL; - } - return tmp_buf; -} - void server_loc_wipe (loc_t *loc) @@ -216,7 +74,7 @@ server_resolve_wipe (server_resolve_t *resolve) void -free_state (server_state_t *state) +free_server_state (server_state_t *state) { if (state->trans) { transport_unref (state->trans); @@ -258,180 +116,6 @@ free_state (server_state_t *state) GF_FREE (state); } - -call_frame_t * -server_copy_frame (call_frame_t *frame) -{ - call_frame_t *new_frame = NULL; - server_state_t *state = NULL, *new_state = NULL; - - state = frame->root->state; - - new_frame = copy_frame (frame); - - new_state = GF_CALLOC (1, sizeof (server_state_t), - gf_server_mt_server_state_t); - - new_frame->root->op = frame->root->op; - new_frame->root->type = frame->root->type; - new_frame->root->trans = state->trans; - new_frame->root->state = new_state; - - new_state->bound_xl = state->bound_xl; - new_state->trans = transport_ref (state->trans); - new_state->itable = state->itable; - - new_state->resolve.fd_no = -1; - new_state->resolve2.fd_no = -1; - - return new_frame; -} - - -int -gf_add_locker (struct _lock_table *table, const char *volume, - loc_t *loc, fd_t *fd, pid_t pid) -{ - int32_t ret = -1; - struct _locker *new = NULL; - uint8_t dir = 0; - - new = GF_CALLOC (1, sizeof (struct _locker), - gf_server_mt_locker); - if (new == NULL) { - gf_log ("server", GF_LOG_ERROR, - "failed to allocate memory for \'struct _locker\'"); - goto out; - } - INIT_LIST_HEAD (&new->lockers); - - new->volume = gf_strdup (volume); - - if (fd == NULL) { - loc_copy (&new->loc, loc); - dir = IA_ISDIR (new->loc.inode->ia_type); - } else { - new->fd = fd_ref (fd); - dir = IA_ISDIR (fd->inode->ia_type); - } - - new->pid = pid; - - LOCK (&table->lock); - { - if (dir) - list_add_tail (&new->lockers, &table->dir_lockers); - else - list_add_tail (&new->lockers, &table->file_lockers); - } - UNLOCK (&table->lock); -out: - return ret; -} - - -int -gf_del_locker (struct _lock_table *table, const char *volume, - loc_t *loc, fd_t *fd, pid_t pid) -{ - struct _locker *locker = NULL; - struct _locker *tmp = NULL; - int32_t ret = 0; - uint8_t dir = 0; - struct list_head *head = NULL; - struct list_head del; - - INIT_LIST_HEAD (&del); - - if (fd) { - dir = IA_ISDIR (fd->inode->ia_type); - } else { - dir = IA_ISDIR (loc->inode->ia_type); - } - - LOCK (&table->lock); - { - if (dir) { - head = &table->dir_lockers; - } else { - head = &table->file_lockers; - } - - list_for_each_entry_safe (locker, tmp, head, lockers) { - if (locker->fd && fd && - (locker->fd == fd) && (locker->pid == pid) - && !strcmp (locker->volume, volume)) { - list_move_tail (&locker->lockers, &del); - } else if (locker->loc.inode && - loc && - (locker->loc.inode == loc->inode) && - (locker->pid == pid) - && !strcmp (locker->volume, volume)) { - list_move_tail (&locker->lockers, &del); - } - } - } - UNLOCK (&table->lock); - - tmp = NULL; - locker = NULL; - - list_for_each_entry_safe (locker, tmp, &del, lockers) { - list_del_init (&locker->lockers); - if (locker->fd) - fd_unref (locker->fd); - else - loc_wipe (&locker->loc); - - GF_FREE (locker->volume); - GF_FREE (locker); - } - - return ret; -} - - -int -gf_direntry_to_bin (dir_entry_t *head, char *buffer) -{ - dir_entry_t *trav = NULL; - uint32_t len = 0; - uint32_t this_len = 0; - size_t buflen = -1; - char *ptr = NULL; - char *tmp_buf = NULL; - - trav = head->next; - while (trav) { - len += strlen (trav->name); - len += 1; - len += strlen (trav->link); - len += 1; /* for '\n' */ - len += 256; // max possible for statbuf; - trav = trav->next; - } - - ptr = buffer; - trav = head->next; - while (trav) { - tmp_buf = stat_to_str (&trav->buf); - /* tmp_buf will have \n before \0 */ - - this_len = sprintf (ptr, "%s/%s%s\n", - trav->name, tmp_buf, - trav->link); - - GF_FREE (tmp_buf); - trav = trav->next; - ptr += this_len; - } - - buflen = strlen (buffer); - - return buflen; -} - - static struct _lock_table * gf_lock_table_new (void) { @@ -452,7 +136,22 @@ out: } -int +static int +gf_server_nop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + server_state_t *state = NULL; + + state = CALL_STATE(frame); + + if (state) + free_state (state); + STACK_DESTROY (frame->root); + return 0; +} + + +static int do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame, struct _lock_table *ltable) { @@ -497,14 +196,14 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, tmp_frame->root->trans = conn; if (locker->fd) { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->finodelk, locker->volume, locker->fd, F_SETLK, &flock); fd_unref (locker->fd); } else { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->inodelk, locker->volume, @@ -527,7 +226,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, tmp_frame->root->trans = conn; if (locker->fd) { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->fentrylk, locker->volume, @@ -535,7 +234,7 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); fd_unref (locker->fd); } else { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->entrylk, locker->volume, @@ -573,7 +272,7 @@ server_connection_cleanup_flush_cbk (call_frame_t *frame, void *cookie, } -int +static int do_fd_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame, fdentry_t *fdentries, int fd_count) { @@ -611,7 +310,7 @@ out: return ret; } -int +static int do_connection_cleanup (xlator_t *this, server_connection_t *conn, struct _lock_table *ltable, fdentry_t *fdentries, int fd_count) { @@ -648,7 +347,7 @@ out: int -server_connection_cleanup (xlator_t *this, server_connection_t *conn) +gf_server_connection_cleanup (xlator_t *this, server_connection_t *conn) { char do_cleanup = 0; struct _lock_table *ltable = NULL; @@ -686,7 +385,7 @@ out: } -int +static int server_connection_destroy (xlator_t *this, server_connection_t *conn) { call_frame_t *frame = NULL, *tmp_frame = NULL; @@ -752,14 +451,14 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) tmp_frame->root->trans = conn; if (locker->fd) { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->finodelk, locker->volume, locker->fd, F_SETLK, &flock); fd_unref (locker->fd); } else { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->inodelk, locker->volume, @@ -782,7 +481,7 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) tmp_frame->root->trans = conn; if (locker->fd) { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->fentrylk, locker->volume, @@ -790,7 +489,7 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn) ENTRYLK_UNLOCK, ENTRYLK_WRLCK); fd_unref (locker->fd); } else { - STACK_WIND (tmp_frame, server_nop_cbk, + STACK_WIND (tmp_frame, gf_server_nop_cbk, bound_xl, bound_xl->fops->entrylk, locker->volume, @@ -854,7 +553,7 @@ out: server_connection_t * -server_connection_get (xlator_t *this, const char *id) +gf_server_connection_get (xlator_t *this, const char *id) { server_connection_t *conn = NULL; server_connection_t *trav = NULL; @@ -894,7 +593,7 @@ server_connection_get (xlator_t *this, const char *id) void -server_connection_put (xlator_t *this, server_connection_t *conn) +gf_server_connection_put (xlator_t *this, server_connection_t *conn) { server_conf_t *conf = NULL; server_connection_t *todel = NULL; diff --git a/xlators/protocol/legacy/server/src/server-helpers.h b/xlators/protocol/legacy/server/src/server-helpers.h index cbf57ae44d1..137b2e9c2c3 100644 --- a/xlators/protocol/legacy/server/src/server-helpers.h +++ b/xlators/protocol/legacy/server/src/server-helpers.h @@ -41,32 +41,8 @@ #define IS_NOT_ROOT(pathlen) ((pathlen > 2)? 1 : 0) -char * -stat_to_str (struct iatt *stbuf); - -call_frame_t * -server_copy_frame (call_frame_t *frame); - void free_state (server_state_t *state); void server_loc_wipe (loc_t *loc); -int32_t -gf_add_locker (struct _lock_table *table, const char *volume, - loc_t *loc, - fd_t *fd, - pid_t pid); - -int32_t -gf_del_locker (struct _lock_table *table, const char *volume, - loc_t *loc, - fd_t *fd, - pid_t pid); - -int32_t -gf_direntry_to_bin (dir_entry_t *head, char *bufferp); - -void -server_print_request (call_frame_t *frame); - #endif /* __SERVER_HELPERS_H__ */ diff --git a/xlators/protocol/legacy/server/src/server-protocol.c b/xlators/protocol/legacy/server/src/server-protocol.c index de7d2ac0b5a..6a48dff390a 100644 --- a/xlators/protocol/legacy/server/src/server-protocol.c +++ b/xlators/protocol/legacy/server/src/server-protocol.c @@ -44,7 +44,7 @@ #include "md5.h" -void +static void print_caller (char *str, int size, call_frame_t *frame) { int filled = 0; @@ -63,7 +63,7 @@ print_caller (char *str, int size, call_frame_t *frame) } -void +static void server_print_resolve (char *str, int size, server_resolve_t *resolve) { int filled = 0; @@ -98,7 +98,7 @@ server_print_resolve (char *str, int size, server_resolve_t *resolve) } -void +static void server_print_loc (char *str, int size, loc_t *loc) { int filled = 0; @@ -125,7 +125,7 @@ server_print_loc (char *str, int size, loc_t *loc) } -void +static void server_print_params (char *str, int size, server_state_t *state) { int filled = 0; @@ -172,7 +172,7 @@ server_print_params (char *str, int size, server_state_t *state) } -int +static int server_resolve_is_empty (server_resolve_t *resolve) { if (resolve->fd_no != -1) @@ -196,27 +196,48 @@ server_resolve_is_empty (server_resolve_t *resolve) return 1; } - void -server_print_reply (call_frame_t *frame, int op_ret, int op_errno) +gf_server_print_request (call_frame_t *frame) { server_conf_t *conf = NULL; - server_state_t *state = NULL; xlator_t *this = NULL; + server_state_t *state = NULL; + char resolve_vars[256]; + char resolve2_vars[256]; + char loc_vars[256]; + char loc2_vars[256]; + char other_vars[512]; char caller[512]; - char fdstr[32]; char *op = "UNKNOWN"; this = frame->this; conf = this->private; + state = CALL_STATE (frame); + if (!conf->trace) return; - state = CALL_STATE (frame); + memset (resolve_vars, '\0', 256); + memset (resolve2_vars, '\0', 256); + memset (loc_vars, '\0', 256); + memset (loc2_vars, '\0', 256); + memset (other_vars, '\0', 256); print_caller (caller, 256, frame); + if (!server_resolve_is_empty (&state->resolve)) { + server_print_resolve (resolve_vars, 256, &state->resolve); + server_print_loc (loc_vars, 256, &state->loc); + } + + if (!server_resolve_is_empty (&state->resolve2)) { + server_print_resolve (resolve2_vars, 256, &state->resolve2); + server_print_loc (loc2_vars, 256, &state->loc2); + } + + server_print_params (other_vars, 512, state); + switch (frame->root->type) { case GF_OP_TYPE_FOP_REQUEST: case GF_OP_TYPE_FOP_REPLY: @@ -232,58 +253,33 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno) break; } - fdstr[0] = '\0'; - if (state->fd) - snprintf (fdstr, 32, " fd=%p", state->fd); - gf_log (this->name, GF_LOG_NORMAL, - "%s%s => (%d, %d)%s", - op, caller, op_ret, op_errno, fdstr); + "%s%s%s%s%s%s%s", + gf_fop_list[frame->root->op], caller, + resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars); } -void -server_print_request (call_frame_t *frame) +static void +server_print_reply (call_frame_t *frame, int op_ret, int op_errno) { server_conf_t *conf = NULL; - xlator_t *this = NULL; server_state_t *state = NULL; - char resolve_vars[256]; - char resolve2_vars[256]; - char loc_vars[256]; - char loc2_vars[256]; - char other_vars[512]; + xlator_t *this = NULL; char caller[512]; + char fdstr[32]; char *op = "UNKNOWN"; this = frame->this; conf = this->private; - state = CALL_STATE (frame); - if (!conf->trace) return; - memset (resolve_vars, '\0', 256); - memset (resolve2_vars, '\0', 256); - memset (loc_vars, '\0', 256); - memset (loc2_vars, '\0', 256); - memset (other_vars, '\0', 256); + state = CALL_STATE (frame); print_caller (caller, 256, frame); - if (!server_resolve_is_empty (&state->resolve)) { - server_print_resolve (resolve_vars, 256, &state->resolve); - server_print_loc (loc_vars, 256, &state->loc); - } - - if (!server_resolve_is_empty (&state->resolve2)) { - server_print_resolve (resolve2_vars, 256, &state->resolve2); - server_print_loc (loc2_vars, 256, &state->loc2); - } - - server_print_params (other_vars, 512, state); - switch (frame->root->type) { case GF_OP_TYPE_FOP_REQUEST: case GF_OP_TYPE_FOP_REPLY: @@ -299,13 +295,17 @@ server_print_request (call_frame_t *frame) break; } + fdstr[0] = '\0'; + if (state->fd) + snprintf (fdstr, 32, " fd=%p", state->fd); + gf_log (this->name, GF_LOG_NORMAL, - "%s%s%s%s%s%s%s", - gf_fop_list[frame->root->op], caller, - resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars); + "%s%s => (%d, %d)%s", + op, caller, op_ret, op_errno, fdstr); } + static void protocol_server_reply (call_frame_t *frame, int type, int op, gf_hdr_common_t *hdr, size_t hdrlen, @@ -347,6 +347,109 @@ protocol_server_reply (call_frame_t *frame, int type, int op, } +static int +gf_add_locker (struct _lock_table *table, const char *volume, + loc_t *loc, fd_t *fd, pid_t pid) +{ + int32_t ret = -1; + struct _locker *new = NULL; + uint8_t dir = 0; + + new = GF_CALLOC (1, sizeof (struct _locker), + gf_server_mt_locker); + if (new == NULL) { + gf_log ("server", GF_LOG_ERROR, + "failed to allocate memory for \'struct _locker\'"); + goto out; + } + INIT_LIST_HEAD (&new->lockers); + + new->volume = gf_strdup (volume); + + if (fd == NULL) { + loc_copy (&new->loc, loc); + dir = IA_ISDIR (new->loc.inode->ia_type); + } else { + new->fd = fd_ref (fd); + dir = IA_ISDIR (fd->inode->ia_type); + } + + new->pid = pid; + + LOCK (&table->lock); + { + if (dir) + list_add_tail (&new->lockers, &table->dir_lockers); + else + list_add_tail (&new->lockers, &table->file_lockers); + } + UNLOCK (&table->lock); +out: + return ret; +} + + +static int +gf_del_locker (struct _lock_table *table, const char *volume, + loc_t *loc, fd_t *fd, pid_t pid) +{ + struct _locker *locker = NULL; + struct _locker *tmp = NULL; + int32_t ret = 0; + uint8_t dir = 0; + struct list_head *head = NULL; + struct list_head del; + + INIT_LIST_HEAD (&del); + + if (fd) { + dir = IA_ISDIR (fd->inode->ia_type); + } else { + dir = IA_ISDIR (loc->inode->ia_type); + } + + LOCK (&table->lock); + { + if (dir) { + head = &table->dir_lockers; + } else { + head = &table->file_lockers; + } + + list_for_each_entry_safe (locker, tmp, head, lockers) { + if (locker->fd && fd && + (locker->fd == fd) && (locker->pid == pid) + && !strcmp (locker->volume, volume)) { + list_move_tail (&locker->lockers, &del); + } else if (locker->loc.inode && + loc && + (locker->loc.inode == loc->inode) && + (locker->pid == pid) + && !strcmp (locker->volume, volume)) { + list_move_tail (&locker->lockers, &del); + } + } + } + UNLOCK (&table->lock); + + tmp = NULL; + locker = NULL; + + list_for_each_entry_safe (locker, tmp, &del, lockers) { + list_del_init (&locker->lockers); + if (locker->fd) + fd_unref (locker->fd); + else + loc_wipe (&locker->loc); + + GF_FREE (locker->volume); + GF_FREE (locker); + } + + return ret; +} + + /* * server_lk_cbk - lk callback for server protocol * @frame: call frame @@ -358,7 +461,7 @@ protocol_server_reply (call_frame_t *frame, int type, int op, * * not for external reference */ -int +static int server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct flock *lock) { @@ -395,7 +498,7 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -440,7 +543,7 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -498,7 +601,7 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -543,7 +646,7 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -597,7 +700,7 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -633,7 +736,7 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, struct iatt *postparent) @@ -693,7 +796,7 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, @@ -749,7 +852,7 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, @@ -804,7 +907,7 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -850,7 +953,7 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) { @@ -902,7 +1005,7 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_releasedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -937,7 +1040,7 @@ server_releasedir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd) { @@ -992,7 +1095,7 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct statvfs *buf) { @@ -1032,7 +1135,7 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1069,7 +1172,7 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) { @@ -1123,7 +1226,7 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) { @@ -1187,7 +1290,7 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1214,7 +1317,7 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1251,7 +1354,7 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf, struct iatt *preoldparent, struct iatt *postoldparent, @@ -1314,7 +1417,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *preparent, struct iatt *postparent) @@ -1379,7 +1482,7 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, @@ -1436,7 +1539,7 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, struct iatt *preparent, @@ -1505,7 +1608,7 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf) @@ -1554,7 +1657,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf) { @@ -1601,7 +1704,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf) @@ -1650,7 +1753,7 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1693,7 +1796,7 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf) @@ -1743,7 +1846,7 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1777,7 +1880,7 @@ server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * not for external reference */ -int +static int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf) @@ -1828,7 +1931,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iovec *vector, int32_t count, @@ -1878,7 +1981,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd) { @@ -1936,7 +2039,7 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, struct iatt *stbuf, @@ -2034,7 +2137,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, const char *buf, struct iatt *sbuf) @@ -2088,7 +2191,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *stbuf) { @@ -2136,7 +2239,7 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * not for external reference */ -int +static int server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *statpre, struct iatt *statpost) @@ -2185,7 +2288,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *statpre, struct iatt *statpost) @@ -2237,7 +2340,7 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * * not for external reference */ -int +static int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct iatt *stbuf, dict_t *dict, @@ -2348,7 +2451,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) { @@ -2411,7 +2514,7 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) { @@ -2476,7 +2579,7 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int +static int server_lookup_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2504,7 +2607,7 @@ err: } -int +static int server_lookup (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2563,7 +2666,7 @@ server_lookup (call_frame_t *frame, xlator_t *bound_xl, state->dict = xattr_req; } - resolve_and_resume (frame, server_lookup_resume); + gf_resolve_and_resume (frame, server_lookup_resume); return 0; err: @@ -2581,7 +2684,7 @@ err: * * not for external reference */ -int +static int server_forget (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2591,7 +2694,7 @@ server_forget (call_frame_t *frame, xlator_t *bound_xl, } -int +static int server_stat_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2611,7 +2714,7 @@ err: } -int +static int server_stat (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2628,13 +2731,13 @@ server_stat (call_frame_t *frame, xlator_t *bound_xl, state->resolve.path = gf_strdup (req->path); } - resolve_and_resume (frame, server_stat_resume); + gf_resolve_and_resume (frame, server_stat_resume); return 0; } -int +static int server_setattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2656,7 +2759,7 @@ err: } -int +static int server_setattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2675,13 +2778,13 @@ server_setattr (call_frame_t *frame, xlator_t *bound_xl, gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); - resolve_and_resume (frame, server_setattr_resume); + gf_resolve_and_resume (frame, server_setattr_resume); return 0; } -int +static int server_fsetattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2703,7 +2806,7 @@ err: } -int +static int server_fsetattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2721,13 +2824,13 @@ server_fsetattr (call_frame_t *frame, xlator_t *bound_xl, gf_stat_to_iatt (&req->stbuf, &state->stbuf); state->valid = ntoh32 (req->valid); - resolve_and_resume (frame, server_fsetattr_resume); + gf_resolve_and_resume (frame, server_fsetattr_resume); return 0; } -int +static int server_readlink_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2748,7 +2851,7 @@ err: } -int +static int server_readlink (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2766,13 +2869,13 @@ server_readlink (call_frame_t *frame, xlator_t *bound_xl, state->size = ntoh32 (req->size); - resolve_and_resume (frame, server_readlink_resume); + gf_resolve_and_resume (frame, server_readlink_resume); return 0; } -int +static int server_create_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2800,7 +2903,7 @@ err: } -int +static int server_create (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2822,13 +2925,13 @@ server_create (call_frame_t *frame, xlator_t *bound_xl, state->mode = ntoh32 (req->mode); state->flags = gf_flags_to_flags (ntoh32 (req->flags)); - resolve_and_resume (frame, server_create_resume); + gf_resolve_and_resume (frame, server_create_resume); return 0; } -int +static int server_open_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2853,7 +2956,7 @@ err: } -int +static int server_open (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2871,13 +2974,13 @@ server_open (call_frame_t *frame, xlator_t *bound_xl, state->flags = gf_flags_to_flags (ntoh32 (req->flags)); - resolve_and_resume (frame, server_open_resume); + gf_resolve_and_resume (frame, server_open_resume); return 0; } -int +static int server_readv_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2899,7 +3002,7 @@ err: } -int +static int server_readv (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2915,13 +3018,13 @@ server_readv (call_frame_t *frame, xlator_t *bound_xl, state->size = ntoh32 (req->size); state->offset = ntoh64 (req->offset); - resolve_and_resume (frame, server_readv_resume); + gf_resolve_and_resume (frame, server_readv_resume); return 0; } -int +static int server_writev_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -2950,7 +3053,7 @@ err: } -int +static int server_writev (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -2975,13 +3078,13 @@ server_writev (call_frame_t *frame, xlator_t *bound_xl, state->iobref = iobref; } - resolve_and_resume (frame, server_writev_resume); + gf_resolve_and_resume (frame, server_writev_resume); return 0; } -int +static int server_release (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3004,7 +3107,7 @@ server_release (call_frame_t *frame, xlator_t *bound_xl, } -int +static int server_fsync_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3026,7 +3129,7 @@ err: } -int +static int server_fsync (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3041,14 +3144,14 @@ server_fsync (call_frame_t *frame, xlator_t *bound_xl, state->resolve.fd_no = ntoh64 (req->fd); state->flags = ntoh32 (req->data); - resolve_and_resume (frame, server_fsync_resume); + gf_resolve_and_resume (frame, server_fsync_resume); return 0; } -int +static int server_flush_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3069,7 +3172,7 @@ err: } -int +static int server_flush (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3083,14 +3186,14 @@ server_flush (call_frame_t *frame, xlator_t *bound_xl, state->resolve.type = RESOLVE_MUST; state->resolve.fd_no = ntoh64 (req->fd); - resolve_and_resume (frame, server_flush_resume); + gf_resolve_and_resume (frame, server_flush_resume); return 0; } -int +static int server_ftruncate_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3112,7 +3215,7 @@ err: } -int +static int server_ftruncate (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3127,13 +3230,13 @@ server_ftruncate (call_frame_t *frame, xlator_t *bound_xl, state->resolve.fd_no = ntoh64 (req->fd); state->offset = ntoh64 (req->offset); - resolve_and_resume (frame, server_ftruncate_resume); + gf_resolve_and_resume (frame, server_ftruncate_resume); return 0; } -int +static int server_fstat_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3154,7 +3257,7 @@ err: } -int +static int server_fstat (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3168,13 +3271,13 @@ server_fstat (call_frame_t *frame, xlator_t *bound_xl, state->resolve.type = RESOLVE_MUST; state->resolve.fd_no = ntoh64 (req->fd); - resolve_and_resume (frame, server_fstat_resume); + gf_resolve_and_resume (frame, server_fstat_resume); return 0; } -int +static int server_truncate_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3196,7 +3299,7 @@ err: -int +static int server_truncate (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3213,13 +3316,13 @@ server_truncate (call_frame_t *frame, xlator_t *bound_xl, state->resolve.gen = ntoh64 (req->gen); state->offset = ntoh64 (req->offset); - resolve_and_resume (frame, server_truncate_resume); + gf_resolve_and_resume (frame, server_truncate_resume); return 0; } -int +static int server_unlink_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3240,7 +3343,7 @@ err: } -int +static int server_unlink (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3260,13 +3363,13 @@ server_unlink (call_frame_t *frame, xlator_t *bound_xl, state->resolve.path = gf_strdup (req->path); state->resolve.bname = gf_strdup (req->bname + pathlen); - resolve_and_resume (frame, server_unlink_resume); + gf_resolve_and_resume (frame, server_unlink_resume); return 0; } -int +static int server_setxattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3288,7 +3391,7 @@ err: } -int +static int server_setxattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3331,7 +3434,7 @@ server_setxattr (call_frame_t *frame, xlator_t *bound_xl, state->dict = dict; } - resolve_and_resume (frame, server_setxattr_resume); + gf_resolve_and_resume (frame, server_setxattr_resume); return 0; err: @@ -3345,7 +3448,7 @@ err: } -int +static int server_fsetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3367,7 +3470,7 @@ err: } -int +static int server_fsetxattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3408,7 +3511,7 @@ server_fsetxattr (call_frame_t *frame, xlator_t *bound_xl, state->dict = dict; } - resolve_and_resume (frame, server_fsetxattr_resume); + gf_resolve_and_resume (frame, server_fsetxattr_resume); return 0; err: @@ -3421,7 +3524,7 @@ err: } -int +static int server_fxattrop_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3442,7 +3545,7 @@ err: } -int +static int server_fxattrop (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3486,7 +3589,7 @@ server_fxattrop (call_frame_t *frame, xlator_t *bound_xl, dict = NULL; } - resolve_and_resume (frame, server_fxattrop_resume); + gf_resolve_and_resume (frame, server_fxattrop_resume); return 0; @@ -3499,7 +3602,7 @@ fail: } -int +static int server_xattrop_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3520,7 +3623,7 @@ err: } -int +static int server_xattrop (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3563,7 +3666,7 @@ server_xattrop (call_frame_t *frame, xlator_t *bound_xl, dict = NULL; } - resolve_and_resume (frame, server_xattrop_resume); + gf_resolve_and_resume (frame, server_xattrop_resume); return 0; @@ -3576,7 +3679,7 @@ fail: } -int +static int server_getxattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3597,7 +3700,7 @@ err: } -int +static int server_getxattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3621,13 +3724,13 @@ server_getxattr (call_frame_t *frame, xlator_t *bound_xl, if (namelen) state->name = gf_strdup (req->name + pathlen); - resolve_and_resume (frame, server_getxattr_resume); + gf_resolve_and_resume (frame, server_getxattr_resume); return 0; } -int +static int server_fgetxattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3648,7 +3751,7 @@ err: } -int +static int server_fgetxattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3667,13 +3770,13 @@ server_fgetxattr (call_frame_t *frame, xlator_t *bound_xl, if (namelen) state->name = gf_strdup (req->name); - resolve_and_resume (frame, server_fgetxattr_resume); + gf_resolve_and_resume (frame, server_fgetxattr_resume); return 0; } -int +static int server_removexattr_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3694,7 +3797,7 @@ err: } -int +static int server_removexattr (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3713,13 +3816,13 @@ server_removexattr (call_frame_t *frame, xlator_t *bound_xl, state->resolve.gen = ntoh64 (req->gen); state->name = gf_strdup (req->name + pathlen); - resolve_and_resume (frame, server_removexattr_resume); + gf_resolve_and_resume (frame, server_removexattr_resume); return 0; } -int +static int server_statfs_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3741,7 +3844,7 @@ err: } -int +static int server_statfs (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3760,13 +3863,13 @@ server_statfs (call_frame_t *frame, xlator_t *bound_xl, state->resolve.gen = ntoh64 (req->gen); state->resolve.path = gf_strdup (req->path); - resolve_and_resume (frame, server_statfs_resume); + gf_resolve_and_resume (frame, server_statfs_resume); return 0; } -int +static int server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3789,7 +3892,7 @@ err: } -int +static int server_opendir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3805,13 +3908,13 @@ server_opendir (call_frame_t *frame, xlator_t *bound_xl, state->resolve.ino = ntoh64 (req->ino); state->resolve.gen = ntoh64 (req->gen); - resolve_and_resume (frame, server_opendir_resume); + gf_resolve_and_resume (frame, server_opendir_resume); return 0; } -int +static int server_releasedir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3843,7 +3946,7 @@ server_releasedir (call_frame_t *frame, xlator_t *bound_xl, * * not for external reference */ -int +static int server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) { @@ -3885,7 +3988,7 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } -int +static int server_readdirp_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3914,7 +4017,7 @@ err: * * not for external reference */ -int +static int server_readdirp (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) { @@ -3932,13 +4035,13 @@ server_readdirp (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, state->size = ntoh32 (req->size); state->offset = ntoh64 (req->offset); - resolve_and_resume (frame, server_readdirp_resume); + gf_resolve_and_resume (frame, server_readdirp_resume); return 0; } -int +static int server_readdir_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -3967,7 +4070,7 @@ err: * * not for external reference */ -int +static int server_readdir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -3986,12 +4089,12 @@ server_readdir (call_frame_t *frame, xlator_t *bound_xl, state->size = ntoh32 (req->size); state->offset = ntoh64 (req->offset); - resolve_and_resume (frame, server_readdir_resume); + gf_resolve_and_resume (frame, server_readdir_resume); return 0; } -int +static int server_fsyncdir_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4022,7 +4125,7 @@ err: * * not for external reference */ -int +static int server_fsyncdir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4040,13 +4143,13 @@ server_fsyncdir (call_frame_t *frame, xlator_t *bound_xl, state->resolve.fd_no = ntoh64 (req->fd); state->flags = ntoh32 (req->data); - resolve_and_resume (frame, server_fsyncdir_resume); + gf_resolve_and_resume (frame, server_fsyncdir_resume); return 0; } -int +static int server_mknod_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4071,7 +4174,7 @@ err: -int +static int server_mknod (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4093,13 +4196,13 @@ server_mknod (call_frame_t *frame, xlator_t *bound_xl, state->mode = ntoh32 (req->mode); state->dev = ntoh64 (req->dev); - resolve_and_resume (frame, server_mknod_resume); + gf_resolve_and_resume (frame, server_mknod_resume); return 0; } -int +static int server_mkdir_resume (call_frame_t *frame, xlator_t *bound_xl) { @@ -4124,7 +4227,7 @@ err: } -int +static int server_mkdir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4145,13 +4248,13 @@ server_mkdir (call_frame_t *frame, xlator_t *bound_xl, state->mode = ntoh32 (req->mode); - resolve_and_resume (frame, server_mkdir_resume); + gf_resolve_and_resume (frame, server_mkdir_resume); return 0; } -int +static int server_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4170,7 +4273,7 @@ err: return 0; } -int +static int server_rmdir (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4189,13 +4292,13 @@ server_rmdir (call_frame_t *frame, xlator_t *bound_xl, state->resolve.path = gf_strdup (req->path); state->resolve.bname = gf_strdup (req->bname + pathlen); - resolve_and_resume (frame, server_rmdir_resume); + gf_resolve_and_resume (frame, server_rmdir_resume); return 0; } -int +static int server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4216,7 +4319,7 @@ err: } -int +static int server_inodelk (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4267,12 +4370,12 @@ server_inodelk (call_frame_t *frame, xlator_t *bound_xl, break; } - resolve_and_resume (frame, server_inodelk_resume); + gf_resolve_and_resume (frame, server_inodelk_resume); return 0; } -int +static int server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4295,7 +4398,7 @@ err: return 0; } -int +static int server_finodelk (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4342,13 +4445,13 @@ server_finodelk (call_frame_t *frame, xlator_t *bound_xl, break; } - resolve_and_resume (frame, server_finodelk_resume); + gf_resolve_and_resume (frame, server_finodelk_resume); return 0; } -int +static int server_entrylk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4370,7 +4473,7 @@ err: } -int +static int server_entrylk (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4399,12 +4502,12 @@ server_entrylk (call_frame_t *frame, xlator_t *bound_xl, state->cmd = ntoh32 (req->cmd); state->type = ntoh32 (req->type); - resolve_and_resume (frame, server_entrylk_resume); + gf_resolve_and_resume (frame, server_entrylk_resume); return 0; } -int +static int server_fentrylk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4427,7 +4530,7 @@ err: return 0; } -int +static int server_fentrylk (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4454,13 +4557,13 @@ server_fentrylk (call_frame_t *frame, xlator_t *bound_xl, state->volume = gf_strdup (req->volume + namelen); - resolve_and_resume (frame, server_finodelk_resume); + gf_resolve_and_resume (frame, server_fentrylk_resume); return 0; } -int +static int server_access_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4481,7 +4584,7 @@ err: } -int +static int server_access (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4499,13 +4602,13 @@ server_access (call_frame_t *frame, xlator_t *bound_xl, state->mask = ntoh32 (req->mask); - resolve_and_resume (frame, server_access_resume); + gf_resolve_and_resume (frame, server_access_resume); return 0; } -int +static int server_symlink_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4530,7 +4633,7 @@ err: -int +static int server_symlink (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4552,13 +4655,13 @@ server_symlink (call_frame_t *frame, xlator_t *bound_xl, state->resolve.bname = gf_strdup (req->bname + pathlen); state->name = gf_strdup (req->linkname + pathlen + baselen); - resolve_and_resume (frame, server_symlink_resume); + gf_resolve_and_resume (frame, server_symlink_resume); return 0; } -int +static int server_link_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4592,7 +4695,7 @@ err: } -int +static int server_link (call_frame_t *frame, xlator_t *this, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4620,13 +4723,13 @@ server_link (call_frame_t *frame, xlator_t *this, state->resolve2.par = ntoh64 (req->newpar); state->resolve2.gen = ntoh64 (req->newgen); - resolve_and_resume (frame, server_link_resume); + gf_resolve_and_resume (frame, server_link_resume); return 0; } -int +static int server_rename_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4658,7 +4761,7 @@ err: } -int +static int server_rename (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4692,12 +4795,12 @@ server_rename (call_frame_t *frame, xlator_t *bound_xl, state->resolve2.par = ntoh64 (req->newpar); state->resolve2.gen = ntoh64 (req->newgen); - resolve_and_resume (frame, server_rename_resume); + gf_resolve_and_resume (frame, server_rename_resume); return 0; } -int +static int server_lk_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -4731,7 +4834,7 @@ err: * not for external reference */ -int +static int server_lk (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -4781,13 +4884,13 @@ server_lk (call_frame_t *frame, xlator_t *bound_xl, } - resolve_and_resume (frame, server_lk_resume); + gf_resolve_and_resume (frame, server_lk_resume); return 0; } /* xxx_MOPS */ -int +static int _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum) { server_conf_t *conf = NULL; @@ -4942,7 +5045,7 @@ out: return ret; } -int +static int _validate_volfile_checksum (xlator_t *this, char *key, uint32_t checksum) { @@ -5008,7 +5111,7 @@ out: * @params: * */ -int +static int mop_getspec (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5090,7 +5193,7 @@ fail: } -int +static int server_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint8_t *fchecksum, uint8_t *dchecksum) @@ -5122,7 +5225,7 @@ server_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } -int +static int server_checksum_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -5150,7 +5253,7 @@ err: return 0; } -int +static int server_checksum (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5167,13 +5270,13 @@ server_checksum (call_frame_t *frame, xlator_t *bound_xl, state->resolve.ino = ntoh64 (req->ino); state->flags = ntoh32 (req->flag); - resolve_and_resume (frame, server_checksum_resume); + gf_resolve_and_resume (frame, server_checksum_resume); return 0; } -int +static int server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, uint8_t *strong_checksum) @@ -5206,7 +5309,7 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } -int +static int server_rchecksum_resume (call_frame_t *frame, xlator_t *bound_xl) { server_state_t *state = NULL; @@ -5234,7 +5337,7 @@ err: } -int +static int server_rchecksum (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5254,7 +5357,7 @@ server_rchecksum (call_frame_t *frame, xlator_t *bound_xl, state->offset = ntoh64 (req->offset); state->size = ntoh32 (req->len); - resolve_and_resume (frame, server_rchecksum_resume); + gf_resolve_and_resume (frame, server_rchecksum_resume); return 0; } @@ -5267,7 +5370,7 @@ server_rchecksum (call_frame_t *frame, xlator_t *bound_xl, * @params: parameter dictionary * */ -int +static int mop_getvolume (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5280,7 +5383,7 @@ struct __get_xl_struct { xlator_t *reply; }; -void __check_and_set (xlator_t *each, void *data) +static void __check_and_set (xlator_t *each, void *data) { if (!strcmp (each->name, ((struct __get_xl_struct *) data)->name)) @@ -5308,7 +5411,7 @@ get_xlator_by_name (xlator_t *some_xl, const char *name) * @params: parameter dictionary * */ -int +static int mop_setvolume (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *req_hdr, size_t req_hdrlen, struct iobuf *iobuf) @@ -5379,7 +5482,7 @@ mop_setvolume (call_frame_t *frame, xlator_t *bound_xl, } - conn = server_connection_get (frame->this, process_uuid); + conn = gf_server_connection_get (frame->this, process_uuid); if (trans->xl_private != conn) trans->xl_private = conn; @@ -5590,7 +5693,7 @@ fail: } -int +static int mop_ping (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5611,7 +5714,7 @@ mop_ping (call_frame_t *frame, xlator_t *bound_xl, } -int +static int mop_log (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5637,7 +5740,7 @@ mop_log (call_frame_t *frame, xlator_t *bound_xl, /* ENOSYS operations (for backword compatibility) */ -int +static int server_setdents (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5661,7 +5764,7 @@ server_setdents (call_frame_t *frame, xlator_t *bound_xl, } /* */ -int +static int server_getdents (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5685,7 +5788,7 @@ server_getdents (call_frame_t *frame, xlator_t *bound_xl, } /* */ -int +static int server_lock_notify (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5709,7 +5812,7 @@ server_lock_notify (call_frame_t *frame, xlator_t *bound_xl, } /* */ -int +static int server_lock_fnotify (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5733,7 +5836,7 @@ server_lock_fnotify (call_frame_t *frame, xlator_t *bound_xl, } -int +static int mop_stats (call_frame_t *frame, xlator_t *bound_xl, gf_hdr_common_t *hdr, size_t hdrlen, struct iobuf *iobuf) @@ -5756,37 +5859,6 @@ mop_stats (call_frame_t *frame, xlator_t *bound_xl, return 0; } -/* - * unknown_op_cbk - This function is called when a opcode for unknown - * type is called. Helps to keep the backward/forward - * compatiblity - * @frame: call frame - * @type: - * @opcode: - * - */ - -int -unknown_op_cbk (call_frame_t *frame, int32_t type, int32_t opcode) -{ - gf_hdr_common_t *hdr = NULL; - gf_fop_flush_rsp_t *rsp = NULL; - size_t hdrlen = 0; - int32_t gf_errno = 0; - - hdrlen = gf_hdr_len (rsp, 0); - hdr = gf_hdr_new (rsp, 0); - rsp = gf_param (hdr); - - hdr->rsp.op_ret = hton32 (-1); - gf_errno = gf_errno_to_error (ENOSYS); - hdr->rsp.op_errno = hton32 (gf_errno); - - protocol_server_reply (frame, type, opcode, - hdr, hdrlen, NULL, 0, NULL); - - return 0; -} /* * get_frame_for_transport - get call frame for specified transport object @@ -5835,7 +5907,7 @@ out: } -int +static int server_decode_groups (call_frame_t *frame, gf_hdr_common_t *hdr) { int i = 0; @@ -5969,7 +6041,7 @@ static gf_op_t gf_cbks[] = { [GF_CBK_RELEASEDIR] = server_releasedir }; -int +static int protocol_server_interpret (xlator_t *this, transport_t *trans, char *hdr_p, size_t hdrlen, struct iobuf *iobuf) { @@ -6048,35 +6120,11 @@ protocol_server_interpret (xlator_t *this, transport_t *trans, /* - * server_nop_cbk - nop callback for server protocol - * @frame: call frame - * @cookie: - * @this: - * @op_ret: return value - * @op_errno: errno - * - * not for external reference - */ -int -server_nop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - server_state_t *state = NULL; - - state = CALL_STATE(frame); - - if (state) - free_state (state); - STACK_DESTROY (frame->root); - return 0; -} - -/* * server_fd - fdtable dump function for server protocol * @this: * */ -int +static int server_fd (xlator_t *this) { server_conf_t *conf = NULL; @@ -6134,13 +6182,13 @@ server_fd (xlator_t *this) return 0; } -int +static int server_priv (xlator_t *this) { return 0; } -int +static int server_inode (xlator_t *this) { server_conf_t *conf = NULL; @@ -6220,7 +6268,7 @@ out: } -int +static int validate_auth_options (xlator_t *this, dict_t *dict) { int ret = -1; @@ -6419,7 +6467,7 @@ out: -int +static int protocol_server_pollin (xlator_t *this, transport_t *trans) { char *hdr = NULL; @@ -6506,7 +6554,7 @@ notify (xlator_t *this, int32_t event, void *data, ...) * FIXME: shouldn't we check for return value? * what should be done if cleanup fails? */ - server_connection_cleanup (this, trans->xl_private); + gf_server_connection_cleanup (this, trans->xl_private); } } break; @@ -6514,7 +6562,7 @@ notify (xlator_t *this, int32_t event, void *data, ...) case GF_EVENT_TRANSPORT_CLEANUP: { if (trans->xl_private) { - server_connection_put (this, trans->xl_private); + gf_server_connection_put (this, trans->xl_private); } else { gf_log (this->name, GF_LOG_DEBUG, "transport (%s) cleaned up even before " diff --git a/xlators/protocol/legacy/server/src/server-protocol.h b/xlators/protocol/legacy/server/src/server-protocol.h index 0c21000596f..56d23fdbfab 100644 --- a/xlators/protocol/legacy/server/src/server-protocol.h +++ b/xlators/protocol/legacy/server/src/server-protocol.h @@ -77,21 +77,13 @@ typedef struct _server_connection server_connection_t; server_connection_t * -server_connection_get (xlator_t *this, const char *id); +gf_server_connection_get (xlator_t *this, const char *id); void -server_connection_put (xlator_t *this, server_connection_t *conn); +gf_server_connection_put (xlator_t *this, server_connection_t *conn); int -server_connection_destroy (xlator_t *this, server_connection_t *conn); - -int -server_connection_cleanup (xlator_t *this, server_connection_t *conn); - -int -server_nop_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno); - +gf_server_connection_cleanup (xlator_t *this, server_connection_t *conn); struct _volfile_ctx { struct _volfile_ctx *next; @@ -149,7 +141,7 @@ typedef struct { typedef int (*server_resume_fn_t) (call_frame_t *frame, xlator_t *bound_xl); int -resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn); +gf_resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn); struct _server_state { transport_t *trans; diff --git a/xlators/protocol/legacy/server/src/server-resolve.c b/xlators/protocol/legacy/server/src/server-resolve.c index f0da94384eb..b5a1d2d0dd6 100644 --- a/xlators/protocol/legacy/server/src/server-resolve.c +++ b/xlators/protocol/legacy/server/src/server-resolve.c @@ -27,16 +27,20 @@ #include "compat-errno.h" -int +void +gf_server_print_request (call_frame_t *frame); + +static int server_resolve_all (call_frame_t *frame); -int +static int resolve_entry_simple (call_frame_t *frame); -int +static int resolve_inode_simple (call_frame_t *frame); -int +static int resolve_path_simple (call_frame_t *frame); -int + +static int component_count (const char *path) { int count = 0; @@ -53,7 +57,7 @@ component_count (const char *path) } -int +static int prepare_components (call_frame_t *frame) { server_state_t *state = NULL; @@ -96,7 +100,7 @@ prepare_components (call_frame_t *frame) } -int +static int resolve_loc_touchup (call_frame_t *frame) { server_state_t *state = NULL; @@ -135,7 +139,7 @@ resolve_loc_touchup (call_frame_t *frame) } -int +static int resolve_deep_continue (call_frame_t *frame) { server_state_t *state = NULL; @@ -165,7 +169,7 @@ resolve_deep_continue (call_frame_t *frame) } -int +static int resolve_deep_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, inode_t *inode, struct iatt *buf, dict_t *xattr, struct iatt *postparent) @@ -223,7 +227,7 @@ get_out_of_here: } -int +static int resolve_path_deep (call_frame_t *frame) { server_state_t *state = NULL; @@ -253,7 +257,7 @@ resolve_path_deep (call_frame_t *frame) } -int +static int resolve_path_simple (call_frame_t *frame) { server_state_t *state = NULL; @@ -317,7 +321,7 @@ out: > 0 - indecisive, need to perform deep resolution */ -int +static int resolve_entry_simple (call_frame_t *frame) { server_state_t *state = NULL; @@ -407,7 +411,7 @@ out: } -int +static int server_resolve_entry (call_frame_t *frame) { server_state_t *state = NULL; @@ -438,7 +442,7 @@ server_resolve_entry (call_frame_t *frame) } -int +static int resolve_inode_simple (call_frame_t *frame) { server_state_t *state = NULL; @@ -483,7 +487,7 @@ out: } -int +static int server_resolve_inode (call_frame_t *frame) { server_state_t *state = NULL; @@ -514,7 +518,7 @@ server_resolve_inode (call_frame_t *frame) } -int +static int server_resolve_fd (call_frame_t *frame) { server_state_t *state = NULL; @@ -543,7 +547,7 @@ server_resolve_fd (call_frame_t *frame) } -int +static int server_resolve (call_frame_t *frame) { server_state_t *state = NULL; @@ -582,7 +586,7 @@ server_resolve (call_frame_t *frame) } -int +static int server_resolve_done (call_frame_t *frame) { server_state_t *state = NULL; @@ -591,7 +595,7 @@ server_resolve_done (call_frame_t *frame) state = CALL_STATE (frame); bound_xl = BOUND_XL (frame); - server_print_request (frame); + gf_server_print_request (frame); state->resume_fn (frame, bound_xl); @@ -603,7 +607,7 @@ server_resolve_done (call_frame_t *frame) * This function is called multiple times, once per resolving one location/fd. * state->resolve_now is used to decide which location/fd is to be resolved now */ -int +static int server_resolve_all (call_frame_t *frame) { server_state_t *state = NULL; @@ -640,7 +644,7 @@ server_resolve_all (call_frame_t *frame) int -resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn) +gf_resolve_and_resume (call_frame_t *frame, server_resume_fn_t fn) { server_state_t *state = NULL; xlator_t *this = NULL; diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c index c14be17e6e8..6714d32e7d8 100644 --- a/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c +++ b/xlators/protocol/legacy/transport/ib-verbs/src/ib-verbs.c @@ -2135,7 +2135,7 @@ tcp_connect_finish (transport_t *this) goto unlock; } - get_transport_identifiers (this); + gf_ibverbs_get_transport_identifiers (this); priv->tcp_connected = 1; } @@ -2249,8 +2249,9 @@ ib_verbs_connect (struct transport *this) } } - ret = ibverbs_client_get_remote_sockaddr (this, (struct sockaddr *)&sockaddr, - &sockaddr_len); + ret = gf_ibverbs_client_get_remote_sockaddr (this, + (struct sockaddr *)&sockaddr, + &sockaddr_len); if (ret != 0) { gf_log (this->xl->name, GF_LOG_DEBUG, "cannot get remote address to connect"); @@ -2299,9 +2300,9 @@ ib_verbs_connect (struct transport *this) } } - ret = client_bind (this, - (struct sockaddr *)&this->myinfo.sockaddr, - &this->myinfo.sockaddr_len, priv->sock); + ret = gf_ibverbs_client_bind (this, + (struct sockaddr *)&this->myinfo.sockaddr, + &this->myinfo.sockaddr_len, priv->sock); if (ret == -1) { gf_log (this->xl->name, GF_LOG_WARNING, @@ -2393,7 +2394,7 @@ ib_verbs_server_event_handler (int fd, int idx, void *data, priv->peer.trans = this; transport_ref (this); - get_transport_identifiers (this); + gf_ibverbs_get_transport_identifiers (this); priv->tcp_connected = 1; priv->handshake.incoming.state = IB_VERBS_HANDSHAKE_START; @@ -2434,9 +2435,9 @@ ib_verbs_listen (transport_t *this) char service[NI_MAXSERV], host[NI_MAXHOST]; memset (&sockaddr, 0, sizeof (sockaddr)); - ret = ibverbs_server_get_local_sockaddr (this, - (struct sockaddr *)&sockaddr, - &sockaddr_len); + ret = gf_ibverbs_server_get_local_sockaddr (this, + (struct sockaddr *)&sockaddr, + &sockaddr_len); if (ret != 0) { gf_log (this->xl->name, GF_LOG_DEBUG, "cannot find network address of server to bind to"); diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/name.c b/xlators/protocol/legacy/transport/ib-verbs/src/name.c index a3e18481458..1b8f83c293e 100644 --- a/xlators/protocol/legacy/transport/ib-verbs/src/name.c +++ b/xlators/protocol/legacy/transport/ib-verbs/src/name.c @@ -412,11 +412,11 @@ out: return ret; } -int32_t -client_bind (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - int sock) +int32_t +gf_ibverbs_client_bind (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + int sock) { int ret = 0; @@ -457,9 +457,9 @@ client_bind (transport_t *this, } int32_t -ibverbs_client_get_remote_sockaddr (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len) +gf_ibverbs_client_get_remote_sockaddr (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len) { int32_t ret = 0; char is_inet_sdp = 0; @@ -506,9 +506,9 @@ err: } int32_t -ibverbs_server_get_local_sockaddr (transport_t *this, - struct sockaddr *addr, - socklen_t *addr_len) +gf_ibverbs_server_get_local_sockaddr (transport_t *this, + struct sockaddr *addr, + socklen_t *addr_len) { data_t *address_family_data = NULL; int32_t ret = 0; @@ -647,7 +647,7 @@ fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr, } int32_t -get_transport_identifiers (transport_t *this) +gf_ibverbs_get_transport_identifiers (transport_t *this) { int32_t ret = 0; char is_inet_sdp = 0; diff --git a/xlators/protocol/legacy/transport/ib-verbs/src/name.h b/xlators/protocol/legacy/transport/ib-verbs/src/name.h index 4f0f47711d2..e2575794bc7 100644 --- a/xlators/protocol/legacy/transport/ib-verbs/src/name.h +++ b/xlators/protocol/legacy/transport/ib-verbs/src/name.h @@ -25,23 +25,23 @@ #include "compat.h" -int32_t -client_bind (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - int sock); +int32_t +gf_ibverbs_client_bind (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + int sock); int32_t -ibverbs_client_get_remote_sockaddr (transport_t *this, - struct sockaddr *sockaddr, +gf_ibverbs_client_get_remote_sockaddr (transport_t *this, + struct sockaddr *sockaddr, socklen_t *sockaddr_len); int32_t -ibverbs_server_get_local_sockaddr (transport_t *this, - struct sockaddr *addr, +gf_ibverbs_server_get_local_sockaddr (transport_t *this, + struct sockaddr *addr, socklen_t *addr_len); int32_t -get_transport_identifiers (transport_t *this); +gf_ibverbs_get_transport_identifiers (transport_t *this); #endif /* _IB_VERBS_NAME_H */ diff --git a/xlators/protocol/legacy/transport/socket/src/name.c b/xlators/protocol/legacy/transport/socket/src/name.c index 74abe4480a2..b0fc7b4db3c 100644 --- a/xlators/protocol/legacy/transport/socket/src/name.c +++ b/xlators/protocol/legacy/transport/socket/src/name.c @@ -121,7 +121,7 @@ err: return ret; } -int32_t +static int32_t client_fill_address_family (transport_t *this, sa_family_t *sa_family) { data_t *address_family_data = NULL; @@ -351,9 +351,9 @@ err: return ret; } -static int32_t -af_inet_server_get_local_sockaddr (transport_t *this, - struct sockaddr *addr, +static int32_t +af_inet_server_get_local_sockaddr (transport_t *this, + struct sockaddr *addr, socklen_t *addr_len) { struct addrinfo hints, *res = 0; @@ -422,10 +422,10 @@ out: return ret; } -int32_t -client_bind (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, +int32_t +gf_client_bind (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, int sock) { int ret = 0; @@ -465,8 +465,8 @@ client_bind (transport_t *this, } int32_t -socket_client_get_remote_sockaddr (transport_t *this, - struct sockaddr *sockaddr, +gf_socket_client_get_remote_sockaddr (transport_t *this, + struct sockaddr *sockaddr, socklen_t *sockaddr_len, sa_family_t *sa_family) { @@ -519,7 +519,7 @@ err: } -int32_t +static int32_t server_fill_address_family (transport_t *this, sa_family_t *sa_family) { data_t *address_family_data = NULL; @@ -564,7 +564,7 @@ out: int32_t -socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr, +gf_socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr, socklen_t *addr_len, sa_family_t *sa_family) { int32_t ret = -1; @@ -604,8 +604,8 @@ err: return ret; } -int32_t -fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr, +static int32_t +fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr, int32_t addr_len, char *identifier) { int32_t ret = 0, tmpaddr_len = 0; @@ -675,7 +675,7 @@ fill_inet6_inet_identifiers (transport_t *this, struct sockaddr_storage *addr, } int32_t -get_transport_identifiers (transport_t *this) +gf_get_transport_identifiers (transport_t *this) { int32_t ret = 0; char is_inet_sdp = 0; diff --git a/xlators/protocol/legacy/transport/socket/src/name.h b/xlators/protocol/legacy/transport/socket/src/name.h index f50a7b7f4dd..1853781bd7c 100644 --- a/xlators/protocol/legacy/transport/socket/src/name.h +++ b/xlators/protocol/legacy/transport/socket/src/name.h @@ -22,23 +22,23 @@ #include "compat.h" -int32_t -client_bind (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - int sock); +int32_t +gf_client_bind (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + int sock); int32_t -socket_client_get_remote_sockaddr (transport_t *this, - struct sockaddr *sockaddr, - socklen_t *sockaddr_len, - sa_family_t *sa_family); +gf_socket_client_get_remote_sockaddr (transport_t *this, + struct sockaddr *sockaddr, + socklen_t *sockaddr_len, + sa_family_t *sa_family); int32_t -socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr, - socklen_t *addr_len, sa_family_t *sa_family); +gf_socket_server_get_local_sockaddr (transport_t *this, struct sockaddr *addr, + socklen_t *addr_len, sa_family_t *sa_family); int32_t -get_transport_identifiers (transport_t *this); +gf_get_transport_identifiers (transport_t *this); #endif /* _SOCKET_NAME_H */ diff --git a/xlators/protocol/legacy/transport/socket/src/socket.c b/xlators/protocol/legacy/transport/socket/src/socket.c index fd3815d83fe..128b1ce6997 100644 --- a/xlators/protocol/legacy/transport/socket/src/socket.c +++ b/xlators/protocol/legacy/transport/socket/src/socket.c @@ -41,7 +41,7 @@ #define GF_LOG_ERRNO(errno) ((errno == ENOTCONN) ? GF_LOG_DEBUG : GF_LOG_ERROR) #define SA(ptr) ((struct sockaddr *)ptr) -int socket_init (transport_t *this); +static int socket_init (transport_t *this); /* * return value: @@ -50,7 +50,7 @@ int socket_init (transport_t *this); * > 0 = incomplete */ -int +static int __socket_rwv (transport_t *this, struct iovec *vector, int count, struct iovec **pending_vector, int *pending_count, int write) @@ -134,7 +134,7 @@ __socket_rwv (transport_t *this, struct iovec *vector, int count, } -int +static int __socket_readv (transport_t *this, struct iovec *vector, int count, struct iovec **pending_vector, int *pending_count) { @@ -147,7 +147,7 @@ __socket_readv (transport_t *this, struct iovec *vector, int count, } -int +static int __socket_writev (transport_t *this, struct iovec *vector, int count, struct iovec **pending_vector, int *pending_count) { @@ -160,7 +160,7 @@ __socket_writev (transport_t *this, struct iovec *vector, int count, } -int +static int __socket_disconnect (transport_t *this) { socket_private_t *priv = NULL; @@ -180,7 +180,7 @@ __socket_disconnect (transport_t *this) } -int +static int __socket_server_bind (transport_t *this) { socket_private_t *priv = NULL; @@ -215,7 +215,7 @@ __socket_server_bind (transport_t *this) } -int +static int __socket_nonblock (int fd) { int flags = 0; @@ -230,7 +230,7 @@ __socket_nonblock (int fd) } -int +static int __socket_nodelay (int fd) { int on = 1; @@ -246,7 +246,7 @@ __socket_nodelay (int fd) } -int +static int __socket_keepalive (int fd, int keepalive_intvl) { int on = 1; @@ -285,7 +285,7 @@ err: } -int +static int __socket_connect_finish (int fd) { int ret = -1; @@ -303,7 +303,7 @@ __socket_connect_finish (int fd) } -void +static void __socket_reset (transport_t *this) { socket_private_t *priv = NULL; @@ -328,7 +328,7 @@ __socket_reset (transport_t *this) } -struct ioq * +static struct ioq * __socket_ioq_new (transport_t *this, char *buf, int len, struct iovec *vector, int count, struct iobref *iobref) { @@ -379,7 +379,7 @@ __socket_ioq_new (transport_t *this, char *buf, int len, } -void +static void __socket_ioq_entry_free (struct ioq *entry) { list_del_init (&entry->list); @@ -394,7 +394,7 @@ __socket_ioq_entry_free (struct ioq *entry) } -void +static void __socket_ioq_flush (transport_t *this) { socket_private_t *priv = NULL; @@ -411,7 +411,7 @@ __socket_ioq_flush (transport_t *this) } -int +static int __socket_ioq_churn_entry (transport_t *this, struct ioq *entry) { int ret = -1; @@ -431,7 +431,7 @@ __socket_ioq_churn_entry (transport_t *this, struct ioq *entry) } -int +static int __socket_ioq_churn (transport_t *this) { socket_private_t *priv = NULL; @@ -460,7 +460,7 @@ __socket_ioq_churn (transport_t *this) } -int +static int socket_event_poll_err (transport_t *this) { socket_private_t *priv = NULL; @@ -481,7 +481,7 @@ socket_event_poll_err (transport_t *this) } -int +static int socket_event_poll_out (transport_t *this) { socket_private_t *priv = NULL; @@ -507,7 +507,7 @@ socket_event_poll_out (transport_t *this) } -int +static int __socket_proto_validate_header (transport_t *this, struct socket_header *header, size_t *size1_p, size_t *size2_p) @@ -560,7 +560,7 @@ __socket_proto_validate_header (transport_t *this, /* socket protocol state machine */ -int +static int __socket_proto_state_machine (transport_t *this) { int ret = -1; @@ -741,7 +741,7 @@ unlock: } -int +static int socket_proto_state_machine (transport_t *this) { socket_private_t *priv = NULL; @@ -759,7 +759,7 @@ socket_proto_state_machine (transport_t *this) } -int +static int socket_event_poll_in (transport_t *this) { int ret = -1; @@ -776,7 +776,7 @@ socket_event_poll_in (transport_t *this) } -int +static int socket_connect_finish (transport_t *this) { int ret = -1; @@ -831,7 +831,7 @@ socket_connect_finish (transport_t *this) priv->connected = 1; priv->connect_finish_log = 0; event = GF_EVENT_CHILD_UP; - get_transport_identifiers (this); + gf_get_transport_identifiers (this); } } unlock: @@ -844,7 +844,7 @@ unlock: } -int +static int socket_event_handler (int fd, int idx, void *data, int poll_in, int poll_out, int poll_err) { @@ -882,7 +882,7 @@ socket_event_handler (int fd, int idx, void *data, } -int +static int socket_server_event_handler (int fd, int idx, void *data, int poll_in, int poll_out, int poll_err) { @@ -965,7 +965,7 @@ socket_server_event_handler (int fd, int idx, void *data, goto unlock; } - get_transport_identifiers (new_trans); + gf_get_transport_identifiers (new_trans); socket_init (new_trans); new_trans->ops = this->ops; new_trans->init = this->init; @@ -998,7 +998,7 @@ unlock: } -int +static int socket_disconnect (transport_t *this) { socket_private_t *priv = NULL; @@ -1016,7 +1016,7 @@ socket_disconnect (transport_t *this) } -int +static int socket_connect (transport_t *this) { int ret = -1; @@ -1049,7 +1049,7 @@ socket_connect (transport_t *this) goto err; } - ret = socket_client_get_remote_sockaddr (this, SA (&sockaddr), + ret = gf_socket_client_get_remote_sockaddr (this, SA (&sockaddr), &sockaddr_len, &sa_family); if (ret == -1) { /* logged inside client_get_remote_sockaddr */ @@ -1131,7 +1131,7 @@ socket_connect (transport_t *this) SA (&this->myinfo.sockaddr)->sa_family = SA (&this->peerinfo.sockaddr)->sa_family; - ret = client_bind (this, SA (&this->myinfo.sockaddr), + ret = gf_client_bind (this, SA (&this->myinfo.sockaddr), &this->myinfo.sockaddr_len, priv->sock); if (ret == -1) { gf_log (this->xl->name, GF_LOG_WARNING, @@ -1170,7 +1170,7 @@ err: } -int +static int socket_listen (transport_t *this) { socket_private_t * priv = NULL; @@ -1198,7 +1198,7 @@ socket_listen (transport_t *this) return ret; } - ret = socket_server_get_local_sockaddr (this, SA (&sockaddr), + ret = gf_socket_server_get_local_sockaddr (this, SA (&sockaddr), &sockaddr_len, &sa_family); if (ret == -1) { return ret; @@ -1310,7 +1310,7 @@ unlock: } -int +static int socket_receive (transport_t *this, char **hdr_p, size_t *hdrlen_p, struct iobuf **iobuf_p) { @@ -1353,7 +1353,7 @@ unlock: /* TODO: implement per transfer limit */ -int +static int socket_submit (transport_t *this, char *buf, int len, struct iovec *vector, int count, struct iobref *iobref) @@ -1423,7 +1423,7 @@ struct transport_ops tops = { }; -int +static int socket_init (transport_t *this) { socket_private_t *priv = NULL; @@ -1554,24 +1554,6 @@ fini (transport_t *this) GF_FREE (priv); } -int32_t -mem_acct_init (xlator_t *this) -{ - int ret = -1; - - if (!this) - return ret; - - ret = xlator_mem_acct_init (this, gf_common_mt_end + 1); - - if (ret != 0) { - gf_log (this->name, GF_LOG_ERROR, "Memory accounting init" - "failed"); - return ret; - } - - return ret; -} int32_t init (transport_t *this) diff --git a/xlators/protocol/lib/src/Makefile.am b/xlators/protocol/lib/src/Makefile.am index be59aa666a0..70cc069e8f1 100644 --- a/xlators/protocol/lib/src/Makefile.am +++ b/xlators/protocol/lib/src/Makefile.am @@ -4,7 +4,6 @@ libgfproto1_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_ libgfproto1_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE \ -D$(GF_HOST_OS) -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ - -DTRANSPORTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/transport\" \ -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/libglusterfs/src/ \ -I$(top_srcdir)/rpc/rpc-lib/src/ |