diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 32 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 25 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 |
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 |