e7a346
From da38c139d41c839244cd5acc0464ddf06fa51c78 Mon Sep 17 00:00:00 2001
e7a346
From: Sanju Rakonde <srakonde@redhat.com>
e7a346
Date: Wed, 3 Oct 2018 23:58:37 +0530
e7a346
Subject: [PATCH 411/444] glusterd: ensure volinfo->caps is set to correct
e7a346
 value
e7a346
e7a346
With the commit febf5ed4848, during the volume create op,
e7a346
we are setting volinfo->caps to 0, only if any of the bricks
e7a346
belong to the same node and brickinfo->vg[0] is null.
e7a346
Previously, we used to set volinfo->caps to 0, when
e7a346
either brick doesn't belong to the same node or brickinfo->vg[0]
e7a346
is null.
e7a346
e7a346
With this patch, we set volinfo->caps to 0, when either brick
e7a346
doesn't belong to the same node or brickinfo->vg[0] is null.
e7a346
(as we do earlier without commit febf5ed4848).
e7a346
e7a346
> fixes: bz#1635820
e7a346
> Change-Id: I00a97415786b775fb088ac45566ad52b402f1a49
e7a346
> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
e7a346
e7a346
upstream patch: https://review.gluster.org/#/c/glusterfs/+/21336/
e7a346
e7a346
Change-Id: I00a97415786b775fb088ac45566ad52b402f1a49
e7a346
BUG: 1635136
e7a346
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/154909
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 .../bug-1636957-peer-reject-on-glusterd-reboot.t   | 29 ++++++++++++++++++++++
e7a346
 xlators/mgmt/glusterd/src/glusterd-volume-ops.c    |  2 ++
e7a346
 2 files changed, 31 insertions(+)
e7a346
 create mode 100644 tests/bugs/glusterd/bug-1636957-peer-reject-on-glusterd-reboot.t
e7a346
e7a346
diff --git a/tests/bugs/glusterd/bug-1636957-peer-reject-on-glusterd-reboot.t b/tests/bugs/glusterd/bug-1636957-peer-reject-on-glusterd-reboot.t
e7a346
new file mode 100644
e7a346
index 0000000..b462b38
e7a346
--- /dev/null
e7a346
+++ b/tests/bugs/glusterd/bug-1636957-peer-reject-on-glusterd-reboot.t
e7a346
@@ -0,0 +1,29 @@
e7a346
+#!/bin/bash
e7a346
+
e7a346
+. $(dirname $0)/../../include.rc
e7a346
+. $(dirname $0)/../../cluster.rc
e7a346
+. $(dirname $0)/../../volume.rc
e7a346
+
e7a346
+function peer_count {
e7a346
+eval \$CLI_$1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
e7a346
+}
e7a346
+
e7a346
+cleanup
e7a346
+
e7a346
+TEST launch_cluster 2
e7a346
+
e7a346
+TEST $CLI_1 peer probe $H2;
e7a346
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count 1
e7a346
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count 2
e7a346
+
e7a346
+TEST $CLI_1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0
e7a346
+
e7a346
+# rebooting a node which doesn't host bricks for any one volume
e7a346
+# peer should not go into rejected state
e7a346
+TEST kill_glusterd 2
e7a346
+TEST start_glusterd 2
e7a346
+
e7a346
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count 1
e7a346
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count 2
e7a346
+
e7a346
+cleanup
e7a346
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
e7a346
index 36d9bff..87b7acc 100644
e7a346
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
e7a346
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
e7a346
@@ -2485,6 +2485,8 @@ glusterd_op_create_volume (dict_t *dict, char **op_errstr)
e7a346
                                 caps = 0;
e7a346
                         }
e7a346
 #endif
e7a346
+                } else {
e7a346
+                        caps = 0;
e7a346
                 }
e7a346
 
e7a346
                 cds_list_add_tail (&brickinfo->brick_list, &volinfo->bricks);
e7a346
-- 
e7a346
1.8.3.1
e7a346