summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2018-05-23 09:10:11 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-05-25 02:05:37 +0000
commitb679fd4b73d9ec039029088769722887b61d750a (patch)
tree1fba7b4d16dea3ffa8808475d5d5cb44a3256bd1 /xlators
parent7b95d5a4b3988757bf8c91f82dcaf86ed3da6875 (diff)
Revert "glusterfsd: Memleak in glusterfsd process while brick mux is on"
Updates: bz#1582286 This reverts commit 7c3cc485054e4ede1efb358552135b432fb7047a. Change-Id: I831d646112bcfa13d0c2153482ad00ff1b23aa6c Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c1
-rw-r--r--xlators/features/bit-rot/src/stub/bit-rot-stub.c22
-rw-r--r--xlators/features/changelog/src/changelog-ev-handle.c8
-rw-r--r--xlators/features/changelog/src/changelog-rpc-common.c4
-rw-r--r--xlators/features/changelog/src/changelog.c12
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c15
-rw-r--r--xlators/features/index/src/index.c21
-rw-r--r--xlators/features/leases/src/leases.c15
-rw-r--r--xlators/features/marker/src/marker.c71
-rw-r--r--xlators/features/quota/src/quota.c23
-rw-r--r--xlators/features/shard/src/shard.c3
-rw-r--r--xlators/features/trash/src/trash.c15
-rw-r--r--xlators/features/upcall/src/upcall.c18
-rw-r--r--xlators/performance/decompounder/src/decompounder.c7
-rw-r--r--xlators/performance/io-threads/src/io-threads.c6
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c1
-rw-r--r--xlators/protocol/server/src/server.c11
-rw-r--r--xlators/storage/posix/src/posix-common.c50
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c2
-rw-r--r--xlators/storage/posix/src/posix-helpers.c3
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c15
-rw-r--r--xlators/storage/posix/src/posix-inode-handle.h6
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c4
23 files changed, 126 insertions, 207 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index f5d86e1bc6a..6ddad96d8aa 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -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)
{
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
index 830357070d6..76a4c3f6962 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
@@ -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);
diff --git a/xlators/features/changelog/src/changelog-ev-handle.c b/xlators/features/changelog/src/changelog-ev-handle.c
index b5681944567..a7f485b019f 100644
--- a/xlators/features/changelog/src/changelog-ev-handle.c
+++ b/xlators/features/changelog/src/changelog-ev-handle.c
@@ -163,14 +163,12 @@ changelog_rpc_notify (struct rpc_clnt *rpc,
*/
rpc_clnt_unref (crpc->rpc);
- if (priv)
- selection = &priv->ev_selection;
+ selection = &priv->ev_selection;
LOCK (&crpc->lock);
{
- if (selection)
- changelog_deselect_event (this, selection,
- crpc->filter);
+ changelog_deselect_event (this, selection,
+ crpc->filter);
changelog_set_disconnect_flag (crpc, _gf_true);
}
UNLOCK (&crpc->lock);
diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c
index 1745f218b08..7bd5b688fa5 100644
--- a/xlators/features/changelog/src/changelog-rpc-common.c
+++ b/xlators/features/changelog/src/changelog-rpc-common.c
@@ -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);
}
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index 19d66b605bb..464a28dde6e 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -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;
@@ -2904,9 +2912,6 @@ fini (xlator_t *this)
/* cleanup barrier related objects */
changelog_barrier_pthread_destroy (priv);
- /* cleanup helper threads */
- changelog_cleanup_helper_threads (this, priv);
-
/* cleanup allocated options */
changelog_freeup_options (this, priv);
@@ -2917,7 +2922,6 @@ fini (xlator_t *this)
}
this->private = NULL;
- this->local_pool = NULL;
return;
}
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 40bfcf4a32a..e97e3ad6cfa 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -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;
}
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index f39d901d624..152b52dfc33 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -2451,13 +2451,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);
@@ -2469,11 +2462,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;
}
@@ -2543,6 +2533,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;
}
diff --git a/xlators/features/leases/src/leases.c b/xlators/features/leases/src/leases.c
index 34143859c56..a0423491d9e 100644
--- a/xlators/features/leases/src/leases.c
+++ b/xlators/features/leases/src/leases.c
@@ -1063,17 +1063,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;
}
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 659ca890066..95297922ec5 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -3193,21 +3193,39 @@ mem_acct_init (xlator_t *this)
int32_t
init_xtime_priv (xlator_t *this, dict_t *options)
{
+ data_t *data = NULL;
int32_t ret = -1;
marker_conf_t *priv = NULL;
- char *tmp_opt = NULL;
GF_VALIDATE_OR_GOTO ("marker", this, out);
GF_VALIDATE_OR_GOTO (this->name, options, out);
GF_VALIDATE_OR_GOTO (this->name, this->private, out);
priv = this->private;
+ data = dict_get (options, VOLUME_UUID);
+ if (data != NULL) {
+ priv->volume_uuid = data->data;
+
+ ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "invalid volume uuid %s", priv->volume_uuid);
+ goto out;
+ }
- ret = dict_get_str (options, "volume-uuid", &tmp_opt);
+ ret = gf_asprintf (&(priv->marker_xattr), "%s.%s.%s",
+ MARKER_XATTR_PREFIX, priv->volume_uuid,
+ XTIME);
- if (ret) {
+ if (ret == -1) {
+ priv->marker_xattr = NULL;
+ goto out;
+ }
+
+ gf_log (this->name, GF_LOG_DEBUG,
+ "volume-uuid = %s", priv->volume_uuid);
+ } else {
priv->volume_uuid = NULL;
- tmp_opt = "";
gf_log (this->name, GF_LOG_ERROR,
"please specify the volume-uuid"
@@ -3215,32 +3233,16 @@ init_xtime_priv (xlator_t *this, dict_t *options)
return -1;
}
- gf_asprintf (&priv->volume_uuid, "%s", tmp_opt);
+ data = dict_get (options, TIMESTAMP_FILE);
+ if (data != NULL) {
+ priv->timestamp_file = data->data;
- ret = gf_uuid_parse (priv->volume_uuid, priv->volume_uuid_bin);
-
- if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "invalid volume uuid %s", priv->volume_uuid);
- goto out;
- }
-
- ret = gf_asprintf (&(priv->marker_xattr), "%s.%s.%s",
- MARKER_XATTR_PREFIX, priv->volume_uuid,
- XTIME);
-
- if (ret == -1) {
- priv->marker_xattr = NULL;
- goto out;
- }
-
- gf_log (this->name, GF_LOG_DEBUG,
- "volume-uuid = %s", priv->volume_uuid);
+ gf_log (this->name, GF_LOG_DEBUG,
+ "the timestamp-file is = %s",
+ priv->timestamp_file);
- ret = dict_get_str (options, "timestamp-file", &tmp_opt);
- if (ret) {
+ } else {
priv->timestamp_file = NULL;
- tmp_opt = "";
gf_log (this->name, GF_LOG_ERROR,
"please specify the timestamp-file"
@@ -3249,15 +3251,6 @@ init_xtime_priv (xlator_t *this, dict_t *options)
goto out;
}
- ret = gf_asprintf (&priv->timestamp_file, "%s", tmp_opt);
- if (ret == -1) {
- priv->timestamp_file = NULL;
- goto out;
- }
-
- gf_log (this->name, GF_LOG_DEBUG,
- "the timestamp-file is = %s", priv->timestamp_file);
-
ret = 0;
out:
return ret;
@@ -3299,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;
}
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index cd7f0147d75..2b440bb5827 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -5242,8 +5242,6 @@ quota_priv_dump (xlator_t *this)
GF_ASSERT (this);
priv = this->private;
- if (!priv)
- goto out;
gf_proc_dump_add_section ("xlators.features.quota.priv", this->name);
@@ -5269,27 +5267,6 @@ out:
void
fini (xlator_t *this)
{
- quota_priv_t *priv = NULL;
- rpc_clnt_t *rpc = NULL;
- int i = 0, cnt = 0;
-
- priv = this->private;
- if (!priv)
- return;
- rpc = priv->rpc_clnt;
- priv->rpc_clnt = NULL;
- this->private = NULL;
- if (rpc) {
- cnt = GF_ATOMIC_GET (rpc->refcount);
- for (i = 0; i < cnt; i++)
- rpc_clnt_unref (rpc);
- }
- LOCK_DESTROY (&priv->lock);
- GF_FREE (priv);
- if (this->local_pool) {
- mem_pool_destroy (this->local_pool);
- this->local_pool = NULL;
- }
return;
}
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index d27f5e51921..9578dabca44 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -5681,9 +5681,6 @@ shard_forget (xlator_t *this, inode_t *inode)
shard_priv_t *priv = NULL;
priv = this->private;
- if (!priv)
- return 0;
-
inode_ctx_del (inode, this, &ctx_uint);
if (!ctx_uint)
return 0;
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index e8f8b7bf051..cfdcc6ff5fc 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -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;
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index dc09b2b3027..8ea5e3a4c6d 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -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,24 +2457,13 @@ 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;
}
int
upcall_forget (xlator_t *this, inode_t *inode)
{
- upcall_private_t *priv = this->private;
-
- if (!priv)
- goto out;
-
upcall_cleanup_inode_ctx (this, inode);
-out:
return 0;
}
diff --git a/xlators/performance/decompounder/src/decompounder.c b/xlators/performance/decompounder/src/decompounder.c
index 2bc73efdfd3..ba8fe9e24f0 100644
--- a/xlators/performance/decompounder/src/decompounder.c
+++ b/xlators/performance/decompounder/src/decompounder.c
@@ -944,12 +944,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;
}
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 4531137c936..0b39628ba69 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -370,8 +370,7 @@ iot_schedule (call_frame_t *frame, xlator_t *this, call_stub_t *stub)
out:
gf_msg_debug (this->name, 0, "%s scheduled as %s fop",
gf_fop_list[stub->fop], iot_get_pri_meaning (pri));
- if (this->private)
- ret = do_iot_schedule (this->private, stub, pri);
+ ret = do_iot_schedule (this->private, stub, pri);
return ret;
}
@@ -1300,7 +1299,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);
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 7554984f80e..c015a246a6c 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -3516,7 +3516,6 @@ rpc_receive_common (rpcsvc_request_t *req, call_frame_t **fr,
SERVER_REQ_SET_ERROR (req, ret);
goto out;
}
-
if (!(*fr)->root->client->bound_xl->itable) {
/* inode_table is not allocated successful in server_setvolume */
SERVER_REQ_SET_ERROR (req, ret);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index c71ad89b870..4c94a324f2c 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -1419,7 +1419,7 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
case GF_EVENT_CHILD_UP:
{
list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
+ status_list) {
if (tmp->name == NULL)
break;
if (strcmp (tmp->name, victim->name) == 0)
@@ -1434,7 +1434,7 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
tmp->name = gf_strdup (victim->name);
tmp->child_up = _gf_true;
list_add_tail (&tmp->status_list,
- &conf->child_status->status_list);
+ &conf->child_status->status_list);
}
ret = server_process_child_event (this, event, data,
GF_CBK_CHILD_UP);
@@ -1451,7 +1451,7 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
case GF_EVENT_CHILD_DOWN:
{
list_for_each_entry (tmp, &conf->child_status->status_list,
- status_list) {
+ status_list) {
if (strcmp (tmp->name, victim->name) == 0) {
tmp->child_up = _gf_false;
break;
@@ -1514,7 +1514,7 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
trav_p = &(*trav_p)->next) {
travxl = (*trav_p)->xlator;
if (travxl &&
- strcmp (travxl->name, victim->name) == 0) {
+ strcmp (travxl->name, victim->name) == 0) {
victim_found = _gf_true;
break;
}
@@ -1527,7 +1527,8 @@ server_notify (xlator_t *this, int32_t event, void *data, ...)
(*trav_p) = (*trav_p)->next;
rpc_clnt_mgmt_pmap_signout (ctx, victim->name);
/* we need the protocol/server xlator here as 'this' */
- rpcsvc_autoscale_threads (ctx, conf->rpc, -1);
+ glusterfs_autoscale_threads (ctx, -1, this);
+ default_notify (victim, GF_EVENT_CLEANUP, data);
}
break;
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index 64ab34c15c0..41c2d093090 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -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:
@@ -156,6 +158,31 @@ posix_notify (xlator_t *this,
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:
/* */
break;
@@ -1111,32 +1138,11 @@ 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);
GF_FREE (priv->base_path);
- LOCK_DESTROY (&priv->lock);
- pthread_mutex_destroy (&priv->janitor_lock);
- pthread_mutex_destroy (&priv->fsync_mutex);
GF_FREE (priv->hostname);
GF_FREE (priv->trash_path);
GF_FREE (priv);
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index 1058339855b..519b6f3f040 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -169,7 +169,6 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
- VALIDATE_OR_GOTO (this->private, out);
priv = this->private;
@@ -1066,7 +1065,6 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
- VALIDATE_OR_GOTO (this->private, out);
VALIDATE_OR_GOTO (loc, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 022f8b21571..c87f4f59b82 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -2165,7 +2165,7 @@ abort:
trav_p = &(*trav_p)->next) {
victim = (*trav_p)->xlator;
if (victim &&
- strcmp (victim->name, priv->base_path) == 0) {
+ strcmp (victim->name, priv->base_path) == 0) {
victim_found = _gf_true;
break;
}
@@ -2175,7 +2175,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);
}
}
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 2e5b7c5772a..bf7e87dc91b 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -1200,8 +1200,6 @@ posix_releasedir (xlator_t *this,
}
priv = this->private;
- if (!priv)
- goto out;
pthread_mutex_lock (&priv->janitor_lock);
{
@@ -2004,8 +2002,6 @@ posix_release (xlator_t *this, fd_t *fd)
"pfd->dir is %p (not NULL) for file fd=%p",
pfd->dir, fd);
}
- if (!priv)
- goto out;
pthread_mutex_lock (&priv->janitor_lock);
{
@@ -2200,7 +2196,6 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
- VALIDATE_OR_GOTO (this->private, out);
VALIDATE_OR_GOTO (loc, out);
VALIDATE_OR_GOTO (dict, out);
@@ -2903,7 +2898,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
- VALIDATE_OR_GOTO (this->private, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_INODE_HANDLE (real_path, this, loc, NULL);
@@ -3031,12 +3025,11 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto done;
}
if (loc->inode && name && (XATTR_IS_PATHINFO (name))) {
- VALIDATE_OR_GOTO (this->private, out);
- if (LOC_HAS_ABSPATH (loc)) {
+ if (LOC_HAS_ABSPATH (loc))
MAKE_REAL_PATH (rpath, this, loc->path);
- } else {
+ else
rpath = real_path;
- }
+
size = gf_asprintf (&host_buf, "<POSIX(%s):%s:%s>",
priv->base_path,
((priv->node_uuid_pathinfo &&
@@ -5356,8 +5349,6 @@ posix_forget (xlator_t *this, inode_t *inode)
struct posix_private *priv_posix = NULL;
priv_posix = (struct posix_private *) this->private;
- if (!priv_posix)
- return 0;
ret = inode_ctx_del (inode, this, &ctx_uint);
if (!ctx_uint)
diff --git a/xlators/storage/posix/src/posix-inode-handle.h b/xlators/storage/posix/src/posix-inode-handle.h
index 33d908fa3de..1dcabf2ffb2 100644
--- a/xlators/storage/posix/src/posix-inode-handle.h
+++ b/xlators/storage/posix/src/posix-inode-handle.h
@@ -55,12 +55,6 @@
} while (0)
#define MAKE_INODE_HANDLE(rpath, this, loc, iatt_p) do { \
- if (!this->private) { \
- gf_msg ("make_inode_handle", GF_LOG_ERROR, 0, \
- P_MSG_INODE_HANDLE_CREATE, \
- "private is NULL, fini is already called"); \
- break; \
- } \
if (gf_uuid_is_null (loc->gfid)) { \
gf_msg (this->name, GF_LOG_ERROR, 0, \
P_MSG_INODE_HANDLE_CREATE, \
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index aadd6fc9bb1..5dac688e02d 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -582,15 +582,13 @@ posix_acl_unref (xlator_t *this, struct posix_acl *acl)
int refcnt = 0;
conf = this->private;
- if (!conf)
- goto out;
LOCK(&conf->acl_lock);
{
refcnt = --acl->refcnt;
}
UNLOCK(&conf->acl_lock);
-out:
+
if (!refcnt)
posix_acl_destroy (this, acl);
}