From 6b069086cbee39aec9da77b1831e88fe85258b0f Mon Sep 17 00:00:00 2001 From: Sanoj Unnikrishnan Date: Mon, 6 Mar 2017 12:36:02 +0530 Subject: Fixes Stale auxiliary mount when crawler fails to spawn The auxiliary mount created for crawling remains if the crawler was not successfully spawned due to transport disconnect or other such issues. The patch ensures the mount is cleared in those code paths as well. Change-Id: I659fcc1d1956f8e05a37b75ebe3f3a00c24693e8 BUG: 1429330 Signed-off-by: Sanoj Unnikrishnan Reviewed-on: https://review.gluster.org/16853 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Zhou Zhengping Reviewed-by: Manikandan Selvaganesh --- xlators/mgmt/glusterd/src/glusterd-quota.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-quota.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 7ce60236a96..1e62c9dfdeb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -314,6 +314,7 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, if ((pid = fork ()) < 0) { gf_msg (THIS->name, GF_LOG_WARNING, 0, GD_MSG_FORK_FAIL, "fork from parent failed"); + gf_umount_lazy ("glusterd", mountdir, 1); ret = -1; goto out; } else if (pid == 0) {//first child @@ -321,14 +322,19 @@ _glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, * blocking call below */ pid = fork (); - if (pid) - _exit (pid > 0 ? EXIT_SUCCESS : EXIT_FAILURE); + if (pid < 0) { + gf_umount_lazy ("glusterd", mountdir, 1); + _exit (EXIT_FAILURE); + } else if (pid > 0) { + _exit (EXIT_SUCCESS); + } ret = chdir (mountdir); if (ret == -1) { gf_msg (THIS->name, GF_LOG_WARNING, errno, GD_MSG_DIR_OP_FAILED, "chdir %s failed", mountdir); + gf_umount_lazy ("glusterd", mountdir, 1); exit (EXIT_FAILURE); } runinit (&runner); -- cgit