summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-01-22 07:28:45 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-02-04 19:20:35 -0800
commitbea2e811a5fe9b84a1a46f6403d4291ba16965be (patch)
tree41c19444bd06ca592f26d47b687a7184d2bfbf57 /xlators/mgmt/glusterd/src/glusterd-snapshot.c
parentaa53d35780a2b742a66c6b690d1d20dc173168cf (diff)
glusterd/snapshot : snapshot delete - check if process is killed before unmounting.
Change-Id: Idf0cf63429212142795e1aeb4fd4962b51620426 BUG: 1049353 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/6772 Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-snapshot.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index db1afd37b..f8a84cb26 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -3533,6 +3533,8 @@ glusterd_remove_snap (glusterd_brickinfo_t *brickinfo, const char *mount_pt,
glusterd_conf_t *priv = NULL;
runner_t runner = {0,};
char msg[1024] = {0, };
+ char pidfile[PATH_MAX] = {0, };
+ pid_t pid = -1;
this = THIS;
GF_ASSERT (this);
@@ -3557,6 +3559,18 @@ glusterd_remove_snap (glusterd_brickinfo_t *brickinfo, const char *mount_pt,
//usleep (24007);
//ret = umount2 (mount_pt, MNT_FORCE);
+
+ GLUSTERD_GET_SNAP_BRICK_PIDFILE (pidfile, volname, snapname, brickinfo,
+ priv);
+ if (glusterd_is_service_running (pidfile, &pid)) {
+ ret = kill (pid, SIGKILL);
+ if (ret && errno != ESRCH) {
+ gf_log (this->name, GF_LOG_ERROR, "Unable to kill pid "
+ "%d reason : %s", pid, strerror(errno));
+ goto out;
+ }
+ }
+
runinit (&runner);
snprintf (msg, sizeof (msg), "umount the snapshot mounted path %s",
mount_pt);