cb8e9e
From ee77fa7ac83f1d5b3b77c032bf97374f34304a64 Mon Sep 17 00:00:00 2001
cb8e9e
From: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Date: Tue, 23 Jun 2015 15:40:32 +0530
cb8e9e
Subject: [PATCH 132/190] glusterd: use mkdir_p for creating rundir
cb8e9e
cb8e9e
snapdsvc initialization is now dependent on all subsequent directories and
cb8e9e
volfile creations.
cb8e9e
cb8e9e
However this may not hold true correct for all the cases. While importing a
cb8e9e
volume we would need to start the service before the store creation.
cb8e9e
cb8e9e
To avoid this dependency, use mkdir_p instead of mkdir to create rundir
cb8e9e
cb8e9e
Change-Id: Ib251043398c40f1b76378e3bc6d0c36c1fe4cca3
cb8e9e
BUG: 1234720
cb8e9e
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
cb8e9e
Reviewed-on: http://review.gluster.org/11364
cb8e9e
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
cb8e9e
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
cb8e9e
Reviewed-by: Kaushal M <kaushal@redhat.com>
cb8e9e
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/51469
cb8e9e
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
cb8e9e
Tested-by: Vijay Bellur <vbellur@redhat.com>
cb8e9e
---
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c |    2 +-
cb8e9e
 xlators/mgmt/glusterd/src/glusterd-utils.c    |   14 +++++++-------
cb8e9e
 2 files changed, 8 insertions(+), 8 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
cb8e9e
index 1a68afb..04096a4 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c
cb8e9e
@@ -23,7 +23,7 @@ glusterd_svc_create_rundir (char *rundir)
cb8e9e
 {
cb8e9e
         int ret      = -1;
cb8e9e
 
cb8e9e
-        ret = mkdir (rundir, 0777);
cb8e9e
+        ret = mkdir_p (rundir, 0777, _gf_true);
cb8e9e
         if ((ret == -1) && (EEXIST != errno)) {
cb8e9e
                 gf_msg (THIS->name, GF_LOG_ERROR, errno,
cb8e9e
                         GD_MSG_CREATE_DIR_FAILED, "Unable to create rundir %s",
cb8e9e
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
index f374f94..ab68f71 100644
cb8e9e
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
cb8e9e
@@ -3802,6 +3802,13 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
cb8e9e
                 (void) glusterd_delete_stale_volume (old_volinfo, new_volinfo);
cb8e9e
         }
cb8e9e
 
cb8e9e
+        ret = glusterd_snapdsvc_init (new_volinfo);
cb8e9e
+        if (ret) {
cb8e9e
+                gf_log (this->name, GF_LOG_ERROR, "Failed to initialize "
cb8e9e
+                        "snapdsvc for volume %s", new_volinfo->volname);
cb8e9e
+                goto out;
cb8e9e
+        }
cb8e9e
+
cb8e9e
         if (glusterd_is_volume_started (new_volinfo)) {
cb8e9e
                 (void) glusterd_start_bricks (new_volinfo);
cb8e9e
                 if (glusterd_is_snapd_enabled (new_volinfo)) {
cb8e9e
@@ -3817,13 +3824,6 @@ glusterd_import_friend_volume (dict_t *peer_data, size_t count)
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        ret = glusterd_snapdsvc_init (new_volinfo);
cb8e9e
-        if (ret) {
cb8e9e
-                gf_log (this->name, GF_LOG_ERROR, "Failed to initialize "
cb8e9e
-                        "snapdsvc for volume %s", new_volinfo->volname);
cb8e9e
-                goto out;
cb8e9e
-        }
cb8e9e
-
cb8e9e
         ret = glusterd_create_volfiles_and_notify_services (new_volinfo);
cb8e9e
         if (ret)
cb8e9e
                 goto out;
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e