diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-11-14 12:50:01 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-19 03:41:09 -0500 |
commit | ab4fed1445d35230b0ae6467a7d1fc7fdf1dbebc (patch) | |
tree | 8d1f8bde2146db9cace2dd6eebc856908e661bbc | |
parent | 49720aef1da73ec460c11be871d7e0cdd8f535d4 (diff) |
protocol/server: check bound_xl for NULL before dumping ltable
* If bound_xl in the setvolume is NULL, then put the connection
back otherwise it might result in segfault when bound_xl from
that connection object is accessed.
Change-Id: I2805e8b45e5767121f323b0f6fed4084dfc020c0
BUG: 874913
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/1544
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 7 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index 7761f78c474..5f6830a0551 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -664,6 +664,13 @@ fail: rsp.op_ret = op_ret; rsp.op_errno = gf_errno_to_error (op_errno); + /* if bound_xl is NULL or something fails, then put the connection + * back. Otherwise the connection would have been added to the + * list of connections the server is maintaining and might segfault + * during statedump when bound_xl of the connection is accessed. + */ + if (op_ret && conn) + server_connection_put (this, conn, NULL); server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_setvolume_rsp); diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 4f6527fa46e..5e20bf34ea3 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -307,7 +307,7 @@ ltable_dump (server_connection_t *trav) gf_proc_dump_build_key(key, "conn","bound_xl.ltable.inodelk.%s", - trav->bound_xl->name); + trav->bound_xl?trav->bound_xl->name:""); gf_proc_dump_add_section(key); list_for_each_entry (locker, &trav->ltable->inodelk_lockers, lockers) { @@ -341,7 +341,7 @@ ltable_dump (server_connection_t *trav) locker = NULL; gf_proc_dump_build_key(key, "conn","bound_xl.ltable.entrylk.%s", - trav->bound_xl->name); + trav->bound_xl?trav->bound_xl->name:""); gf_proc_dump_add_section(key); list_for_each_entry (locker, &trav->ltable->entrylk_lockers, |