summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorSamikshan Bairagya <samikshan@gmail.com>2017-02-20 18:35:01 +0530
committerJeff Darcy <jdarcy@redhat.com>2017-02-27 17:59:03 -0500
commit1e3538baab7abc29ac329c78182b62558da56d98 (patch)
tree755f457ce06f6291ed26fcbfec974b572c46bfd9 /xlators
parentdbdfe6c353060b7af7b4250c8d6c30ed0c35783c (diff)
core: Clean up pmap registry up correctly on volume/brick stop
This commit changes the following: 1. In glusterfs_handle_terminate, send out individual pmap signout requests to glusterd for every brick. 2. Add another parameter to glusterfs_mgmt_pmap_signout function to pass the brickname that needs to be removed from the pmap registry. 3. Make sure pmap_registry_search doesn't break out from the loop iterating over the list of bricks per port if the first brick entry corresponding to a port is whitespaced out. 4. Make sure the pmap registry entries are removed for other daemons like snapd. Change-Id: I69949874435b02699e5708dab811777ccb297174 BUG: 1421590 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/16689 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Gaurav Yadav <gyadav@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 2e87ff6ecdf..9b2954af64d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -119,9 +119,9 @@ pmap_registry_search (xlator_t *this, const char *brickname,
for (;;) {
for (i = 0; brck[i] && !isspace (brck[i]); ++i)
;
- if (!i) {
+ if (i == 0 && brck[i] == '\0')
break;
- }
+
if (strncmp (brck, brickname, i) == 0) {
/*
* Without this check, we'd break when brck
@@ -134,7 +134,9 @@ pmap_registry_search (xlator_t *this, const char *brickname,
return p;
}
}
+
brck += i;
+
/*
* Skip over *any* amount of whitespace, including
* none (if we're already at the end of the string).
@@ -260,7 +262,6 @@ pmap_registry_bind (xlator_t *this, int port, const char *brickname,
goto out;
p = port;
- pmap->ports[p].type = type;
if (pmap->ports[p].brickname) {
char *tmp = pmap->ports[p].brickname;
asprintf (&pmap->ports[p].brickname, "%s %s", tmp, brickname);
@@ -356,10 +357,9 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname,
goto out;
p = port;
- goto remove;
}
- if (brickname && strchr (brickname, '/')) {
+ if (brickname) {
p = pmap_registry_search (this, brickname, type, _gf_true);
if (p)
goto remove;
@@ -373,9 +373,8 @@ pmap_registry_remove (xlator_t *this, int port, const char *brickname,
goto out;
remove:
- gf_msg ("pmap", GF_LOG_INFO, 0,
- GD_MSG_BRICK_REMOVE, "removing brick %s on port %d",
- pmap->ports[p].brickname, p);
+ gf_msg ("pmap", GF_LOG_INFO, 0, GD_MSG_BRICK_REMOVE,
+ "removing brick %s on port %d", brickname, p);
if (xprt && (xprt == pmap->ports[p].xprt)) {
pmap->ports[p].xprt = NULL;