diff options
author | Milind Changire <mchangir@redhat.com> | 2017-08-31 11:37:32 +0530 |
---|---|---|
committer | jiffin tony Thottan <jthottan@redhat.com> | 2017-09-07 06:49:51 +0000 |
commit | e0335c32de133aafd88b888a0c20f4eb88bb9845 (patch) | |
tree | a53957dfdc8ae2338207ce457a002ec1b516465e /xlators/protocol/server/src/server-handshake.c | |
parent | e6aaeda4c3a44f1c459adbd619ee7c6d0151b254 (diff) |
rpc: destroy transport after client_t
Problem:
1. Ref counting increment on the client_t object is done in
rpcsvc_request_init() which is incorrect.
2. Ref not taken when delegating to grace_time_handler()
Solution:
1. Only fop requests which require processing down the graph via
stack 'frames' now ref count the request in get_frame_from_request()
2. Take ref on client_t object in server_rpc_notify() but avoid
dropping in RPCSVC_EVENT_TRANSPORT_DESRTROY. Drop the ref
unconditionally when exiting out of grace_time_handler().
Also, avoid dropping ref on client_t in
RPCSVC_EVENT_TRANSPORT_DESTROY when ref mangement as been
delegated to grace_time_handler()
mainline:
> BUG: 1481600
> Reported-by: Raghavendra G <rgowdapp@redhat.com>
> Signed-off-by: Milind Changire <mchangir@redhat.com>
> Reviewed-on: https://review.gluster.org/17982
> Tested-by: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
(cherry picked from commit 24b95089a18a6a40e7703cb344e92025d67f3086)
Change-Id: Ic16246bebc7ea4490545b26564658f4b081675e4
BUG: 1487033
Reported-by: Raghavendra G <rgowdapp@redhat.com>
Signed-off-by: Milind Changire <mchangir@redhat.com>
Reviewed-on: https://review.gluster.org/18156
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/protocol/server/src/server-handshake.c')
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index fa2f61315df..731e1c184ef 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -633,9 +633,24 @@ server_setvolume (rpcsvc_request_t *req) gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid); cancelled = server_cancel_grace_timer (this, client); - if (cancelled)//Do gf_client_put on behalf of grace-timer-handler. + if (cancelled) { + /* If timer has been successfully cancelled then it means + * that the client has reconnected within grace period. + * Since we've bumped up the bind count with a gf_client_get() + * for this connect attempt, we need to drop the bind count + * for earlier connect, since grace timer handler couldn't + * drop it since the timer was cancelled. + */ gf_client_put (client, NULL); + /* We need to drop the ref count for this reconnected client + * since one ref was taken before delegating to the grace + * timer handler. Since grace timer handler was cancelled, + * it couldn't run and drop the ref either. + */ + gf_client_unref (client); + } + serv_ctx = server_ctx_get (client, client->this); if (serv_ctx == NULL) { gf_msg (this->name, GF_LOG_INFO, 0, |