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 --- cli/src/cli-xml-output.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'cli/src') diff --git a/cli/src/cli-xml-output.c b/cli/src/cli-xml-output.c index 609f7847018..d0a72772085 100644 --- a/cli/src/cli-xml-output.c +++ b/cli/src/cli-xml-output.c @@ -2931,7 +2931,8 @@ cli_xml_output_vol_quota_limit_list (char *volname, char *limit_list, gf_log ("cli", GF_LOG_ERROR, "failed to mount glusterfs client"); ret = -1; - goto rm_dir; + rmdir (mountdir); + goto cont; } while (i < len) { @@ -2988,19 +2989,10 @@ cli_xml_output_vol_quota_limit_list (char *volname, char *limit_list, } unmount: - 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 ("cli", mountdir, 1); if (ret) - runner_log (&runner, "cli", GF_LOG_WARNING, "error executing"); - runner_end (&runner); - -rm_dir: - rmdir (mountdir); + gf_log ("cli", GF_LOG_WARNING, "error unmounting %s: %s", + mountdir, strerror (errno)); cont: /* */ -- cgit