glusterd: fix crash on statedump when no volumes are started
pmap object is created when glusterd allocates a port for the very first time, however before that if someone tries to take statedump glusterd will crash. Solution : Add a NULL check before accessing pmap reference. Change-Id: I206b02e07a4717e68af2c6bf05fac55119353de8 BUG: 1461655 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17549 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Samikshan Bairagya <samikshan@gmail.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
This commit is contained in:
parent
b1a6297ec3
commit
cd67c34e64
@ -239,18 +239,23 @@ glusterd_dump_priv (xlator_t *this)
|
||||
|
||||
/* Dump pmap data structure from base port to last alloc */
|
||||
pmap = priv->pmap;
|
||||
for (port = pmap->base_port; port <= pmap->last_alloc;
|
||||
port++) {
|
||||
gf_proc_dump_build_key (key, "glusterd", "pmap_port");
|
||||
gf_proc_dump_write (key, "%d", port);
|
||||
gf_proc_dump_build_key (key, "glusterd",
|
||||
"pmap[%d].type", port);
|
||||
gf_proc_dump_write (key, "%d", pmap->ports[port].type);
|
||||
gf_proc_dump_build_key (key, "glusterd",
|
||||
"pmap[%d].brickname", port);
|
||||
gf_proc_dump_write (key, "%s",
|
||||
pmap->ports[port].brickname);
|
||||
if (pmap) {
|
||||
for (port = pmap->base_port; port <= pmap->last_alloc;
|
||||
port++) {
|
||||
gf_proc_dump_build_key (key, "glusterd",
|
||||
"pmap_port");
|
||||
gf_proc_dump_write (key, "%d", port);
|
||||
gf_proc_dump_build_key (key, "glusterd",
|
||||
"pmap[%d].type", port);
|
||||
gf_proc_dump_write (key, "%d",
|
||||
pmap->ports[port].type);
|
||||
gf_proc_dump_build_key (key, "glusterd",
|
||||
"pmap[%d].brickname",
|
||||
port);
|
||||
gf_proc_dump_write (key, "%s",
|
||||
pmap->ports[port].brickname);
|
||||
|
||||
}
|
||||
}
|
||||
/* Dump client details */
|
||||
glusterd_dump_client_details (priv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user