diff options
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 15 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 84f99ad8945..702856da216 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -177,10 +177,6 @@ server_resolve_wipe (server_resolve_t *resolve) void free_state (server_state_t *state) { - if (state->xprt) { - rpc_transport_unref (state->xprt); - state->xprt = NULL; - } if (state->fd) { fd_unref (state->fd); state->fd = NULL; @@ -223,6 +219,17 @@ free_state (server_state_t *state) compound_args_cleanup (state->args); + /* Call rpc_trnasport_unref to avoid crashes at last after free + all resources because of server_rpc_notify (for transport destroy) + call's xlator_mem_cleanup if all xprt are destroyed that internally + call's inode_table_destroy. + */ + if (state->xprt) { + rpc_transport_unref (state->xprt); + state->xprt = NULL; + } + + GF_FREE (state); } diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 294b0de34e4..80ea3e68fbb 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -150,9 +150,6 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, ret = 0; ret: - if (state) - free_state (state); - if (client) gf_client_unref (client); @@ -162,6 +159,9 @@ ret: if (new_iobref) iobref_unref (iobref); + if (state) + free_state (state); + return ret; } |