summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2016-04-26 18:40:04 +0530
committerAtin Mukherjee <amukherj@redhat.com>2016-04-27 21:35:27 -0700
commit3af9b53d13a88b93d026d599c9f86f8bb1845b6c (patch)
treed78245639c5502721a1cc78ab7c4a8ef25b6e2d2
parent1890e5e09203e65b1c64f0f13c213d8944b81b87 (diff)
glusterd: try to connect on GF_PMAP_PORT_FOREIGN aswell
This patch fix couple of things mentioned below: 1. previously we use to try to connect on only GF_PMAP_PORT_FREE in the pmap_registry_alloc(), it could happen that some foreign process would have freed the port by this time ?, hence it is worth giving a try on GF_PMAP_PORT_FOREIGN ports as well instead of wasting them all. 2. fix pmap_registry_remove() to mark the port asGF_PMAP_PORT_FREE 3. added useful comments on gf_pmap_port_type enum members Change-Id: Id2aa7ad55e76ae3fdece21bed15792525ae33fe1 BUG: 1322805 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/14080 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>
-rw-r--r--rpc/rpc-lib/src/protocol-common.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/rpc/rpc-lib/src/protocol-common.h b/rpc/rpc-lib/src/protocol-common.h
index e5722731d51..cf98152dc8d 100644
--- a/rpc/rpc-lib/src/protocol-common.h
+++ b/rpc/rpc-lib/src/protocol-common.h
@@ -96,10 +96,10 @@ enum gf_aggregator_procnum {
enum gf_pmap_port_type {
GF_PMAP_PORT_FREE = 0,
- GF_PMAP_PORT_FOREIGN,
+ GF_PMAP_PORT_FOREIGN, /* it actually means, not sure who is using it, but it is in-use */
GF_PMAP_PORT_LEASED,
GF_PMAP_PORT_NONE,
- GF_PMAP_PORT_BRICKSERVER,
+ GF_PMAP_PORT_BRICKSERVER, /* port used by brick process */
};
typedef enum gf_pmap_port_type gf_pmap_port_type_t;
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index cd062483e72..46f0330d9e2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -185,13 +185,15 @@ pmap_registry_alloc (xlator_t *this)
pmap = pmap_registry_get (this);
for (p = pmap->last_alloc; p < 65535; p++) {
- if (pmap->ports[p].type != GF_PMAP_PORT_FREE)
- continue;
+ /* GF_PMAP_PORT_FOREIGN may be freed up ? */
+ if ((pmap->ports[p].type == GF_PMAP_PORT_FREE) ||
+ (pmap->ports[p].type == GF_PMAP_PORT_FOREIGN)) {
- if (pmap_port_isfree (p)) {
- pmap->ports[p].type = GF_PMAP_PORT_LEASED;
- port = p;
- break;
+ if (pmap_port_isfree (p)) {
+ pmap->ports[p].type = GF_PMAP_PORT_LEASED;
+ port = p;
+ break;
+ }
}
}
@@ -271,6 +273,7 @@ remove:
free (pmap->ports[p].brickname);
+ pmap->ports[p].type = GF_PMAP_PORT_FREE;
pmap->ports[p].brickname = NULL;
pmap->ports[p].xprt = NULL;