summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-04-15 07:00:42 +0000
committerAnand Avati <avati@gluster.com>2011-04-15 23:33:18 -0700
commit2479f442ca8f9e2dd23988e1f2dc20238443a769 (patch)
tree681fe5cc88d9007210b0a08c2b2f0ddb3e588e25 /xlators/mgmt/glusterd
parent49b796949c9a3cc9d5a541503e03589fb7bcbde2 (diff)
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 <pranithk@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2770 (Handle error cases in quota fs crawl) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2770
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index fae19e2265e..578b39363ed 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);