diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2013-08-21 14:11:38 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-10-31 09:32:50 -0700 |
commit | 3108d4529d57690f58027da61ac5e56a0987ed57 (patch) | |
tree | ed2eb16d54fdc4dcbdfe15eb2bff90597658339a /xlators/protocol/server/src/server-handshake.c | |
parent | c47408e896c9bcaf21e7f8956bdae85633f873e0 (diff) |
client_t: phase 2, refactor server_ctx and locks_ctx out
remove server_ctx and locks_ctx from client_ctx directly and store as
into discrete entities in the scratch_ctx
hooking up dump will be in phase 3
BUG: 849630
Change-Id: I94cea328326db236cdfdf306cb381e4d58f58d4c
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/5678
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src/server-handshake.c')
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index b2d50e106b6..d4941011da9 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -20,7 +20,6 @@ #include "compat-errno.h" #include "glusterfs3.h" #include "authenticate.h" -#include "client_t.h" struct __get_xl_struct { const char *name; @@ -331,6 +330,7 @@ server_setvolume (rpcsvc_request_t *req) gf_setvolume_req args = {{0,},}; gf_setvolume_rsp rsp = {0,}; client_t *client = NULL; + server_ctx_t *serv_ctx = NULL; server_conf_t *conf = NULL; peer_info_t *peerinfo = NULL; dict_t *reply = NULL; @@ -428,13 +428,19 @@ server_setvolume (rpcsvc_request_t *req) goto fail; } - gf_log (this->name, GF_LOG_DEBUG, "Connected to %s", - client->server_ctx.client_uid); + gf_log (this->name, GF_LOG_DEBUG, "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. gf_client_put (client, NULL); - if (client->server_ctx.lk_version != 0 && - client->server_ctx.lk_version != lk_version) { + + serv_ctx = server_ctx_get (client, client->this); + if (serv_ctx == NULL) { + gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed"); + goto fail; + } + + if (serv_ctx->lk_version != 0 && + serv_ctx->lk_version != lk_version) { (void) server_connection_cleanup (this, client, INTERNAL_LOCKS | POSIX_LOCKS); } @@ -565,7 +571,7 @@ server_setvolume (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_INFO, "accepted client from %s (version: %s)", - client->server_ctx.client_uid, + client->client_uid, (clnt_version) ? clnt_version : "old"); op_ret = 0; client->bound_xl = xl; @@ -576,7 +582,7 @@ server_setvolume (rpcsvc_request_t *req) } else { gf_log (this->name, GF_LOG_ERROR, "Cannot authenticate client from %s %s", - client->server_ctx.client_uid, + client->client_uid, (clnt_version) ? clnt_version : "old"); op_ret = -1; @@ -624,8 +630,7 @@ server_setvolume (rpcsvc_request_t *req) gf_log (this->name, GF_LOG_DEBUG, "failed to set 'process-uuid'"); - ret = dict_set_uint32 (reply, "clnt-lk-version", - client->server_ctx.lk_version); + ret = dict_set_uint32 (reply, "clnt-lk-version", serv_ctx->lk_version); if (ret) gf_log (this->name, GF_LOG_WARNING, "failed to set 'clnt-lk-version'"); @@ -717,6 +722,7 @@ server_set_lk_version (rpcsvc_request_t *req) gf_set_lk_ver_req args = {0,}; gf_set_lk_ver_rsp rsp = {0,}; client_t *client = NULL; + server_ctx_t *serv_ctx = NULL; xlator_t *this = NULL; this = req->svc->mydata; @@ -734,7 +740,13 @@ server_set_lk_version (rpcsvc_request_t *req) } client = gf_client_get (this, &req->cred, args.uid); - client->server_ctx.lk_version = args.lk_ver; + serv_ctx = server_ctx_get (client, client->this); + if (serv_ctx == NULL) { + gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed"); + goto fail; + } + + serv_ctx->lk_version = args.lk_ver; gf_client_put (client, NULL); rsp.lk_ver = args.lk_ver; |