diff options
author | Mohammed Rafi KC <rkavunga@redhat.com> | 2019-01-23 21:55:01 +0530 |
---|---|---|
committer | mohammed rafi kc <rkavunga@redhat.com> | 2019-02-12 07:05:58 +0000 |
commit | 34e6028e4ceaff5ceb1165317a3a90d02e0da4ac (patch) | |
tree | f7a779af63751ee2f94407ae343c8c086ad58259 /libglusterfs | |
parent | ecd1b4f700ea7a32cc4b46c633f88db7901ff320 (diff) |
clnt/rpc: ref leak during disconnect.
During disconnect cleanup, we are not cancelling reconnect
timer, which causes a ref leak each time when a disconnect
happen.
Change-Id: I9d05d1f368d080e04836bf6a0bb018bf8f7b5b8a
updates: bz#1659708
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/timer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c index d882543b08b..2643c07820b 100644 --- a/libglusterfs/src/timer.c +++ b/libglusterfs/src/timer.c @@ -75,13 +75,13 @@ gf_timer_call_cancel(glusterfs_ctx_t *ctx, gf_timer_t *event) if (ctx == NULL || event == NULL) { gf_msg_callingfn("timer", GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG, "invalid argument"); - return 0; + return -1; } if (ctx->cleanup_started) { gf_msg_callingfn("timer", GF_LOG_INFO, 0, LG_MSG_CTX_CLEANUP_STARTED, "ctx cleanup started"); - return 0; + return -1; } LOCK(&ctx->lock); @@ -93,10 +93,9 @@ gf_timer_call_cancel(glusterfs_ctx_t *ctx, gf_timer_t *event) if (!reg) { /* This can happen when cleanup may have just started and * gf_timer_registry_destroy() sets ctx->timer to NULL. - * Just bail out as success as gf_timer_proc() takes - * care of cleaning up the events. + * gf_timer_proc() takes care of cleaning up the events. */ - return 0; + return -1; } LOCK(®->lock); @@ -203,6 +202,13 @@ gf_timer_proc(void *data) list_for_each_entry_safe(event, tmp, ®->active, list) { list_del(&event->list); + /* TODO Possible resource leak + * Before freeing the event, we need to call the respective + * event functions and free any resources. + * For example, In case of rpc_clnt_reconnect, we need to + * unref rpc object which was taken when added to timer + * wheel. + */ GF_FREE(event); } } |