summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-pmap.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2016-05-09 12:14:37 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-07-07 06:51:28 -0700
commitf4044fa4ff75389de0cf17008179d55ac0a15b33 (patch)
tree01745b227f87c2048c235027997bddf5949606ae /xlators/mgmt/glusterd/src/glusterd-pmap.c
parent244decb1cc6091d441a58bcc5f9f7f85291a2f09 (diff)
glusterd: search port from last_alloc to base_port
Backport of http://review.gluster.org/14268 If a brick process is killed ungracefully then GlusterD wouldn't receive a PMAP_SIGNOUT event and hence the stale port details wouldn't be removed out. Now consider the following case: 1. Create a volume with 1 birck 2. Start the volume (say brick port allocated is 49152) 3. Kill the brick process by 'kill -9' 4. Stop & delete the volume 5. Recreate the volume and start it. (Now the brick port gets 49153) 6. Mount the volume Now in step 6 mount will fail as GlusterD will provide back the stale port number given the query starts searching from the base_port. Solution: To avoid this, searching for port from last_alloc and coming down to base_port should solve the issue. >Change-Id: I9afafd722a7fda0caac4cc892605f4e7c0e48e73 >BUG: 1334270 >Signed-off-by: Atin Mukherjee <amukherj@redhat.com> >Reviewed-on: http://review.gluster.org/14268 >Smoke: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Change-Id: I9afafd722a7fda0caac4cc892605f4e7c0e48e73 BUG: 1353426 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: http://review.gluster.org/14867 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kaushal M <kaushal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-pmap.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 192a1d95258..6a89a4fe6e3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -115,7 +115,7 @@ pmap_registry_search (xlator_t *this, const char *brickname,
pmap = pmap_registry_get (this);
- for (p = pmap->base_port; p <= pmap->last_alloc; p++) {
+ for (p = pmap->last_alloc; p >= pmap->base_port; p--) {
if (!pmap->ports[p].brickname || pmap->ports[p].type != type)
continue;
@@ -142,7 +142,7 @@ pmap_registry_search_by_xprt (xlator_t *this, void *xprt,
pmap = pmap_registry_get (this);
- for (p = pmap->base_port; p <= pmap->last_alloc; p++) {
+ for (p = pmap->last_alloc; p >= pmap->base_port; p--) {
if (!pmap->ports[p].xprt)
continue;
if (pmap->ports[p].xprt == xprt &&