diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 114 |
1 files changed, 3 insertions, 111 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 803a13c8393..8ba16b7a804 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -64,10 +64,12 @@ int glusterd_big_locked_notify (struct rpc_clnt *rpc, void *mydata, void *data, rpc_clnt_notify_t notify_fn) { glusterd_conf_t *priv = THIS->private; - int ret = -1; + int ret = -1; + synclock_lock (&priv->big_lock); ret = notify_fn (rpc, mydata, event, data); synclock_unlock (&priv->big_lock); + return ret; } @@ -4411,116 +4413,6 @@ glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata, } int -__glusterd_snapd_rpc_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, void *data) -{ - xlator_t *this = NULL; - glusterd_conf_t *conf = NULL; - glusterd_volinfo_t *volinfo = NULL; - int ret = 0; - - this = THIS; - GF_ASSERT (this); - conf = this->private; - GF_ASSERT (conf); - - volinfo = mydata; - if (!volinfo) - return 0; - - switch (event) { - case RPC_CLNT_CONNECT: - gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); - - (void) glusterd_snapd_set_online_status (volinfo, _gf_true); - - break; - - case RPC_CLNT_DISCONNECT: - if (glusterd_is_snapd_online (volinfo)) { - gf_msg (this->name, GF_LOG_INFO, 0, - GD_MSG_NODE_DISCONNECTED, - "snapd for volume %s has disconnected from " - "glusterd.", volinfo->volname); - - (void) glusterd_snapd_set_online_status - (volinfo, _gf_false); - } - break; - - case RPC_CLNT_DESTROY: - glusterd_volinfo_unref (volinfo); - break; - - default: - gf_log (this->name, GF_LOG_TRACE, - "got some other RPC event %d", event); - break; - } - - return ret; -} - -int -glusterd_snapd_rpc_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, void *data) -{ - return glusterd_big_locked_notify (rpc, mydata, event, data, - __glusterd_snapd_rpc_notify); -} - -int -__glusterd_nodesvc_rpc_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, void *data) -{ - xlator_t *this = NULL; - glusterd_conf_t *conf = NULL; - char *server = NULL; - int ret = 0; - - this = THIS; - GF_ASSERT (this); - conf = this->private; - GF_ASSERT (conf); - - server = mydata; - if (!server) - return 0; - - switch (event) { - case RPC_CLNT_CONNECT: - gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); - (void) glusterd_nodesvc_set_online_status (server, _gf_true); - ret = default_notify (this, GF_EVENT_CHILD_UP, NULL); - - break; - - case RPC_CLNT_DISCONNECT: - if (glusterd_is_nodesvc_online (server)) { - gf_msg (this->name, GF_LOG_INFO, 0, GD_MSG_NODE_DISCONNECTED, - "%s has disconnected from glusterd.", server); - (void) glusterd_nodesvc_set_online_status (server, _gf_false); - } - break; - - default: - gf_log (this->name, GF_LOG_TRACE, - "got some other RPC event %d", event); - break; - } - - return ret; -} - -int -glusterd_nodesvc_rpc_notify (struct rpc_clnt *rpc, void *mydata, - rpc_clnt_event_t event, void *data) -{ - return glusterd_big_locked_notify (rpc, mydata, event, data, - __glusterd_nodesvc_rpc_notify); -} - -int glusterd_friend_remove_notify (glusterd_peerctx_t *peerctx) { int ret = -1; |