diff options
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r-- | xlators/protocol/server/src/server-handshake.c | 81 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 44 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.h | 3 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 200 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.h | 5 |
5 files changed, 22 insertions, 311 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index acc1cb6ca75..f6057da3b68 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -465,9 +465,7 @@ server_setvolume (rpcsvc_request_t *req) int32_t ret = -1; int32_t op_ret = -1; int32_t op_errno = EINVAL; - uint32_t lk_version = 0; char *buf = NULL; - gf_boolean_t cancelled = _gf_false; uint32_t opversion = 0; rpc_transport_t *xprt = NULL; int32_t fop_version = 0; @@ -617,20 +615,6 @@ server_setvolume (rpcsvc_request_t *req) client_name = "unknown"; } - /*lk_verion :: [1..2^31-1]*/ - ret = dict_get_uint32 (params, "clnt-lk-version", &lk_version); - if (ret < 0) { - ret = dict_set_str (reply, "ERROR", - "lock state version not supplied"); - if (ret < 0) - gf_msg_debug (this->name, 0, "failed to set error " - "msg"); - - op_ret = -1; - op_errno = EINVAL; - goto fail; - } - client = gf_client_get (this, &req->cred, client_uid, subdir_mount); if (client == NULL) { op_ret = -1; @@ -641,24 +625,6 @@ server_setvolume (rpcsvc_request_t *req) client->client_name = gf_strdup(client_name); gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid); - cancelled = server_cancel_grace_timer (this, client); - 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) { @@ -668,12 +634,6 @@ server_setvolume (rpcsvc_request_t *req) goto fail; } - if (serv_ctx->lk_version != 0 && - serv_ctx->lk_version != lk_version) { - (void) server_connection_cleanup (this, client, - INTERNAL_LOCKS | POSIX_LOCKS); - } - if (req->trans->xl_private != client) req->trans->xl_private = client; @@ -878,12 +838,6 @@ server_setvolume (rpcsvc_request_t *req) if (ret) gf_msg_debug (this->name, 0, "failed to set 'process-uuid'"); - ret = dict_set_uint32 (reply, "clnt-lk-version", serv_ctx->lk_version); - if (ret) - gf_msg (this->name, GF_LOG_WARNING, 0, - PS_MSG_CLIENT_LK_VERSION_ERROR, "failed to set " - "'clnt-lk-version'"); - ret = dict_set_uint64 (reply, "transport-ptr", ((uint64_t) (long) req->trans)); if (ret) @@ -976,47 +930,20 @@ server_ping (rpcsvc_request_t *req) int server_set_lk_version (rpcsvc_request_t *req) { - int op_ret = -1; - int op_errno = EINVAL; + int ret = -1; 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->xl; - //TODO: Decide on an appropriate errno for the error-path - //below - if (!this) - goto fail; - - op_ret = xdr_to_generic (req->msg[0], &args, + ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gf_set_lk_ver_req); - if (op_ret < 0) { - //failed to decode msg; + if (ret < 0) { + /* failed to decode msg */ req->rpc_err = GARBAGE_ARGS; goto fail; } - client = gf_client_get (this, &req->cred, args.uid, NULL); - serv_ctx = server_ctx_get (client, client->this); - if (serv_ctx == NULL) { - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() " - "failed"); - goto fail; - } - - serv_ctx->lk_version = args.lk_ver; rsp.lk_ver = args.lk_ver; - - op_ret = 0; fail: - if (client) - gf_client_put (client, NULL); - - rsp.op_ret = op_ret; - rsp.op_errno = op_errno; server_submit_reply (NULL, req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_set_lk_ver_rsp); diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 7a58d2592ba..31eb2510cf8 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -1277,49 +1277,6 @@ gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict) return 0; } - -gf_boolean_t -server_cancel_grace_timer (xlator_t *this, client_t *client) -{ - server_ctx_t *serv_ctx = NULL; - gf_timer_t *timer = NULL; - gf_boolean_t cancelled = _gf_false; - - if (!this || !client) { - gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY, - "Invalid arguments to cancel connection timer"); - return cancelled; - } - - serv_ctx = server_ctx_get (client, client->this); - - if (serv_ctx == NULL) { - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_SERVER_CTX_GET_FAILED, - "server_ctx_get() failed"); - goto out; - } - - LOCK (&serv_ctx->fdtable_lock); - { - if (serv_ctx->grace_timer) { - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_GRACE_TIMER_CANCELLED, - "Cancelling the grace timer"); - timer = serv_ctx->grace_timer; - serv_ctx->grace_timer = NULL; - } - } - UNLOCK (&serv_ctx->fdtable_lock); - - if (timer) { - gf_timer_call_cancel (this->ctx, timer); - cancelled = _gf_true; - } -out: - return cancelled; -} - server_ctx_t* server_ctx_get (client_t *client, xlator_t *xlator) { @@ -1339,7 +1296,6 @@ server_ctx_get (client_t *client, xlator_t *xlator) if (ctx == NULL) goto out; - /* ctx->lk_version = 0; redundant */ ctx->fdtable = gf_fd_fdtable_alloc (); if (ctx->fdtable == NULL) { diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index 9fe60fd231b..b89105a355f 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -44,9 +44,6 @@ int server_connection_cleanup (xlator_t *this, struct _client *client, int32_t flags); -gf_boolean_t -server_cancel_grace_timer (xlator_t *this, struct _client *client); - int server_build_config (xlator_t *this, server_conf_t *conf); diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index bae4a119b1f..7bd276cdece 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -31,61 +31,6 @@ rpcsvc_cbk_program_t server_cbk_prog = { .progver = GLUSTER_CBK_VERSION, }; -void -grace_time_handler (void *data) -{ - client_t *client = NULL; - xlator_t *this = NULL; - gf_timer_t *timer = NULL; - server_ctx_t *serv_ctx = NULL; - gf_boolean_t cancelled = _gf_false; - gf_boolean_t detached = _gf_false; - - client = data; - this = client->this; - - GF_VALIDATE_OR_GOTO (THIS->name, this, out); - - gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_GRACE_TIMER_EXPD, "grace " - "timer expired for %s", client->client_uid); - - serv_ctx = server_ctx_get (client, this); - - if (serv_ctx == NULL) { - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() " - "failed"); - goto out; - } - - LOCK (&serv_ctx->fdtable_lock); - { - if (serv_ctx->grace_timer) { - timer = serv_ctx->grace_timer; - serv_ctx->grace_timer = NULL; - } - } - UNLOCK (&serv_ctx->fdtable_lock); - if (timer) { - gf_timer_call_cancel (this->ctx, timer); - cancelled = _gf_true; - } - if (cancelled) { - - /* - * ref has already been taken in server_rpc_notify() - */ - gf_client_put (client, &detached); - - if (client && detached) /* reconnection did not happen :-( */ - server_connection_cleanup (this, client, - INTERNAL_LOCKS | POSIX_LOCKS); - gf_client_unref (client); - } -out: - return; -} - struct iobuf * gfs_serialize_reply (rpcsvc_request_t *req, void *arg, struct iovec *outmsg, xdrproc_t xdrproc) @@ -145,7 +90,6 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, server_state_t *state = NULL; char new_iobref = 0; client_t *client = NULL; - gf_boolean_t lk_heal = _gf_false; GF_VALIDATE_OR_GOTO ("server", req, ret); @@ -155,9 +99,6 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, client = frame->root->client; } - if (client) - lk_heal = ((server_conf_t *) client->this->private)->lk_heal; - if (!iobref) { iobref = iobref_new (); if (!iobref) { @@ -193,7 +134,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg, gf_msg_callingfn ("", GF_LOG_ERROR, 0, PS_MSG_REPLY_SUBMIT_FAILED, "Reply submission failed"); - if (frame && client && !lk_heal) { + if (frame && client) { server_connection_cleanup (frame->this, client, INTERNAL_LOCKS | POSIX_LOCKS); } else { @@ -472,8 +413,6 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, rpc_transport_t *trans = NULL; server_conf_t *conf = NULL; client_t *client = NULL; - server_ctx_t *serv_ctx = NULL; - struct timespec grace_ts = {0, }; char *auth_path = NULL; int ret = -1; @@ -542,76 +481,24 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event, auth_path = NULL; } - /* If lock self heal is off, then destroy the - conn object, else register a grace timer event */ - if (!conf->lk_heal) { - gf_client_ref (client); - gf_client_put (client, &detached); - if (client && detached) { - server_connection_cleanup (this, client, - INTERNAL_LOCKS | POSIX_LOCKS); - - gf_event (EVENT_CLIENT_DISCONNECT, - "client_uid=%s;" - "client_identifier=%s;" - "server_identifier=%s;" - "brick_path=%s", - client->client_uid, - trans->peerinfo.identifier, - trans->myinfo.identifier, - auth_path); - } - - /* - * gf_client_unref will be done while handling - * RPC_EVENT_TRANSPORT_DESTROY - */ - goto unref_transport; - } - - serv_ctx = server_ctx_get (client, this); - - if (serv_ctx == NULL) { - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_SERVER_CTX_GET_FAILED, - "server_ctx_get() failed"); - goto unref_transport; - } - - grace_ts.tv_sec = conf->grace_timeout; - grace_ts.tv_nsec = 0; - - LOCK (&serv_ctx->fdtable_lock); - { - if (!serv_ctx->grace_timer) { - - gf_msg (this->name, GF_LOG_INFO, 0, - PS_MSG_GRACE_TIMER_START, - "starting a grace timer for %s", - client->client_uid); - - /* ref to protect against client destruction - * in RPCSVC_EVENT_TRANSPORT_DESTROY while - * we are starting a grace timer - */ - gf_client_ref (client); - - serv_ctx->grace_timer = - gf_timer_call_after (this->ctx, - grace_ts, - grace_time_handler, - client); - } + gf_client_ref (client); + gf_client_put (client, &detached); + if (detached) { + server_connection_cleanup (this, client, + INTERNAL_LOCKS | POSIX_LOCKS); + gf_event (EVENT_CLIENT_DISCONNECT, "client_uid=%s;" + "client_identifier=%s;server_identifier=%s;" + "brick_path=%s", + client->client_uid, + trans->peerinfo.identifier, + trans->myinfo.identifier, + auth_path); } - UNLOCK (&serv_ctx->fdtable_lock); - gf_event (EVENT_CLIENT_DISCONNECT, "client_uid=%s;" - "client_identifier=%s;server_identifier=%s;" - "brick_path=%s", - client->client_uid, - trans->peerinfo.identifier, - trans->myinfo.identifier, - auth_path); + /* + * gf_client_unref will be done while handling + * RPC_EVENT_TRANSPORT_DESTROY + */ unref_transport: /* rpc_transport_unref() causes a RPCSVC_EVENT_TRANSPORT_DESTROY @@ -619,17 +506,13 @@ unref_transport: * So no code should ideally be after this unref */ rpc_transport_unref (trans); - break; - case RPCSVC_EVENT_TRANSPORT_DESTROY: client = trans->xl_private; if (!client) break; - /* unref only for if (!client->lk_heal) */ - if (!conf->lk_heal) - gf_client_unref (client); + gf_client_unref (client); trans->xl_private = NULL; break; @@ -703,33 +586,6 @@ _copy_auth_opt (dict_t *unused, char *key, data_t *value, void *xl_dict) return 0; } - -int -server_init_grace_timer (xlator_t *this, dict_t *options, - server_conf_t *conf) -{ - int32_t ret = -1; - - GF_VALIDATE_OR_GOTO ("server", this, out); - GF_VALIDATE_OR_GOTO (this->name, options, out); - GF_VALIDATE_OR_GOTO (this->name, conf, out); - - GF_OPTION_RECONF ("lk-heal", conf->lk_heal, options, bool, out); - - gf_msg_debug (this->name, 0, "lk-heal = %s", - (conf->lk_heal) ? "on" : "off"); - - GF_OPTION_RECONF ("grace-timeout", conf->grace_timeout, - options, uint32, out); - - gf_msg_debug (this->name, 0, "Server grace timeout value = %d", - conf->grace_timeout); - - ret = 0; -out: - return ret; -} - int server_check_event_threads (xlator_t *this, server_conf_t *conf, int32_t new) { @@ -987,8 +843,6 @@ do_rpc: if (ret) goto out; - ret = server_init_grace_timer (this, options, conf); - out: THIS = oldTHIS; gf_msg_debug ("", 0, "returning %d", ret); @@ -1085,10 +939,6 @@ server_init (xlator_t *this) if (ret) goto out; - ret = server_init_grace_timer (this, this->options, conf); - if (ret) - goto out; - ret = server_build_config (this, conf); if (ret) goto out; @@ -1772,20 +1622,6 @@ struct volume_options server_options[] = { .op_version = {1}, .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC }, - { .key = {"lk-heal"}, - .type = GF_OPTION_TYPE_BOOL, - .default_value = "off", - .op_version = {1}, - .flags = OPT_FLAG_SETTABLE - }, - {.key = {"grace-timeout"}, - .type = GF_OPTION_TYPE_INT, - .min = 10, - .max = 1800, - .default_value = "10", - .op_version = {1}, - .flags = OPT_FLAG_SETTABLE - }, {.key = {"tcp-window-size"}, .type = GF_OPTION_TYPE_SIZET, .min = GF_MIN_SOCKET_WINDOW_SIZE, diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h index fe407689ceb..393219bf290 100644 --- a/xlators/protocol/server/src/server.h +++ b/xlators/protocol/server/src/server.h @@ -107,11 +107,8 @@ struct server_conf { int inode_lru_limit; gf_boolean_t verify_volfile; gf_boolean_t trace; - gf_boolean_t lk_heal; /* If true means lock self - heal is on else off. */ char *conf_dir; struct _volfile_ctx *volfile; - uint32_t grace_timeout; dict_t *auth_modules; pthread_mutex_t mutex; struct list_head xprt_list; @@ -244,8 +241,6 @@ extern struct rpcsvc_program glusterfs4_0_fop_prog; typedef struct _server_ctx { gf_lock_t fdtable_lock; fdtable_t *fdtable; - struct _gf_timer *grace_timer; - uint32_t lk_version; } server_ctx_t; |