diff options
Diffstat (limited to 'xlators/protocol')
-rw-r--r-- | xlators/protocol/auth/addr/src/addr.c | 1 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 34 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 17 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 5 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 4 |
5 files changed, 45 insertions, 16 deletions
diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c index 64e8d0fc6..181d091bd 100644 --- a/xlators/protocol/auth/addr/src/addr.c +++ b/xlators/protocol/auth/addr/src/addr.c @@ -181,6 +181,7 @@ gf_auth (dict_t *input_params, dict_t *config_params) addr_str = strtok_r (NULL, ADDR_DELIMITER, &tmp); } GF_FREE (addr_cpy); + addr_cpy = NULL; } if (allow_addr) { diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index b2aa66422..7c8be42ed 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -465,17 +465,23 @@ client_set_lk_version (xlator_t *this) clnt_conf_t *conf = NULL; call_frame_t *frame = NULL; gf_set_lk_ver_req req = {0, }; + char *process_uuid = NULL; GF_VALIDATE_OR_GOTO ("client", this, err); conf = (clnt_conf_t *) this->private; req.lk_ver = client_get_lk_ver (conf); - ret = gf_asprintf (&req.uid, "%s-%s-%d", - this->ctx->process_uuid, this->name, - this->graph->id); - if (ret == -1) + ret = dict_get_str (this->options, "process-uuid", &process_uuid); + if (!process_uuid) { + ret = -1; goto err; + } + req.uid = gf_strdup (process_uuid); + if (!req.uid) { + ret = -1; + goto err; + } frame = create_frame (this, this->ctx->pool); if (!frame) { @@ -1524,6 +1530,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) char *process_uuid_xl = NULL; clnt_conf_t *conf = NULL; dict_t *options = NULL; + char counter_str[32] = {0}; options = this->options; conf = this->private; @@ -1549,13 +1556,24 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) } } - /* With multiple graphs possible in the same process, we need a + /* When lock-heal is enabled: + * With multiple graphs possible in the same process, we need a field to bring the uniqueness. Graph-ID should be enough to get the - job done + job done. + * When lock-heal is disabled, connection-id should always be unique so + * that server never gets to reuse the previous connection resources + * so it cleans up the resources on every disconnect. Otherwise + * it may lead to stale resources, i.e. leaked file desciptors, + * inode/entry locks */ - ret = gf_asprintf (&process_uuid_xl, "%s-%s-%d", + if (!conf->lk_heal) { + snprintf (counter_str, sizeof (counter_str), + "-%"PRIu64, conf->setvol_count); + conf->setvol_count++; + } + ret = gf_asprintf (&process_uuid_xl, "%s-%s-%d%s", this->ctx->process_uuid, this->name, - this->graph->id); + this->graph->id, counter_str); if (-1 == ret) { gf_log (this->name, GF_LOG_ERROR, "asprintf failed while setting process_uuid"); diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 01590d73a..99a6f6d74 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -3068,13 +3068,13 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->inode)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (args->loc->parent) { if (!uuid_is_null (args->loc->parent->gfid)) @@ -3792,13 +3792,13 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->parent)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3860,13 +3860,13 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->parent)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3927,6 +3927,8 @@ client3_3_create (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->parent)) goto unwind; @@ -3935,7 +3937,6 @@ client3_3_create (call_frame_t *frame, xlator_t *this, loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3998,6 +3999,8 @@ client3_3_open (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->inode)) goto unwind; @@ -4005,7 +4008,6 @@ client3_3_open (call_frame_t *frame, xlator_t *this, local->flags = args->flags; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) memcpy (req.gfid, args->loc->inode->gfid, 16); @@ -4388,13 +4390,14 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->inode)) goto unwind; local->fd = fd_ref (args->fd); loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) memcpy (req.gfid, args->loc->inode->gfid, 16); @@ -5251,6 +5254,7 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, unwind); @@ -5278,7 +5282,6 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, local->owner = frame->root->lk_owner; local->cmd = args->cmd; local->fd = fd_ref (args->fd); - frame->local = local; req.fd = remote_fd; req.cmd = gf_cmd; diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index afab2d74f..bc0f5d0e9 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -120,6 +120,11 @@ typedef struct clnt_conf { */ gf_boolean_t filter_o_direct; /* if set, filter O_DIRECT from the flags list of open() */ + /* set volume is the op which results in creating/re-using + * the conn-id and is called once per connection, this remembers + * how manytimes set_volume is called + */ + uint64_t setvol_count; } clnt_conf_t; typedef struct _client_fd_ctx { diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index c56da30a7..8bdadec6b 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -810,7 +810,9 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { state = CALL_STATE (frame); - gf_log (this->name, ((op_errno == ENOTSUP) ? + gf_log (this->name, (((op_errno == ENOTSUP) || + (op_errno == ENODATA) || + (op_errno == ENOENT)) ? GF_LOG_DEBUG : GF_LOG_INFO), "%"PRId64": FGETXATTR %"PRId64" (%s) (%s) ==> (%s)", frame->root->unique, state->resolve.fd_no, |