diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 16 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 |
2 files changed, 11 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index dfb39b3530e..b91937276e3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -74,13 +74,11 @@ pmap_registry_new (void) for (i = 0; i < 65536; i++) { if (!pmap_port_isfree (i)) { pmap->ports[i].used = 1; - pmap->last_alloc = i; } } - pmap->base_port = 6969; - if (pmap->last_alloc < 6969) - pmap->last_alloc = 6969; + pmap->base_port = 6971; /* 6969 default for tcp, 6970 for IB */ + pmap->last_alloc = 6971; return pmap; } @@ -115,7 +113,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->base_port; p <= pmap->last_alloc; p++) { if (!pmap->ports[p].brickname) continue; if (strcmp (pmap->ports[p].brickname, brickname) == 0) { @@ -136,7 +134,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->base_port; p <= pmap->last_alloc; p++) { if (!pmap->ports[p].xprt) continue; if (pmap->ports[p].xprt == xprt) { @@ -177,7 +175,7 @@ pmap_registry_alloc (xlator_t *this) pmap = pmap_registry_get (this); - for (p = pmap->base_port; p < 65535; p++) { + for (p = pmap->last_alloc; p < 65535; p++) { if (pmap->ports[p].used) continue; @@ -188,6 +186,9 @@ pmap_registry_alloc (xlator_t *this) } } + if (port) + pmap->last_alloc = port; + return port; } @@ -253,7 +254,6 @@ remove: gf_log ("pmap", GF_LOG_INFO, "removing brick %s on port %d", pmap->ports[p].brickname, p); - pmap->ports[p].used = 0; if (pmap->ports[p].brickname) free (pmap->ports[p].brickname); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 156e262ab16..0d1d7bf64e8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -786,7 +786,9 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo, goto out; } - port = pmap_registry_alloc (THIS); + port = brickinfo->port; + if (!port) + port = pmap_registry_alloc (THIS); GLUSTERD_GET_BRICK_PIDFILE (pidfile, path, brickinfo->hostname, brickinfo->path); |