diff options
author | Kotresh HR <khiremat@redhat.com> | 2015-04-24 17:31:03 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-05-04 04:08:26 -0700 |
commit | dc0020c72d5c2d20328b89224b149ebb87002277 (patch) | |
tree | 2eea570ce0e71620710e6217081114a495eefcb3 /xlators | |
parent | 9e6b521cc98b3ba099c1713639be9180be5b031f (diff) |
rpc: Maintain separate xlator pointer in 'rpcsvc_state'
The structure 'rpcsvc_state', which maintains rpc server
state had no separate pointer to track the translator.
It was using the mydata pointer itself. So callers were
forced to send xlator pointer as mydata which is opaque
(void pointer) by function prototype.
'rpcsvc_register_init' is setting svc->mydata with xlator
pointer. 'rpcsvc_register_notify' is overwriting svc->mydata
with mydata pointer. And rpc interprets svc->mydata as
xlator pointer internally. If someone passes non xlator
structure pointer to rpcsvc_register_notify as libgfchangelog
currently does, it might corrupt mydata. So interpreting opaque
mydata as xlator pointer is incorrect as it is caller's choice
to send mydata as any type of data to 'rpcsvc_register_notify'.
Maintaining two different pointers in 'rpcsvc_state' for xlator
and mydata solves the issue.
Change-Id: I7874933fefc68f3fe01d44f92016a8e4e9768378
BUG: 1215161
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/10366
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc-common.c | 4 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc.c | 2 | ||||
-rw-r--r-- | xlators/features/quota/src/quotad-helpers.c | 2 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c index 76db6696ae8..de3a730534e 100644 --- a/xlators/features/changelog/src/changelog-rpc-common.c +++ b/xlators/features/changelog/src/changelog-rpc-common.c @@ -249,8 +249,8 @@ changelog_rpc_server_destroy (xlator_t *this, rpcsvc_t *rpc, char *sockfile, rpcsvc_notify_t fn, struct rpcsvc_program **progs) { rpcsvc_listener_t *listener = NULL; - rpcsvc_listener_t *next = NULL; - struct rpcsvc_program *prog = NULL; + rpcsvc_listener_t *next = NULL; + struct rpcsvc_program *prog = NULL; while (*progs) { prog = *progs; diff --git a/xlators/features/changelog/src/changelog-rpc.c b/xlators/features/changelog/src/changelog-rpc.c index 04326456d31..ffbc61e40f9 100644 --- a/xlators/features/changelog/src/changelog-rpc.c +++ b/xlators/features/changelog/src/changelog-rpc.c @@ -253,7 +253,7 @@ changelog_handle_probe (rpcsvc_request_t *req) /* ->xl hidden in rpcsvc */ svc = rpcsvc_request_service (req); - this = svc->mydata; + this = svc->xl; priv = this->private; c_clnt = &priv->connections; diff --git a/xlators/features/quota/src/quotad-helpers.c b/xlators/features/quota/src/quotad-helpers.c index 9a98ab17a24..70298fc87f5 100644 --- a/xlators/features/quota/src/quotad-helpers.c +++ b/xlators/features/quota/src/quotad-helpers.c @@ -62,7 +62,7 @@ quotad_aggregator_alloc_frame (rpcsvc_request_t *req) GF_VALIDATE_OR_GOTO ("server", req->svc, out); GF_VALIDATE_OR_GOTO ("server", req->svc->ctx, out); - this = req->svc->mydata; + this = req->svc->xl; frame = create_frame (this, req->svc->ctx->pool); if (!frame) diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index ecb80b9aece..556b0e21e7f 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -257,7 +257,7 @@ server_getspec (rpcsvc_request_t *req) gf_getspec_req args = {0,}; gf_getspec_rsp rsp = {0,}; - this = req->svc->mydata; + this = req->svc->xl; conf = this->private; ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gf_getspec_req); @@ -367,7 +367,7 @@ server_setvolume (rpcsvc_request_t *req) goto fail; } - this = req->svc->mydata; + this = req->svc->xl; config_params = dict_copy_with_ref (this->options, NULL); conf = this->private; @@ -741,7 +741,7 @@ server_set_lk_version (rpcsvc_request_t *req) server_ctx_t *serv_ctx = NULL; xlator_t *this = NULL; - this = req->svc->mydata; + this = req->svc->xl; //TODO: Decide on an appropriate errno for the error-path //below if (!this) |