summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-06-16 21:57:40 +0000
committerAnand Avati <avati@gluster.com>2011-06-16 22:02:18 -0700
commit17d3a0fc214c347d9e0a6cc4855302a41a09b535 (patch)
treecf8fdce93838cc7fb9fd69825c6f83cb7de88d0a
parent0101eb0b6444dc22860d8fdc82170aefa87ff0b3 (diff)
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 <junaid@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> 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
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 6abdd822a..def51b101 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);