|
|
21ab4e |
From d646605b683d18b5c368e86e7ce06da6a896d671 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
Date: Thu, 15 Jun 2017 11:31:39 +0530
|
|
|
21ab4e |
Subject: [PATCH 512/525] glusterd: fix crash on statedump when no volumes are
|
|
|
21ab4e |
started
|
|
|
21ab4e |
|
|
|
21ab4e |
pmap object is created when glusterd allocates a port for the very first
|
|
|
21ab4e |
time, however before that if someone tries to take statedump glusterd
|
|
|
21ab4e |
will crash.
|
|
|
21ab4e |
|
|
|
21ab4e |
Solution : Add a NULL check before accessing pmap reference.
|
|
|
21ab4e |
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/17549
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Reviewed-by: Samikshan Bairagya <samikshan@gmail.com>
|
|
|
21ab4e |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I206b02e07a4717e68af2c6bf05fac55119353de8
|
|
|
21ab4e |
BUG: 1461649
|
|
|
21ab4e |
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/109180
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-statedump.c | 29 +++++++++++++++-----------
|
|
|
21ab4e |
1 file changed, 17 insertions(+), 12 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c
|
|
|
21ab4e |
index 94a39be..1169c58 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-statedump.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c
|
|
|
21ab4e |
@@ -240,18 +240,23 @@ glusterd_dump_priv (xlator_t *this)
|
|
|
21ab4e |
|
|
|
21ab4e |
/* Dump pmap data structure from base port to last alloc */
|
|
|
21ab4e |
pmap = priv->pmap;
|
|
|
21ab4e |
- for (port = pmap->base_port; port <= pmap->last_alloc;
|
|
|
21ab4e |
- port++) {
|
|
|
21ab4e |
- gf_proc_dump_build_key (key, "glusterd", "pmap_port");
|
|
|
21ab4e |
- gf_proc_dump_write (key, "%d", port);
|
|
|
21ab4e |
- gf_proc_dump_build_key (key, "glusterd",
|
|
|
21ab4e |
- "pmap[%d].type", port);
|
|
|
21ab4e |
- gf_proc_dump_write (key, "%d", pmap->ports[port].type);
|
|
|
21ab4e |
- gf_proc_dump_build_key (key, "glusterd",
|
|
|
21ab4e |
- "pmap[%d].brickname", port);
|
|
|
21ab4e |
- gf_proc_dump_write (key, "%s",
|
|
|
21ab4e |
- pmap->ports[port].brickname);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
+ if (pmap) {
|
|
|
21ab4e |
+ for (port = pmap->base_port; port <= pmap->last_alloc;
|
|
|
21ab4e |
+ port++) {
|
|
|
21ab4e |
+ gf_proc_dump_build_key (key, "glusterd",
|
|
|
21ab4e |
+ "pmap_port");
|
|
|
21ab4e |
+ gf_proc_dump_write (key, "%d", port);
|
|
|
21ab4e |
+ gf_proc_dump_build_key (key, "glusterd",
|
|
|
21ab4e |
+ "pmap[%d].type", port);
|
|
|
21ab4e |
+ gf_proc_dump_write (key, "%d",
|
|
|
21ab4e |
+ pmap->ports[port].type);
|
|
|
21ab4e |
+ gf_proc_dump_build_key (key, "glusterd",
|
|
|
21ab4e |
+ "pmap[%d].brickname",
|
|
|
21ab4e |
+ port);
|
|
|
21ab4e |
+ gf_proc_dump_write (key, "%s",
|
|
|
21ab4e |
+ pmap->ports[port].brickname);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
}
|
|
|
21ab4e |
/* Dump client details */
|
|
|
21ab4e |
glusterd_dump_client_details (priv);
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|