summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-sm.c
diff options
context:
space:
mode:
authorGaurav Kumar Garg <garg.gaurav52@gmail.com>2015-08-21 19:03:03 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-08-26 04:58:03 -0700
commit9d71c362b11544494b3fe68477cc47abe3bb2cde (patch)
treee0a374d6f73cdc0c842422af46e168bf3d0bd45e /xlators/mgmt/glusterd/src/glusterd-sm.c
parent27b455dc369f60d36d83c6bcbc10245dfe733f46 (diff)
glusterd: stop all the daemons services on peer detach
Backport of: http://review.gluster.org/#/c/11509/ Currently glusterd is not stopping all the deamon service on peer detach With this fix it will do peer detach cleanup properlly and will stop all the daemon which was running before peer detach on the node. Change-Id: Ifed403ed09187e84f2a60bf63135156ad1f15775 BUG: 1238706 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/11971 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index ec8d50d6062..926a4386bb5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -35,6 +35,7 @@
#include "glusterd-op-sm.h"
#include "glusterd-utils.h"
#include "glusterd-store.h"
+#include "glusterd-svc-helper.h"
#include "glusterd-snapshot-utils.h"
#include "glusterd-server-quorum.h"
@@ -600,17 +601,29 @@ out:
/* Clean up stale volumes on the peer being detached. The volumes which have
* bricks on other peers are stale with respect to the detached peer.
*/
-static int
+static void
glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
{
- int ret = -1;
- glusterd_volinfo_t *volinfo = NULL;
+ int ret = -1;
+ glusterd_volinfo_t *volinfo = NULL;
glusterd_volinfo_t *tmp_volinfo = NULL;
+ glusterd_svc_t *svc = NULL;
GF_ASSERT (priv);
cds_list_for_each_entry_safe (volinfo, tmp_volinfo, &priv->volumes,
vol_list) {
+ /* Stop snapd daemon service if snapd daemon is running*/
+ if (!volinfo->is_snap_volume) {
+ svc = &(volinfo->snapd.svc);
+ ret = svc->stop (svc, SIGTERM);
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_STOP_FAIL, "Failed to "
+ "stop snapd daemon service.");
+ }
+ }
+
/* The peer detach checks make sure that, at this point in the
* detach process, there are only volumes contained completely
* within or completely outside the detached peer.
@@ -627,14 +640,17 @@ glusterd_peer_detach_cleanup (glusterd_conf_t *priv)
gf_msg (THIS->name, GF_LOG_ERROR, 0,
GD_MSG_STALE_VOL_REMOVE_FAIL,
"Error deleting stale volume");
- goto out;
}
}
}
- ret = 0;
-out:
- gf_msg_debug (THIS->name, 0, "Returning %d", ret);
- return ret;
+
+ /* Stop all daemon services of Detaching node once peer detached */
+ ret = glusterd_svcs_stop ();
+ if (ret) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_SVC_STOP_FAIL,
+ "Failed to stop all daemon services.");
+ }
}
static int
@@ -679,13 +695,7 @@ glusterd_ac_handle_friend_remove_req (glusterd_friend_sm_event_t *event,
}
rcu_read_unlock ();
- ret = glusterd_peer_detach_cleanup (priv);
- if (ret) {
- gf_msg (THIS->name, GF_LOG_WARNING, 0,
- GD_MSG_PEER_DETACH_CLEANUP_FAIL,
- "Peer detach cleanup was not successful");
- ret = 0;
- }
+ glusterd_peer_detach_cleanup (priv);
out:
if (new_event)
GF_FREE (new_event->peername);