summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-29 07:08:37 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-29 11:37:26 -0700
commitfb3cb751f18a931d2a61d168fa13bf8ec3b45e1a (patch)
tree24cb373f99771e9a3323469ae7c6432993f7d152 /xlators/mgmt/glusterd
parent127dd2ada6e06abf0761ea647f7ae18a5de78e4f (diff)
mgmt/glusterd: handle port allocation so ports are reused for same brickv3.1.0qa11
* if 'brickinfo->port' exists use it instead of pmap_registry_alloc(), hence a brick after stop/start starts on same port Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1473 (reuse the ports while starting 'glusterfsd') URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1473
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c16
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c4
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);