From 89de9adbf2b7d446abe9a27c8e384d205a996176 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Fri, 26 Sep 2014 02:28:15 +0200 Subject: 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 Reviewed-on: http://review.gluster.org/8863 Tested-by: Gluster Build System Reviewed-by: Csaba Henk Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 334aef9f412..837e4ec763f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -2003,7 +2003,6 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) int ret = -1; glusterd_brickinfo_t *brickinfo = NULL; char mountdir[PATH_MAX] = {0,}; - runner_t runner = {0,}; char pidfile[PATH_MAX] = {0,}; xlator_t *this = NULL; @@ -2040,19 +2039,11 @@ glusterd_stop_volume (glusterd_volinfo_t *volinfo) GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volinfo->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, 0); if (ret) - gf_log (this->name, GF_LOG_ERROR, "umount on %s failed, " - "reason : %s", mountdir, strerror (errno)); - - runner_end (&runner); + gf_log (this->name, GF_LOG_ERROR, + "umount on %s failed, reason : %s", + mountdir, strerror (errno)); } ret = glusterd_handle_snapd_option (volinfo); @@ -2258,7 +2249,7 @@ glusterd_clearlocks_unmount (glusterd_volinfo_t *volinfo, char *mntpt) * stat() on mount can be due to network failures.*/ runinit (&runner); - runner_add_args (&runner, "/bin/umount", "-f", NULL); + runner_add_args (&runner, _PATH_UMOUNT, "-f", NULL); runner_argprintf (&runner, "%s", mntpt); synclock_unlock (&priv->big_lock); -- cgit