diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2014-09-26 02:28:15 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-10-03 08:01:29 -0700 |
commit | 89de9adbf2b7d446abe9a27c8e384d205a996176 (patch) | |
tree | dc5cf55b3bdb7afc3c7895835b8201912ef34f57 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 5ee6a5384ee298314e1ef50c293ad5cbc281c609 (diff) |
Do not hardcode umount(8) path, emulate lazy umount
1) Use a system-dependent macro for umount(8) location instead of
relying on $PATH to find it, for security and portability sake.
2) Introduce gf_umount_lazy() to replace umount -l (-l for lazy) invocations,
which is only supported on Linux; On Linux behavior in unchanged. On other
systems, we fork an external process (umountd) that will take care of
periodically attempt to unmount, and optionally rmdir.
Backport of Ia91167c0652f8ddab85136324b08f87c5ac1edd51d
BUG: 1138897
Change-Id: I9d82c87e85af0dee79f2de39bc697c486b7103c8
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/8863
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Csaba Henk <csaba@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index bee17e50c51..0696725c717 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -11972,7 +11972,6 @@ int glusterd_remove_auxiliary_mount (char *volname) { int ret = -1; - runner_t runner = {0,}; char mountdir[PATH_MAX] = {0,}; char pidfile[PATH_MAX] = {0,}; xlator_t *this = NULL; @@ -11989,20 +11988,11 @@ glusterd_remove_auxiliary_mount (char *volname) } GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/"); - runinit (&runner); - runner_add_args (&runner, "umount", - -#if GF_LINUX_HOST_OS - "-l", -#endif - mountdir, NULL); - ret = runner_run_reuse (&runner); + ret = gf_umount_lazy (this->name, mountdir, 1); if (ret) gf_log (this->name, GF_LOG_ERROR, "umount on %s failed, " "reason : %s", mountdir, strerror (errno)); - runner_end (&runner); - rmdir (mountdir); return ret; } @@ -12127,7 +12117,7 @@ glusterd_umount (const char *path) runinit (&runner); snprintf (msg, sizeof (msg), "umount path %s", path); - runner_add_args (&runner, "umount", "-f", path, NULL); + runner_add_args (&runner, _PATH_UMOUNT, "-f", path, NULL); runner_log (&runner, this->name, GF_LOG_DEBUG, msg); ret = runner_run (&runner); if (ret) |