summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2018-05-23 09:04:41 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-05-25 02:05:37 +0000
commit57dd3692d1a10d446db7fe919497335984e2cd3f (patch)
treea13b4c3509b58f733116cda7bccc369ac8eff014
parent833808f42247bcb8db1be917f1ffd7841d9e226f (diff)
Revert "server: fix unresolved symbols by moving them to libglusterfs"
Updates: bz#1582286 This reverts commit 408a6d07ababde234ddeafe16687aacd2b810b42. Change-Id: If8247d7980d698141f47130a3c532b942408ec2b
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c103
-rw-r--r--libglusterfs/src/libglusterfs.sym1
-rw-r--r--libglusterfs/src/xlator.c101
-rw-r--r--libglusterfs/src/xlator.h3
-rw-r--r--xlators/protocol/server/src/server.c2
5 files changed, 104 insertions, 106 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index db961c8..914335b 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -185,6 +185,109 @@ glusterfs_terminate_response_send (rpcsvc_request_t *req, int op_ret)
return ret;
}
+static int
+xlator_mem_free (xlator_t *xl)
+{
+ volume_opt_list_t *vol_opt = NULL;
+ volume_opt_list_t *tmp = NULL;
+
+ if (!xl)
+ return 0;
+
+ if (xl->options) {
+ dict_ref (xl->options);
+ dict_unref (xl->options);
+ xl->options = NULL;
+ }
+
+ list_for_each_entry_safe (vol_opt, tmp, &xl->volume_options, list) {
+ list_del_init (&vol_opt->list);
+ GF_FREE (vol_opt);
+ }
+
+ xlator_memrec_free (xl);
+
+ return 0;
+}
+
+void
+xlator_call_fini (xlator_t *this) {
+ if (!this || this->cleanup_starting)
+ return;
+ this->cleanup_starting = 1;
+ this->call_cleanup = 1;
+ xlator_call_fini (this->next);
+ this->fini (this);
+}
+
+void
+xlator_mem_cleanup (xlator_t *this) {
+ xlator_list_t *list = this->children;
+ xlator_t *trav = list->xlator;
+ inode_table_t *inode_table = NULL;
+ xlator_t *prev = trav;
+ glusterfs_ctx_t *ctx = NULL;
+ xlator_list_t **trav_p = NULL;
+ xlator_t *top = NULL;
+ xlator_t *victim = NULL;
+
+
+ if (this->call_cleanup)
+ return;
+
+ this->call_cleanup = 1;
+ ctx = glusterfsd_ctx;
+
+ xlator_call_fini (trav);
+
+ while (prev) {
+ trav = prev->next;
+ xlator_mem_free (prev);
+ prev = trav;
+ }
+
+ inode_table = this->itable;
+ if (inode_table) {
+ inode_table_destroy (inode_table);
+ this->itable = NULL;
+ }
+
+ if (this->fini) {
+ this->fini (this);
+ }
+
+ xlator_mem_free (this);
+
+ if (glusterfsd_ctx->active) {
+ top = glusterfsd_ctx->active->first;
+ LOCK (&ctx->volfile_lock);
+ /* TODO here we have leak for xlator node in a graph */
+ for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) {
+ victim = (*trav_p)->xlator;
+ if (victim->call_cleanup && !strcmp (victim->name, this->name)) {
+ (*trav_p) = (*trav_p)->next;
+ break;
+ }
+ }
+ /* TODO Sometime brick xlator is not moved from graph so followed below
+ approach to move brick xlator from a graph, will move specific brick
+ xlator from graph only while inode table and mem_acct are cleaned up
+ */
+ trav_p = &top->children;
+ while (*trav_p) {
+ victim = (*trav_p)->xlator;
+ if (victim->call_cleanup && !victim->itable && !victim->mem_acct) {
+ (*trav_p) = (*trav_p)->next;
+ } else {
+ trav_p = &(*trav_p)->next;
+ }
+ }
+ UNLOCK (&ctx->volfile_lock);
+ }
+
+}
+
+
int
glusterfs_handle_terminate (rpcsvc_request_t *req)
{
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym
index 17651e4..f0bca9c 100644
--- a/libglusterfs/src/libglusterfs.sym
+++ b/libglusterfs/src/libglusterfs.sym
@@ -1104,7 +1104,6 @@ xlator_volopt_dynload
xlator_volume_option_get
xlator_volume_option_get_list
xlator_memrec_free
-xlator_mem_cleanup
default_fops
gf_fop_list
gf_upcall_list
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 53bb491..3836b84 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -980,107 +980,6 @@ xlator_tree_free_memacct (xlator_t *tree)
return 0;
}
-static int
-xlator_mem_free (xlator_t *xl)
-{
- volume_opt_list_t *vol_opt = NULL;
- volume_opt_list_t *tmp = NULL;
-
- if (!xl)
- return 0;
-
- if (xl->options) {
- dict_ref (xl->options);
- dict_unref (xl->options);
- xl->options = NULL;
- }
-
- list_for_each_entry_safe (vol_opt, tmp, &xl->volume_options, list) {
- list_del_init (&vol_opt->list);
- GF_FREE (vol_opt);
- }
-
- xlator_memrec_free (xl);
-
- return 0;
-}
-
-static void
-xlator_call_fini (xlator_t *this) {
- if (!this || this->cleanup_starting)
- return;
- this->cleanup_starting = 1;
- this->call_cleanup = 1;
- xlator_call_fini (this->next);
- this->fini (this);
-}
-
-void
-xlator_mem_cleanup (xlator_t *this) {
- xlator_list_t *list = this->children;
- xlator_t *trav = list->xlator;
- inode_table_t *inode_table = NULL;
- xlator_t *prev = trav;
- glusterfs_ctx_t *ctx = NULL;
- xlator_list_t **trav_p = NULL;
- xlator_t *top = NULL;
- xlator_t *victim = NULL;
-
-
- if (this->call_cleanup || !this->ctx)
- return;
-
- this->call_cleanup = 1;
- ctx = this->ctx;
-
- xlator_call_fini (trav);
-
- while (prev) {
- trav = prev->next;
- xlator_mem_free (prev);
- prev = trav;
- }
-
- inode_table = this->itable;
- if (inode_table) {
- inode_table_destroy (inode_table);
- this->itable = NULL;
- }
-
- if (this->fini) {
- this->fini (this);
- }
-
- xlator_mem_free (this);
-
- if (ctx->active) {
- top = ctx->active->first;
- LOCK (&ctx->volfile_lock);
- /* TODO here we have leak for xlator node in a graph */
- for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) {
- victim = (*trav_p)->xlator;
- if (victim->call_cleanup && !strcmp (victim->name, this->name)) {
- (*trav_p) = (*trav_p)->next;
- break;
- }
- }
- /* TODO Sometime brick xlator is not moved from graph so followed below
- approach to move brick xlator from a graph, will move specific brick
- xlator from graph only while inode table and mem_acct are cleaned up
- */
- trav_p = &top->children;
- while (*trav_p) {
- victim = (*trav_p)->xlator;
- if (victim->call_cleanup && !victim->itable && !victim->mem_acct) {
- (*trav_p) = (*trav_p)->next;
- } else {
- trav_p = &(*trav_p)->next;
- }
- }
- UNLOCK (&ctx->volfile_lock);
- }
-}
-
void
loc_wipe (loc_t *loc)
{
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index d476cf2..8880522 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -1247,7 +1247,4 @@ glusterfs_delete_volfile_checksum (glusterfs_ctx_t *ctx,
const char *volfile_id);
int
xlator_memrec_free (xlator_t *xl);
-
-void
-xlator_mem_cleanup (xlator_t *this);
#endif /* _XLATOR_H */
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 254a5ca..bcce932 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -444,7 +444,7 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
this = xl;
trans = data;
conf = this->private;
- ctx = this->ctx;
+ ctx = glusterfsd_ctx;
switch (event) {
case RPCSVC_EVENT_ACCEPT: