From 17d3a0fc214c347d9e0a6cc4855302a41a09b535 Mon Sep 17 00:00:00 2001 From: Junaid Date: Thu, 16 Jun 2011 21:57:40 +0000 Subject: mgmt/glusterd: chdir into mount in second child process while crawling the fs in quota enable. Because the management mount is waiting for glusterd's response and glusterd is doing waitpid on the child which is trying to do chdir into mount, thus causing a deadlock situation. Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 2560 (Lazy umount should be done for the maintainance mode mountpoint) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2560 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 6abdd822a69..def51b101ba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -4926,26 +4926,24 @@ glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, char *volname) ret = -1; goto out; } else if (pid == 0) {//first child - ret = chdir (mountdir); - if (ret == -1) { - gf_log ("glusterd", GF_LOG_WARNING, "chdir %s failed, " - "reason: %s", mountdir, strerror (errno)); - exit (EXIT_FAILURE); - } - -#ifndef GF_LINUX_HOST_OS /* fork one more to not hold back main process on * blocking call below */ pid = fork (); if (pid) _exit (pid > 0 ? EXIT_SUCCESS : EXIT_FAILURE); -#endif + ret = chdir (mountdir); + if (ret == -1) { + gf_log ("glusterd", GF_LOG_WARNING, "chdir %s failed, " + "reason: %s", mountdir, strerror (errno)); + exit (EXIT_FAILURE); + } runinit (&runner); runner_add_args (&runner, "/usr/bin/find", "find", ".", NULL); if (runner_start (&runner) == -1) _exit (EXIT_FAILURE); + #ifndef GF_LINUX_HOST_OS runner_end (&runner); /* blocks in waitpid */ runcmd ("umount", mountdir, NULL); -- cgit