From 406aa9809cf7e841f3f5e32fbab0097d4779dca3 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 10 Sep 2018 19:28:12 +0530 Subject: monitoring: create dump dir if it doesn't exist Fixes: bz#1624006 Change-Id: Ie78be72e2492cd02c1376852bb90f1e6661d9bea Signed-off-by: Amar Tumballi --- libglusterfs/src/monitoring.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/monitoring.c b/libglusterfs/src/monitoring.c index 041b70acf7a..316875257cc 100644 --- a/libglusterfs/src/monitoring.c +++ b/libglusterfs/src/monitoring.c @@ -234,6 +234,14 @@ gf_monitor_metrics(glusterfs_ctx_t *ctx) if (dumppath == NULL) { dumppath = GLUSTER_METRICS_DIR; } + ret = mkdir_p(dumppath, 0755, true); + if (ret) { + /* EEXIST is handled in mkdir_p() itself */ + gf_msg("monitoring", GF_LOG_ERROR, 0, LG_MSG_STRDUP_ERROR, + "failed to create metrics dir %s (%s)", filepath, + strerror(errno)); + return NULL; + } ret = gf_asprintf(&filepath, "%s/gmetrics.XXXXXX", dumppath); if (ret < 0) { -- cgit