summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c12
2 files changed, 23 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index db1afd3..f8a84cb 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);
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 5dfc964..56a6414 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2048,9 +2048,15 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo,
GLUSTERD_GET_VOLUME_DIR (pathname, volinfo, priv);
}
- snprintf (delete_path, sizeof (delete_path),
- "%s/"GLUSTERD_TRASH"/%s.deleted", priv->workdir,
- uuid_utoa (volinfo->volume_id));
+ if (snapinfo == NULL ) {
+ snprintf (delete_path, sizeof (delete_path),
+ "%s/"GLUSTERD_TRASH"/%s.deleted", priv->workdir,
+ uuid_utoa (volinfo->volume_id));
+ } else {
+ snprintf (delete_path, sizeof (delete_path),
+ "%s/"GLUSTERD_TRASH"/%s.deleted", priv->workdir,
+ uuid_utoa (snapinfo->volume_id));
+ }
snprintf (trashdir, sizeof (trashdir), "%s/"GLUSTERD_TRASH,
priv->workdir);