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>
This commit is contained in:
parent
748175e35e
commit
ac43be9d9c
@ -1891,24 +1891,24 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
|
|||||||
of shutdown, so give three re-tries */
|
of shutdown, so give three re-tries */
|
||||||
while (retry_count < 3) {
|
while (retry_count < 3) {
|
||||||
retry_count++;
|
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)
|
if (!ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (errno == EBUSY) {
|
gf_log (this->name, GF_LOG_DEBUG, "umount failed for "
|
||||||
gf_log (this->name, GF_LOG_DEBUG, "umount failed for "
|
"path %s (brick: %s): %s. Retry(%d)", mount_pt,
|
||||||
"path %s (brick: %s): %s. Retry(%d)", mount_pt,
|
brickinfo->path, strerror (errno), retry_count);
|
||||||
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;
|
|
||||||
}
|
|
||||||
sleep (1);
|
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;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
runinit (&runner);
|
runinit (&runner);
|
||||||
snprintf (msg, sizeof(msg), "remove snapshot of the brick %s:%s, "
|
snprintf (msg, sizeof(msg), "remove snapshot of the brick %s:%s, "
|
||||||
@ -3686,11 +3686,9 @@ out:
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick"
|
gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick"
|
||||||
" mount %s", snap_brick_mount_path);
|
" mount %s", snap_brick_mount_path);
|
||||||
#if !defined(GF_DARWIN_HOST_OS) && !defined(__NetBSD__)
|
/*umount2 system call doesn't cleanup mtab entry after un-mount.
|
||||||
umount (snap_brick_mount_path);
|
So use external umount command*/
|
||||||
#else
|
glusterd_umount (snap_brick_mount_path);
|
||||||
unmount (snap_brick_mount_path, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
|
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
|
||||||
|
@ -11943,6 +11943,31 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int32_t
|
||||||
glusterd_copy_file (const char *source, const char *destination)
|
glusterd_copy_file (const char *source, const char *destination)
|
||||||
{
|
{
|
||||||
|
@ -747,6 +747,9 @@ gd_restore_snap_volume (dict_t *dict, dict_t *rsp_dict,
|
|||||||
int32_t
|
int32_t
|
||||||
glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path);
|
glusterd_mount_lvm_snapshot (char *device_path, char *brick_mount_path);
|
||||||
|
|
||||||
|
int32_t
|
||||||
|
glusterd_umount (const char *path);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
glusterd_add_snapshots_to_export_dict (dict_t *peer_data);
|
glusterd_add_snapshots_to_export_dict (dict_t *peer_data);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user