summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-05-20 12:25:47 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-05-29 23:58:45 -0700
commitac43be9d9c1925a5fddf21ba2061f414e53140a8 (patch)
tree17c1fa8b493bafc9922e987eb437ef5d270435e4 /xlators/mgmt
parent748175e35e9d2d2506a875bafd6b63889512b7e5 (diff)
glusterd/snapshot: Use external umount for un-mounting snapshot
umount2 doesn't cleanup /etc/mtab entry after doing umount, so use external umount command for un-mount operation. Change-Id: I1a91a700433e2bf15dd21e6fcdd9da54441048d1 BUG: 1098084 Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/7775 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c32
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c25
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h3
3 files changed, 43 insertions, 17 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index 522525f5a0d..58e423aab1c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -1891,24 +1891,24 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
of shutdown, so give three re-tries */
while (retry_count < 3) {
retry_count++;
- ret = umount2(mount_pt, MNT_FORCE);
+ /*umount2 system call doesn't cleanup mtab entry after un-mount.
+ So use external umount command*/
+ ret = glusterd_umount(mount_pt);
if (!ret)
break;
- if (errno == EBUSY) {
- gf_log (this->name, GF_LOG_DEBUG, "umount failed for "
- "path %s (brick: %s): %s. Retry(%d)", mount_pt,
- brickinfo->path, strerror (errno), retry_count);
- } else {
- gf_log (this->name, GF_LOG_ERROR, "umount failed for "
- "path %s (brick: %s): %s.", mount_pt,
- brickinfo->path, strerror (errno));
- goto out;
- }
+ gf_log (this->name, GF_LOG_DEBUG, "umount failed for "
+ "path %s (brick: %s): %s. Retry(%d)", mount_pt,
+ brickinfo->path, strerror (errno), retry_count);
+
sleep (1);
}
- if (ret)
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "umount failed for "
+ "path %s (brick: %s): %s.", mount_pt,
+ brickinfo->path, strerror (errno));
goto out;
+ }
runinit (&runner);
snprintf (msg, sizeof(msg), "remove snapshot of the brick %s:%s, "
@@ -3686,11 +3686,9 @@ out:
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick"
" mount %s", snap_brick_mount_path);
-#if !defined(GF_DARWIN_HOST_OS) && !defined(__NetBSD__)
- umount (snap_brick_mount_path);
-#else
- unmount (snap_brick_mount_path, 0);
-#endif
+ /*umount2 system call doesn't cleanup mtab entry after un-mount.
+ So use external umount command*/
+ glusterd_umount (snap_brick_mount_path);
}
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 618e8d1dbe0..ced41fb3a55 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -11944,6 +11944,31 @@ out:
}
int32_t
+glusterd_umount (const char *path)
+{
+ char msg[NAME_MAX] = "";
+ int32_t ret = -1;
+ runner_t runner = {0, };
+ xlator_t *this = NULL;
+
+ this = THIS;
+ GF_ASSERT (this);
+ GF_ASSERT (path);
+
+ runinit (&runner);
+ snprintf (msg, sizeof (msg), "umount path %s", path);
+ runner_add_args (&runner, "umount", "-f", path, NULL);
+ runner_log (&runner, this->name, GF_LOG_DEBUG, msg);
+ ret = runner_run (&runner);
+ if (ret)
+ gf_log (this->name, GF_LOG_ERROR, "umounting %s failed (%s)",
+ path, strerror (errno));
+
+ gf_log (this->name, GF_LOG_TRACE, "Returning with %d", ret);
+ return ret;
+}
+
+int32_t
glusterd_copy_file (const char *source, const char *destination)
{
int32_t ret = -1;
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index eed2682b5db..91a4c3c2418 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -748,6 +748,9 @@ int32_t
glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path);
int32_t
+glusterd_umount (const char *path);
+
+int32_t
glusterd_add_snapshots_to_export_dict (dict_t *peer_data);
int32_t