diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2015-02-11 17:13:45 +0530 |
---|---|---|
committer | Krishnan Parthasarathi <kparthas@redhat.com> | 2015-02-20 04:04:08 -0800 |
commit | 9d842f965655bf70c643b4541844e83bc4e74190 (patch) | |
tree | 4d248f27d77993a478267a41e0517228214d7fa0 /xlators/mgmt/glusterd/src/glusterd-handler.c | |
parent | 571a71f0acd0ec59340b9d0d2519793e33a1dc16 (diff) |
glusterd: nfs,shd,quotad,snapd daemons refactoring
This patch ports nfs, shd, quotad & snapd with the approach suggested in
http://www.gluster.org/pipermail/gluster-devel/2014-December/043180.html
Change-Id: I4ea5b38793f87fc85cc9d2cf873727351dedffd2
BUG: 1191486
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/9428
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Nekkunti <anekkunt@redhat.com>
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; |