From 2479f442ca8f9e2dd23988e1f2dc20238443a769 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 15 Apr 2011 07:00:42 +0000 Subject: mgmt/glusterd: handle error condition in quota fs crawl Quota enable starts a crawl on the maintenance mount point, but if the chdir to the mount point fails it will start the crawl on '/'. So the child should exit with EXIT_FAILURE when the chdir fails. Signed-off-by: Pranith Kumar K Signed-off-by: Anand Avati BUG: 2770 (Handle error cases in quota fs crawl) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2770 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index fae19e226..578b39363 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -5016,7 +5016,13 @@ glusterd_quota_initiate_fs_crawl (glusterd_conf_t *priv, char *volname) ret = -1; goto err; } else if (pid == 0) {//first child - chdir (mountdir); + ret = chdir (mountdir); + if (ret == -1) { + gf_log ("glusterd", GF_LOG_WARNING, "chdir %s failed, " + "reason: %s", mountdir, strerror (errno)); + exit (EXIT_FAILURE); + } + /* close all fd's */ for (idx = 3; idx < 65536; idx++) { close (idx); -- cgit