21ab4e
From e1da9e393dfe1276ef6e0dd701643a7d4c8c7844 Mon Sep 17 00:00:00 2001
3604df
From: Kotresh HR <khiremat@redhat.com>
3604df
Date: Thu, 20 Apr 2017 07:18:52 -0400
21ab4e
Subject: [PATCH 406/406] glusterd/geo-rep: Fix snapshot create in geo-rep
3604df
 setup
3604df
3604df
glusterd persists geo-rep sessions in glusterd
3604df
info file which is represented by dictionary
3604df
'volinfo->gsync_slaves' in memory. Glusterd also
3604df
maintains in memory active geo-rep sessions in
3604df
dictionary 'volinfo->gsync_active_slaves' whose key
3604df
is "<slave_url>::<slavhost>".
3604df
3604df
When glusterd is restarted while the geo-rep sessions
3604df
are active, it builds the 'volinfo->gsync_active_slaves'
3604df
from persisted glusterd info file. Since slave volume
3604df
uuid is added to "voinfo->gsync_slaves" with the commit
3604df
"http://review.gluster.org/13111", it builds it with key
3604df
"<slave_url>::<slavehost>:<slavevol_uuid>" which is
3604df
wrong. So during snapshot pre-validation which checks
3604df
whether geo-rep is active or not, it always says it is
3604df
ACTIVE, as geo-rep stop would not deleted this key.
3604df
Fixed the same in this patch.
3604df
3604df
> BUG: 1443977
3604df
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
3604df
> Reviewed-on: https://review.gluster.org/17093
3604df
> Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
3604df
Change-Id: I185178910b4b8a62e66aba406d88d12fabc5c122
21ab4e
BUG: 1416024
3604df
Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/104414
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/mgmt/glusterd/src/glusterd-utils.c | 7 +++----
3604df
 1 file changed, 3 insertions(+), 4 deletions(-)
3604df
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
index e9a5183..19b6dcc 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
21ab4e
@@ -5530,7 +5530,7 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
3604df
         glusterd_conf_t    *priv                        = NULL;
3604df
         gf_boolean_t        is_template_in_use          = _gf_false;
3604df
         gf_boolean_t        is_paused                   = _gf_false;
3604df
-        char               *key1                        = NULL;
3604df
+        char                key1[1024]                  = {0,};
3604df
         xlator_t           *this1                       = NULL;
3604df
 
3604df
         this1 = THIS;
21ab4e
@@ -5625,9 +5625,8 @@ _local_gsyncd_start (dict_t *this, char *key, data_t *value, void *data)
3604df
                 goto out;
3604df
         }
3604df
 
3604df
-        /* Move the pointer two characters ahead to surpass '//' */
3604df
-        if ((key1 = strchr (slave, '/')))
3604df
-                key1 = key1 + 2;
3604df
+        /* Form key1 which is "<user@><slave_host>::<slavevol>" */
3604df
+        snprintf (key1, sizeof (key1), "%s::%s", slave_url, slave_vol);
3604df
 
3604df
         /* Looks for the last status, to find if the session was running
3604df
          * when the node went down. If the session was just created or
3604df
-- 
3604df
1.8.3.1
3604df