Blob Blame History Raw
From f38ca2aa5a98a0b6ba59384367fc1297e9e148c0 Mon Sep 17 00:00:00 2001
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Date: Sat, 30 Apr 2016 14:02:01 +0530
Subject: [PATCH 114/139] glusterd: fix max pmap alloc to GF_PORT_MAX

This patch also mops the port max i.e. 65535 hard coding

Backport of:
> Backport of:
>> Change-Id: Ia93656d75ceb4c6c4849f9e0ad1b260d5952d4c6
>> BUG: 1331253
>> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
>> Reviewed-on: http://review.gluster.org/14096
>> Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com>
>> Smoke: Gluster Build System <jenkins@build.gluster.com>
>> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
>> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
>> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>

> Change-Id: Idf07dd5d08957aed9287e7df2f3fc6f0f32039c1
> BUG: 1331772
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> Reviewed-on: http://review.gluster.org/14127
> Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>

Change-Id: If2566500d1c6fb5e1bb6ce7aa3a3cc7e035a2688
BUG: 1322306
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/73580
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mgmt/glusterd/src/glusterd-pmap.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index fbdcfc8..d74a565 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -63,7 +63,7 @@ pmap_registry_new (xlator_t *this)
         if (!pmap)
                 return NULL;
 
-        for (i = 0; i < 65536; i++) {
+        for (i = 0; i <= GF_PORT_MAX; i++) {
                 if (pmap_port_isfree (i))
                         pmap->ports[i].type = GF_PMAP_PORT_FREE;
                 else
@@ -166,7 +166,7 @@ pmap_registry_search_by_port (xlator_t *this, int port)
         struct pmap_registry *pmap = NULL;
         char *brickname = NULL;
 
-        if (port > 65535)
+        if (port > GF_PORT_MAX)
                 goto out;
 
         pmap = pmap_registry_get (this);
@@ -188,7 +188,7 @@ pmap_registry_alloc (xlator_t *this)
 
         pmap = pmap_registry_get (this);
 
-        for (p = pmap->last_alloc; p < 65535; p++) {
+        for (p = pmap->last_alloc; p <= GF_PORT_MAX; p++) {
                 if (pmap->ports[p].type != GF_PMAP_PORT_FREE)
                         continue;
 
@@ -214,7 +214,7 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname,
 
         pmap = pmap_registry_get (this);
 
-        if (port > 65535)
+        if (port > GF_PORT_MAX)
                 goto out;
 
         p = port;
@@ -248,7 +248,7 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname,
                 goto out;
 
         if (port) {
-                if (port > 65535)
+                if (port > GF_PORT_MAX)
                         goto out;
 
                 p = port;
-- 
1.7.1