Revert "glusterfsd: Memleak in glusterfsd process while brick mux is on"
There are still remain some code paths where cleanup is required while brick mux is on.I will upload a new patch after resolve all code paths. This reverts commit b313d97faa766443a7f8128b6e19f3d2f1b267dd. BUG: 1544090 Change-Id: I26ef1d29061092bd9a409c8933d5488e968ed90e Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
This commit is contained in:
parent
8d9961e637
commit
e3e7cdbde5
@ -193,70 +193,6 @@ glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr)
|
||||
(void) event_reconfigure_threads (pool, pool->eventthreadcount+incr);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
GF_FREE (xl->name);
|
||||
GF_FREE (xl->type);
|
||||
xl->name = NULL;
|
||||
xl->type = NULL;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
xlator_call_fini (xlator_t *this) {
|
||||
if (!this)
|
||||
return;
|
||||
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;
|
||||
|
||||
inode_table = this->itable;
|
||||
|
||||
xlator_call_fini (trav);
|
||||
|
||||
while (prev) {
|
||||
trav = prev->next;
|
||||
xlator_mem_free (prev);
|
||||
prev = trav;
|
||||
}
|
||||
|
||||
if (inode_table) {
|
||||
inode_table_destroy (inode_table);
|
||||
this->itable = NULL;
|
||||
}
|
||||
if (this->fini) {
|
||||
this->fini (this);
|
||||
xlator_mem_free (this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glusterfs_handle_terminate (rpcsvc_request_t *req)
|
||||
{
|
||||
@ -323,7 +259,6 @@ glusterfs_handle_terminate (rpcsvc_request_t *req)
|
||||
gf_log (THIS->name, GF_LOG_INFO, "detaching not-only"
|
||||
" child %s", xlator_req.name);
|
||||
top->notify (top, GF_EVENT_CLEANUP, victim);
|
||||
xlator_mem_cleanup (victim);
|
||||
}
|
||||
err:
|
||||
if (!lockflag)
|
||||
|
@ -1455,13 +1455,13 @@ cleanup_and_exit (int signum)
|
||||
trav = NULL;
|
||||
if (ctx->active)
|
||||
trav = ctx->active->top;
|
||||
/*while (trav) {
|
||||
while (trav) {
|
||||
if (should_call_fini(ctx,trav)) {
|
||||
THIS = trav;
|
||||
trav->fini (trav);
|
||||
}
|
||||
trav = trav->next;
|
||||
}*/
|
||||
}
|
||||
|
||||
/* NOTE: Only the least significant 8 bits i.e (signum & 255)
|
||||
will be available to parent process on calling exit() */
|
||||
|
@ -128,8 +128,5 @@ int glusterfs_volume_top_read_perf (uint32_t blk_size, uint32_t blk_count,
|
||||
void
|
||||
glusterfs_autoscale_threads (glusterfs_ctx_t *ctx, int incr);
|
||||
|
||||
void
|
||||
xlator_mem_cleanup (xlator_t *this);
|
||||
|
||||
extern glusterfs_ctx_t *glusterfsd_ctx;
|
||||
#endif /* __GLUSTERFSD_H__ */
|
||||
|
@ -301,6 +301,7 @@ is_fop_latency_started (call_frame_t *frame)
|
||||
throughput, iosstat); \
|
||||
} while (0)
|
||||
|
||||
|
||||
static int
|
||||
ios_fd_ctx_get (fd_t *fd, xlator_t *this, struct ios_fd **iosfd)
|
||||
{
|
||||
|
@ -229,6 +229,18 @@ notify (xlator_t *this, int event, void *data, ...)
|
||||
if (!priv)
|
||||
return 0;
|
||||
|
||||
switch (event) {
|
||||
case GF_EVENT_CLEANUP:
|
||||
if (priv->signth) {
|
||||
(void) gf_thread_cleanup_xint (priv->signth);
|
||||
priv->signth = 0;
|
||||
}
|
||||
if (priv->container.thread) {
|
||||
(void) gf_thread_cleanup_xint (priv->container.thread);
|
||||
priv->container.thread = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default_notify (this, event, data);
|
||||
return 0;
|
||||
}
|
||||
@ -251,7 +263,6 @@ fini (xlator_t *this)
|
||||
"Could not cancel sign serializer thread");
|
||||
goto out;
|
||||
}
|
||||
priv->signth = 0;
|
||||
|
||||
while (!list_empty (&priv->squeue)) {
|
||||
sigstub = list_first_entry (&priv->squeue,
|
||||
@ -273,19 +284,12 @@ fini (xlator_t *this)
|
||||
goto out;
|
||||
}
|
||||
|
||||
priv->container.thread = 0;
|
||||
|
||||
while (!list_empty (&priv->container.bad_queue)) {
|
||||
stub = list_first_entry (&priv->container.bad_queue, call_stub_t,
|
||||
list);
|
||||
list_del_init (&stub->list);
|
||||
call_stub_destroy (stub);
|
||||
}
|
||||
|
||||
if (priv->local_pool) {
|
||||
mem_pool_destroy (priv->local_pool);
|
||||
priv->local_pool = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
pthread_mutex_destroy (&priv->container.bad_lock);
|
||||
pthread_cond_destroy (&priv->container.bad_cond);
|
||||
|
@ -275,10 +275,6 @@ changelog_rpc_server_destroy (xlator_t *this, rpcsvc_t *rpc, char *sockfile,
|
||||
|
||||
(void) rpcsvc_unregister_notify (rpc, fn, this);
|
||||
sys_unlink (sockfile);
|
||||
if (rpc->rxpool) {
|
||||
mem_pool_destroy (rpc->rxpool);
|
||||
rpc->rxpool = NULL;
|
||||
}
|
||||
|
||||
GF_FREE (rpc);
|
||||
}
|
||||
|
@ -2111,6 +2111,14 @@ notify (xlator_t *this, int event, void *data, ...)
|
||||
if (!priv)
|
||||
goto out;
|
||||
|
||||
if (event == GF_EVENT_CLEANUP) {
|
||||
/* terminate helper threads */
|
||||
changelog_cleanup_helper_threads (this, priv);
|
||||
|
||||
/* terminate RPC server/threads */
|
||||
changelog_cleanup_rpc_threads (this, priv);
|
||||
}
|
||||
|
||||
if (event == GF_EVENT_TRANSLATOR_OP) {
|
||||
|
||||
dict = data;
|
||||
@ -2914,7 +2922,6 @@ fini (xlator_t *this)
|
||||
}
|
||||
|
||||
this->private = NULL;
|
||||
this->local_pool = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "tier-ctr-interface.h"
|
||||
|
||||
/*******************************inode forget***********************************/
|
||||
|
||||
int
|
||||
ctr_forget (xlator_t *this, inode_t *inode)
|
||||
{
|
||||
@ -2305,6 +2306,15 @@ notify (xlator_t *this, int event, void *data, ...)
|
||||
if (!priv)
|
||||
goto out;
|
||||
|
||||
if (event == GF_EVENT_CLEANUP) {
|
||||
if (fini_db (priv->_db_conn)) {
|
||||
gf_msg (this->name, GF_LOG_WARNING, 0,
|
||||
CTR_MSG_CLOSE_DB_CONN_FAILED, "Failed closing "
|
||||
"db connection");
|
||||
}
|
||||
if (priv->_db_conn)
|
||||
priv->_db_conn = NULL;
|
||||
}
|
||||
ret = default_notify (this, event, data);
|
||||
|
||||
out:
|
||||
@ -2345,10 +2355,6 @@ fini (xlator_t *this)
|
||||
CTR_MSG_CLOSE_DB_CONN_FAILED, "Failed closing "
|
||||
"db connection");
|
||||
}
|
||||
|
||||
if (priv->_db_conn)
|
||||
priv->_db_conn = NULL;
|
||||
|
||||
GF_FREE (priv->ctr_db_path);
|
||||
if (pthread_mutex_destroy (&priv->compact_lock)) {
|
||||
gf_msg (this->name, GF_LOG_WARNING, 0,
|
||||
@ -2358,7 +2364,6 @@ fini (xlator_t *this)
|
||||
}
|
||||
GF_FREE (priv);
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -2460,13 +2460,6 @@ fini (xlator_t *this)
|
||||
priv = this->private;
|
||||
if (!priv)
|
||||
goto out;
|
||||
|
||||
priv->down = _gf_true;
|
||||
pthread_cond_broadcast (&priv->cond);
|
||||
if (priv->thread) {
|
||||
gf_thread_cleanup_xint (priv->thread);
|
||||
priv->thread = 0;
|
||||
}
|
||||
this->private = NULL;
|
||||
LOCK_DESTROY (&priv->lock);
|
||||
pthread_cond_destroy (&priv->cond);
|
||||
@ -2478,11 +2471,8 @@ fini (xlator_t *this)
|
||||
if (priv->complete_watchlist)
|
||||
dict_unref (priv->complete_watchlist);
|
||||
GF_FREE (priv);
|
||||
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
out:
|
||||
return;
|
||||
}
|
||||
@ -2552,6 +2542,13 @@ notify (xlator_t *this, int event, void *data, ...)
|
||||
if (!priv)
|
||||
return 0;
|
||||
|
||||
switch (event) {
|
||||
case GF_EVENT_CLEANUP:
|
||||
priv->down = _gf_true;
|
||||
pthread_cond_broadcast (&priv->cond);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = default_notify (this, event, data);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1041,17 +1041,14 @@ fini (xlator_t *this)
|
||||
|
||||
priv->fini = _gf_true;
|
||||
pthread_cond_broadcast (&priv->cond);
|
||||
if (priv->recall_thr) {
|
||||
gf_thread_cleanup_xint (priv->recall_thr);
|
||||
priv->recall_thr = 0;
|
||||
priv->inited_recall_thr = _gf_false;
|
||||
}
|
||||
pthread_join (priv->recall_thr, NULL);
|
||||
|
||||
priv->inited_recall_thr = _gf_false;
|
||||
|
||||
GF_FREE (priv);
|
||||
if (this->ctx->tw) {
|
||||
glusterfs_ctx_tw_put (this->ctx);
|
||||
this->ctx->tw = NULL;
|
||||
}
|
||||
|
||||
glusterfs_ctx_tw_put (this->ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3292,12 +3292,6 @@ marker_priv_cleanup (xlator_t *this)
|
||||
LOCK_DESTROY (&priv->lock);
|
||||
|
||||
GF_FREE (priv);
|
||||
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
return;
|
||||
}
|
||||
|
@ -5219,18 +5219,6 @@ out:
|
||||
void
|
||||
fini (xlator_t *this)
|
||||
{
|
||||
quota_priv_t *priv = NULL;
|
||||
|
||||
priv = this->private;
|
||||
if (!priv)
|
||||
return;
|
||||
this->private = NULL;
|
||||
LOCK_DESTROY (&priv->lock);
|
||||
GF_FREE (priv);
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ trash_unlink_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
struct iatt *preoldparent, struct iatt *postoldparent,
|
||||
struct iatt *prenewparent, struct iatt *postnewparent,
|
||||
dict_t *xdata);
|
||||
|
||||
/* Common routines used in this translator */
|
||||
|
||||
/**
|
||||
@ -2430,7 +2431,6 @@ notify (xlator_t *this, int event, void *data, ...)
|
||||
ret = create_internalop_directory (this);
|
||||
|
||||
}
|
||||
|
||||
out:
|
||||
ret = default_notify (this, event, data);
|
||||
if (ret)
|
||||
@ -2612,11 +2612,10 @@ void
|
||||
fini (xlator_t *this)
|
||||
{
|
||||
trash_private_t *priv = NULL;
|
||||
inode_table_t *inode_table = NULL;
|
||||
|
||||
GF_VALIDATE_OR_GOTO ("trash", this, out);
|
||||
priv = this->private;
|
||||
inode_table = priv->trash_itable;
|
||||
|
||||
if (priv) {
|
||||
if (priv->newtrash_dir)
|
||||
GF_FREE (priv->newtrash_dir);
|
||||
@ -2626,17 +2625,9 @@ fini (xlator_t *this)
|
||||
GF_FREE (priv->brick_path);
|
||||
if (priv->eliminate)
|
||||
wipe_eliminate_path (&priv->eliminate);
|
||||
if (inode_table) {
|
||||
inode_table_destroy (inode_table);
|
||||
priv->trash_itable = NULL;
|
||||
}
|
||||
GF_FREE (priv);
|
||||
}
|
||||
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->private = NULL;
|
||||
out:
|
||||
return;
|
||||
|
@ -2446,11 +2446,8 @@ fini (xlator_t *this)
|
||||
|
||||
priv->fini = 1;
|
||||
|
||||
if (priv->reaper_thr) {
|
||||
gf_thread_cleanup_xint (priv->reaper_thr);
|
||||
priv->reaper_thr = 0;
|
||||
priv->reaper_init_done = _gf_false;
|
||||
}
|
||||
if (priv->reaper_init_done)
|
||||
pthread_join (priv->reaper_thr, NULL);
|
||||
|
||||
dict_unref (priv->xattrs);
|
||||
LOCK_DESTROY (&priv->inode_ctx_lk);
|
||||
@ -2460,11 +2457,6 @@ fini (xlator_t *this)
|
||||
* before calling xlator_fini */
|
||||
GF_FREE (priv);
|
||||
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -946,12 +946,5 @@ out:
|
||||
int32_t
|
||||
fini (xlator_t *this)
|
||||
{
|
||||
if (!this)
|
||||
return 0;
|
||||
|
||||
if (this->local_pool) {
|
||||
mem_pool_destroy (this->local_pool);
|
||||
this->local_pool = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1136,7 +1136,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
||||
{
|
||||
iot_conf_t *conf = this->private;
|
||||
|
||||
if (GF_EVENT_PARENT_DOWN == event)
|
||||
if ((GF_EVENT_PARENT_DOWN == event) ||
|
||||
(GF_EVENT_CLEANUP == event))
|
||||
iot_exit_threads (conf);
|
||||
|
||||
default_notify (this, event, data);
|
||||
|
@ -1500,6 +1500,7 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
|
||||
glusterfs_mgmt_pmap_signout (ctx,
|
||||
victim->name);
|
||||
glusterfs_autoscale_threads (THIS->ctx, -1);
|
||||
default_notify (victim, GF_EVENT_CLEANUP, data);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -105,7 +105,6 @@ extern char *marker_xattrs[];
|
||||
(lutimes (path, tv))
|
||||
#endif
|
||||
|
||||
|
||||
int32_t
|
||||
posix_priv (xlator_t *this)
|
||||
{
|
||||
@ -148,6 +147,9 @@ posix_notify (xlator_t *this,
|
||||
void *data,
|
||||
...)
|
||||
{
|
||||
struct posix_private *priv = NULL;
|
||||
|
||||
priv = this->private;
|
||||
switch (event)
|
||||
{
|
||||
case GF_EVENT_PARENT_UP:
|
||||
@ -155,6 +157,31 @@ posix_notify (xlator_t *this,
|
||||
/* Tell the parent that posix xlator is up */
|
||||
default_notify (this, GF_EVENT_CHILD_UP, data);
|
||||
}
|
||||
break;
|
||||
case GF_EVENT_CLEANUP:
|
||||
if (priv->health_check) {
|
||||
priv->health_check_active = _gf_false;
|
||||
pthread_cancel (priv->health_check);
|
||||
priv->health_check = 0;
|
||||
}
|
||||
if (priv->disk_space_check) {
|
||||
priv->disk_space_check_active = _gf_false;
|
||||
pthread_cancel (priv->disk_space_check);
|
||||
priv->disk_space_check = 0;
|
||||
}
|
||||
if (priv->janitor) {
|
||||
(void) gf_thread_cleanup_xint (priv->janitor);
|
||||
priv->janitor = 0;
|
||||
}
|
||||
if (priv->fsyncer) {
|
||||
(void) gf_thread_cleanup_xint (priv->fsyncer);
|
||||
priv->fsyncer = 0;
|
||||
}
|
||||
if (priv->mount_lock) {
|
||||
(void) sys_closedir (priv->mount_lock);
|
||||
priv->mount_lock = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
/* */
|
||||
@ -1106,24 +1133,6 @@ posix_fini (xlator_t *this)
|
||||
if (!priv)
|
||||
return;
|
||||
this->private = NULL;
|
||||
if (priv->health_check) {
|
||||
priv->health_check_active = _gf_false;
|
||||
pthread_cancel (priv->health_check);
|
||||
priv->health_check = 0;
|
||||
}
|
||||
if (priv->disk_space_check) {
|
||||
priv->disk_space_check_active = _gf_false;
|
||||
pthread_cancel (priv->disk_space_check);
|
||||
priv->disk_space_check = 0;
|
||||
}
|
||||
if (priv->janitor) {
|
||||
(void) gf_thread_cleanup_xint (priv->janitor);
|
||||
priv->janitor = 0;
|
||||
}
|
||||
if (priv->fsyncer) {
|
||||
(void) gf_thread_cleanup_xint (priv->fsyncer);
|
||||
priv->fsyncer = 0;
|
||||
}
|
||||
/*unlock brick dir*/
|
||||
if (priv->mount_lock)
|
||||
(void) sys_closedir (priv->mount_lock);
|
||||
|
@ -2060,7 +2060,6 @@ abort:
|
||||
gf_log (THIS->name, GF_LOG_INFO, "detaching not-only "
|
||||
" child %s", priv->base_path);
|
||||
top->notify (top, GF_EVENT_CLEANUP, victim);
|
||||
xlator_mem_cleanup (victim);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user