summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-10-04 13:51:29 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-04 12:52:42 -0700
commit2136876274690bc7377b97ca0ed812a6befafee2 (patch)
treea947b90718b854324c7c66f3bd1571037d119b84 /xlators/mgmt/glusterd/src/glusterd-store.c
parent0d31e7e4239d4765198ea6f46b98ba680038f7ad (diff)
glusterd: more sanity checks during restart
* check for validity of pid file before doing pmap search, as in few cases, pmap_signin() may take more time. * remove stale code from 'init()' * update pmap->last_alloc during restore itself to handle glusterd restarts more agnostics to port collisions Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index ca19057eb46..351f2bf1a2b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -880,6 +880,7 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
char tmpkey[4096] = {0,};
glusterd_store_iter_t *tmpiter = NULL;
char *tmpvalue = NULL;
+ struct pmap_registry *pmap = NULL;
GF_ASSERT (volinfo);
GF_ASSERT (volinfo->volname);
@@ -931,6 +932,11 @@ glusterd_store_retrieve_bricks (glusterd_volinfo_t *volinfo)
} else if (!strncmp (key, GLUSTERD_STORE_KEY_BRICK_PORT,
strlen (GLUSTERD_STORE_KEY_BRICK_PORT))) {
gf_string2int (value, &brickinfo->port);
+ /* 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 {
gf_log ("", GF_LOG_ERROR, "Unknown key: %s",
key);