From dc6178714cd84d3de894d0972c20950b59d30017 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Sun, 1 May 2016 13:53:47 +0530 Subject: 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 Backport of: > Change-Id: Id2aa7ad55e76ae3fdece21bed15792525ae33fe1 > BUG: 1322805 > Signed-off-by: Prasanna Kumar Kalever > Reviewed-on: http://review.gluster.org/14080 > Tested-by: Prasanna Kumar Kalever > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Atin Mukherjee Change-Id: Ib7852aa1c55611e81c78341aace4d374d516f439 BUG: 1323564 Signed-off-by: Prasanna Kumar Kalever Reviewed-on: http://review.gluster.org/14117 Tested-by: Prasanna Kumar Kalever Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-pmap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index d74a565def4..ea35c57ac32 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -189,13 +189,15 @@ pmap_registry_alloc (xlator_t *this) pmap = pmap_registry_get (this); for (p = pmap->last_alloc; p <= GF_PORT_MAX; 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; + } } } @@ -275,6 +277,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; -- cgit