diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/src/changelog-ev-handle.c | 12 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 1 |
4 files changed, 18 insertions, 1 deletions
diff --git a/xlators/features/changelog/src/changelog-ev-handle.c b/xlators/features/changelog/src/changelog-ev-handle.c index 79652a969bd..77637c7beec 100644 --- a/xlators/features/changelog/src/changelog-ev-handle.c +++ b/xlators/features/changelog/src/changelog-ev-handle.c @@ -157,6 +157,13 @@ changelog_rpc_notify (struct rpc_clnt *rpc, break; case RPC_CLNT_DISCONNECT: rpc_clnt_disable (crpc->rpc); + + /* rpc_clnt_disable doesn't unref the rpc. It just marks + * the rpc as disabled and cancels reconnection timer. + * Hence unref the rpc object to free it. + */ + rpc_clnt_unref (crpc->rpc); + selection = &priv->ev_selection; LOCK (&crpc->lock); @@ -170,6 +177,8 @@ changelog_rpc_notify (struct rpc_clnt *rpc, break; case RPC_CLNT_MSG: case RPC_CLNT_DESTROY: + /* Free up mydata */ + changelog_rpc_clnt_unref (crpc); break; } @@ -253,7 +262,9 @@ get_client (changelog_clnt_t *c_clnt, struct list_head **next) if (*next == &c_clnt->active) goto unblock; crpc = list_entry (*next, changelog_rpc_clnt_t, list); + /* ref rpc as DISCONNECT might unref the rpc asynchronously */ changelog_rpc_clnt_ref (crpc); + rpc_clnt_ref (crpc->rpc); *next = (*next)->next; } unblock: @@ -267,6 +278,7 @@ put_client (changelog_clnt_t *c_clnt, changelog_rpc_clnt_t *crpc) { LOCK (&c_clnt->active_lock); { + rpc_clnt_unref (crpc->rpc); changelog_rpc_clnt_unref (crpc); } UNLOCK (&c_clnt->active_lock); diff --git a/xlators/features/changelog/src/changelog-rpc.c b/xlators/features/changelog/src/changelog-rpc.c index 76addf18545..4bc24203118 100644 --- a/xlators/features/changelog/src/changelog-rpc.c +++ b/xlators/features/changelog/src/changelog-rpc.c @@ -199,7 +199,10 @@ changelog_rpc_clnt_init (xlator_t *this, goto error_return; INIT_LIST_HEAD (&crpc->list); - crpc->ref = 0; + /* Take a ref, the last unref will be on RPC_CLNT_DESTROY + * which comes as a result of last rpc_clnt_unref. + */ + crpc->ref = 1; changelog_set_disconnect_flag (crpc, _gf_false); crpc->filter = rpc_req->filter; diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index e0eee02ed52..35fa4627d04 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -144,6 +144,7 @@ __glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata, glusterd_store_perform_node_state_store (volinfo); + rpc_clnt_reconnect_cleanup (&defrag->rpc->conn); glusterd_defrag_rpc_put (defrag); if (defrag->cbk_fn) defrag->cbk_fn (volinfo, diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 0cca218488b..a03b041a4e8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -10612,6 +10612,7 @@ glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc) GF_ASSERT (conf); GF_ASSERT (rpc); synclock_unlock (&conf->big_lock); + (void) rpc_clnt_reconnect_cleanup (&rpc->conn); ret = rpc_clnt_unref (rpc); synclock_lock (&conf->big_lock); |