From c4d7c50a7354ad92e76ea72fccc86e0732e75c49 Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Wed, 30 Dec 2015 16:37:05 +0530 Subject: snapd: Do not persist snapd port Backport of http://review.gluster.org/#/c/13118/ Currently snapd persists the port it uses to sign-in with glusterd, without checking if that particular port is being used by any other process. As a result, it might erroneously sign out any other process using the same port. Hence forcing snapd to ignore the persisted port, and using a new one while coming up. Change-Id: Ibb9ec3762aac445f03d96e85660585be4ab27bcb BUG: 1294797 Signed-off-by: Avra Sengupta Reviewed-on: http://review.gluster.org/13119 Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-snapd-svc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c index 2ec7200d1da..2df94eb92bb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c +++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c @@ -294,18 +294,19 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) "--brick-name", snapd_id, "-S", svc->conn.sockpath, NULL); - snapd_port = volinfo->snapd.port; + + snapd_port = pmap_registry_alloc (THIS); if (!snapd_port) { - snapd_port = pmap_registry_alloc (THIS); - if (!snapd_port) { - snprintf (msg, sizeof (msg), "Could not allocate port " - "for snapd service for volume %s", - volinfo->volname); - runner_log (&runner, this->name, GF_LOG_DEBUG, msg); - ret = -1; - goto out; - } + snprintf (msg, sizeof (msg), "Could not allocate port " + "for snapd service for volume %s", + volinfo->volname); + runner_log (&runner, this->name, GF_LOG_DEBUG, msg); + ret = -1; + goto out; } + + volinfo->snapd.port = snapd_port; + runner_add_arg (&runner, "--brick-port"); runner_argprintf (&runner, "%d", snapd_port); runner_add_arg (&runner, "--xlator-option"); @@ -326,7 +327,6 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags) } synclock_lock (&priv->big_lock); } - volinfo->snapd.port = snapd_port; out: return ret; -- cgit