From 473c34f895c49bf2bd327ece586d3613cd86c068 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Sun, 21 Sep 2014 13:57:47 +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. BUG: 1129939 Change-Id: Ia91167c0652f8ddab85136324b08f87c5ac1e51d Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/8649 Tested-by: Gluster Build System Reviewed-by: Csaba Henk Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-handler.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 9ee26b52160..d97cc4bdf32 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -2824,12 +2824,16 @@ __glusterd_handle_umount (rpcsvc_request_t *req) goto out; } - runinit (&runner); - runner_add_args (&runner, "umount", umnt_req.path, NULL); - if (umnt_req.lazy) - runner_add_arg (&runner, "-l"); synclock_unlock (&priv->big_lock); - rsp.op_ret = runner_run (&runner); + + if (umnt_req.lazy) { + rsp.op_ret = gf_umount_lazy (this->name, umnt_req.path, 0); + } else { + runinit (&runner); + runner_add_args (&runner, _PATH_UMOUNT, umnt_req.path, NULL); + rsp.op_ret = runner_run (&runner); + } + synclock_lock (&priv->big_lock); if (rsp.op_ret == 0) { if (realpath (umnt_req.path, mntp)) -- cgit