summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-05-16 18:22:35 +0530
committerAnand Avati <avati@redhat.com>2012-05-19 01:29:17 -0700
commit43ff1680d9135bbc85dad24f51f02996d22580df (patch)
treeb82507038ae2dc85f93ac3c29e01e13bd2cd9a08 /xlators
parent43d9661f4ad1566981676d08f6ddf02109ca5757 (diff)
common-utils: Added C wrapper to mkdir(1) -p functionality.
- Modified glusterd-rebalance to use mkdir_p C wrapper. Change-Id: If9a00b8c0e00af644b9c3e64a5fc94cf6201827c Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/3347 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 010ff599cf9..686b9b36db3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -224,7 +224,6 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
runner_t runner = {0,};
glusterd_conf_t *priv = NULL;
char defrag_path[PATH_MAX];
- struct stat buf = {0,};
char sockfile[PATH_MAX] = {0,};
char pidfile[PATH_MAX] = {0,};
char logfile[PATH_MAX] = {0,};
@@ -263,18 +262,11 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
glusterd_store_perform_node_state_store (volinfo);
GLUSTERD_GET_DEFRAG_DIR (defrag_path, volinfo, priv);
- ret = stat (defrag_path, &buf);
- if (ret && (errno == ENOENT)) {
- runinit (&runner);
- runner_add_args (&runner, "mkdir", "-p", defrag_path, NULL);
- ret = runner_run_reuse (&runner);
- if (ret) {
- runner_log (&runner, "glusterd", GF_LOG_DEBUG,
- "command failed");
- runner_end (&runner);
- goto out;
- }
- runner_end (&runner);
+ ret = mkdir_p (defrag_path, 0777, 0, NULL);
+ if (ret) {
+ gf_log (THIS->name, GF_LOG_ERROR, "Failed to create "
+ "directory %s", defrag_path);
+ goto out;
}
GLUSTERD_GET_DEFRAG_SOCK_FILE (sockfile, volinfo, priv);