From 34899d71f21fd2b4c523b68ffb2d7c655c776641 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Thu, 31 Mar 2016 11:01:53 +0530 Subject: glusterd: Allocate fresh port on brick (re)start There is no point of using the same port through the entire volume life cycle for a particular bricks process since there is no guarantee that the same port would be free and no other application wouldn't consume it in between the glusterd/volume restart. We hit a race where on glusterd restart the daemon services start followed by brick processes and the time brick process tries to bind with the port which was allocated by glusterd before a restart is been already consumed by some other client like NFS/SHD/... Note : This is a short term solution as here we reduce the race window but don't eliminate it completely. As a long term solution the port allocation has to be done by glusterfsd and the same should be communicated back to glusterd for book keeping Change-Id: Ibbd1e7ca87e51a7cd9cf216b1fe58ef7783aef24 BUG: 1322805 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/13865 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/mgmt/glusterd/src/glusterd-store.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index b1f943074f3..97f5147dd39 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -2313,13 +2313,6 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo) /* This is required to adhere to the IANA standards */ brickinfo->port = 0; - } else { - /* This is required to have proper ports - assigned to bricks after restart */ - pmap = pmap_registry_get (THIS); - if (pmap->last_alloc <= brickinfo->port) - pmap->last_alloc = - brickinfo->port + 1; } } else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_RDMA_PORT, strlen (GLUSTERD_STORE_KEY_BRICK_RDMA_PORT))) { @@ -2329,16 +2322,7 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo) /* This is required to adhere to the IANA standards */ brickinfo->rdma_port = 0; - } else { - /* This is required to have proper ports - assigned to bricks after restart */ - pmap = pmap_registry_get (THIS); - if (pmap->last_alloc <= - brickinfo->rdma_port) - pmap->last_alloc = - brickinfo->rdma_port +1; } - } else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED, strlen (GLUSTERD_STORE_KEY_BRICK_DECOMMISSIONED))) { gf_string2int (value, &brickinfo->decommissioned); -- cgit