From 7b95d5a4b3988757bf8c91f82dcaf86ed3da6875 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Wed, 23 May 2018 09:06:04 +0530 Subject: Revert "gluster: Sometimes Brick process is crashed at the time of stopping brick" Updates: bz#1582286 This reverts commit 0043c63f70776444f69667a4ef9596217ecb42b7. Change-Id: Iab3b4f4a54e122c589e515add93c6effc966b3e0 --- libglusterfs/src/client_t.c | 4 +-- libglusterfs/src/fd.c | 4 +-- libglusterfs/src/graph.c | 6 ++-- libglusterfs/src/inode.c | 2 +- libglusterfs/src/libglusterfs.sym | 1 - libglusterfs/src/statedump.c | 61 ++++++++++----------------------------- libglusterfs/src/xlator.c | 8 ++--- libglusterfs/src/xlator.h | 11 +------ 8 files changed, 27 insertions(+), 70 deletions(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 4596db3470f..63f4bbb4b06 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -338,7 +338,7 @@ gf_client_destroy_recursive (xlator_t *xl, client_t *client) { xlator_list_t *trav; - if (!xl->call_cleanup && xl->cbks->client_destroy) { + if (xl->cbks->client_destroy) { xl->cbks->client_destroy (xl, client); } @@ -398,7 +398,7 @@ gf_client_disconnect_recursive (xlator_t *xl, client_t *client) int ret = 0; xlator_list_t *trav; - if (!xl->call_cleanup && xl->cbks->client_disconnect) { + if (xl->cbks->client_disconnect) { ret = xl->cbks->client_disconnect (xl, client); } diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 30a7494540d..d31b106aa8b 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -484,7 +484,7 @@ fd_destroy (fd_t *fd, gf_boolean_t bound) xl = fd->_ctx[i].xl_key; old_THIS = THIS; THIS = xl; - if (!xl->call_cleanup && xl->cbks->releasedir) + if (xl->cbks->releasedir) xl->cbks->releasedir (xl, fd); THIS = old_THIS; } @@ -495,7 +495,7 @@ fd_destroy (fd_t *fd, gf_boolean_t bound) xl = fd->_ctx[i].xl_key; old_THIS = THIS; THIS = xl; - if (!xl->call_cleanup && xl->cbks->release) + if (xl->cbks->release) xl->cbks->release (xl, fd); THIS = old_THIS; } diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index c5ec013755e..7cc1e74713d 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -841,7 +841,7 @@ is_graph_topology_equal (glusterfs_graph_t *graph1, glusterfs_graph_t *graph2) trav2 = trav2->children->xlator; for (ltrav = trav1->children; ltrav; ltrav = ltrav->next) { trav1 = ltrav->xlator; - if (!trav1->cleanup_starting && !strcmp (trav1->name, trav2->name)) { + if (strcmp (trav1->name, trav2->name) == 0) { break; } } @@ -1088,7 +1088,7 @@ glusterfs_graph_reconfigure (glusterfs_graph_t *oldgraph, new_xl = FIRST_CHILD (new_xl); for (trav = old_xl->children; trav; trav = trav->next) { - if (!trav->xlator->cleanup_starting && !strcmp (trav->xlator->name, new_xl->name)) { + if (strcmp (trav->xlator->name, new_xl->name) == 0) { return xlator_tree_reconfigure (trav->xlator, new_xl); } } @@ -1237,7 +1237,7 @@ glusterfs_graph_attach (glusterfs_graph_t *orig_graph, char *path, xl->volfile_id[strlen(xl->volfile_id)-4] = '\0'; } - /* TODO memory leaks everywhere need to free graph in case of error */ + /* TBD: memory leaks everywhere */ if (glusterfs_graph_prepare (graph, this->ctx, xl->name)) { gf_log (this->name, GF_LOG_WARNING, "failed to prepare graph for xlator %s", xl->name); diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 093683d41da..2100ea3cad2 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -327,7 +327,7 @@ __inode_ctx_free (inode_t *inode) xl = (xlator_t *)(long)inode->_ctx[index].xl_key; old_THIS = THIS; THIS = xl; - if (!xl->call_cleanup && xl->cbks->forget) + if (xl->cbks->forget) xl->cbks->forget (xl, inode); THIS = old_THIS; } diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index f0bca9c355e..fa8aa7c35e1 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -1103,7 +1103,6 @@ xlator_tree_free_members xlator_volopt_dynload xlator_volume_option_get xlator_volume_option_get_list -xlator_memrec_free default_fops gf_fop_list gf_upcall_list diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 412a47b9383..34b8061425c 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -501,14 +501,21 @@ gf_proc_dump_dict_info (glusterfs_ctx_t *ctx) (total_pairs / total_dicts)); } -static void -gf_proc_dump_per_xlator_info (xlator_t *top) +void +gf_proc_dump_xlator_info (xlator_t *top) { - xlator_t *trav = top; - glusterfs_ctx_t *ctx = top->ctx; + xlator_t *trav = NULL; + glusterfs_ctx_t *ctx = NULL; char itable_key[1024] = {0,}; - while (trav && !trav->cleanup_starting) { + if (!top) + return; + + ctx = top->ctx; + + trav = top; + while (trav) { + if (ctx->measure_latency) gf_proc_dump_latency_info (trav); @@ -532,6 +539,7 @@ gf_proc_dump_per_xlator_info (xlator_t *top) if (GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode) && (trav->dumpops->inode)) trav->dumpops->inode (trav); + if (trav->dumpops->fd && GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd)) trav->dumpops->fd (trav); @@ -542,30 +550,6 @@ gf_proc_dump_per_xlator_info (xlator_t *top) trav = trav->next; } -} - - - -void -gf_proc_dump_xlator_info (xlator_t *top, gf_boolean_t brick_mux) -{ - xlator_t *trav = NULL; - xlator_list_t **trav_p = NULL; - - if (!top) - return; - - trav = top; - gf_proc_dump_per_xlator_info (trav); - - if (brick_mux) { - trav_p = &top->children; - while (*trav_p) { - trav = (*trav_p)->xlator; - gf_proc_dump_per_xlator_info (trav); - trav_p = &(*trav_p)->next; - } - } return; } @@ -819,27 +803,12 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) char tmp_dump_name[PATH_MAX] = {0,}; char path[PATH_MAX] = {0,}; struct timeval tv = {0,}; - gf_boolean_t is_brick_mux = _gf_false; - xlator_t *top = NULL; - xlator_list_t **trav_p = NULL; - int brick_count = 0; gf_proc_dump_lock (); if (!ctx) goto out; - if (ctx) { - top = ctx->active->first; - for (trav_p = &top->children; *trav_p; - trav_p = &(*trav_p)->next) { - brick_count++; - } - - if (brick_count > 1) - is_brick_mux = _gf_true; - } - if (ctx->cmd_args.brick_name) { GF_REMOVE_SLASH_FROM_PATH (ctx->cmd_args.brick_name, brick_name); } else @@ -899,12 +868,12 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) if (ctx->master) { gf_proc_dump_add_section ("fuse"); - gf_proc_dump_xlator_info (ctx->master, _gf_false); + gf_proc_dump_xlator_info (ctx->master); } if (ctx->active) { gf_proc_dump_add_section ("active graph - %d", ctx->graph_id); - gf_proc_dump_xlator_info (ctx->active->top, is_brick_mux); + gf_proc_dump_xlator_info (ctx->active->top); } i = 0; diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 3836b8464a2..3226ad07552 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -629,7 +629,7 @@ get_xlator_by_name_or_type (xlator_t *this, char *target, int is_name) for (trav = this->children; trav; trav = trav->next) { value = is_name ? trav->xlator->name : trav->xlator->type; - if (!strcmp(value, target)) { + if (strcmp(value, target) == 0) { return trav->xlator; } child_xl = get_xlator_by_name_or_type (trav->xlator, target, @@ -722,9 +722,7 @@ xlator_init (xlator_t *xl) } xl->init_succeeded = 1; - /*xl->cleanup_starting = 0; - xl->call_cleanup = 0; - */ + ret = 0; out: return ret; @@ -860,7 +858,7 @@ xlator_list_destroy (xlator_list_t *list) return 0; } -int +static int xlator_memrec_free (xlator_t *xl) { uint32_t i = 0; diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 88805226351..ecc031f48b4 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -1044,14 +1044,6 @@ struct _xlator { /* Is this pass_through? */ gf_boolean_t pass_through; struct xlator_fops *pass_through_fops; - - /* cleanup flag to avoid races during xlator cleanup */ - uint32_t cleanup_starting; - - /* flag to avoid recall of xlator_mem_cleanup for xame xlator */ - uint32_t call_cleanup; - - }; typedef struct { @@ -1245,6 +1237,5 @@ copy_opts_to_child (xlator_t *src, xlator_t *dst, char *glob); int glusterfs_delete_volfile_checksum (glusterfs_ctx_t *ctx, const char *volfile_id); -int -xlator_memrec_free (xlator_t *xl); + #endif /* _XLATOR_H */ -- cgit