"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/mgmt/glusterd/src/glusterd-locks.c" between
glusterfs-9.2.tar.gz and glusterfs-9.3.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 9.x (latest version).

glusterd-locks.c  (glusterfs-9.2):glusterd-locks.c  (glusterfs-9.3)
skipping to change at line 527 skipping to change at line 527
glusterd_mgmt_v3_lock(const char *name, uuid_t uuid, uint32_t *op_errno, glusterd_mgmt_v3_lock(const char *name, uuid_t uuid, uint32_t *op_errno,
char *type) char *type)
{ {
char key[PATH_MAX] = ""; char key[PATH_MAX] = "";
int32_t ret = -1; int32_t ret = -1;
glusterd_mgmt_v3_lock_obj *lock_obj = NULL; glusterd_mgmt_v3_lock_obj *lock_obj = NULL;
glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL; glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
glusterd_conf_t *priv = NULL; glusterd_conf_t *priv = NULL;
gf_boolean_t is_valid = _gf_true; gf_boolean_t is_valid = _gf_true;
uuid_t owner = {0}; uuid_t owner = {0};
xlator_t *this = NULL; xlator_t *this = THIS;
char *bt = NULL;
struct timespec delay = {0}; struct timespec delay = {0};
char *key_dup = NULL; char *key_dup = NULL;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL; glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL; xlator_t *mgmt_lock_timer_xl = NULL;
this = THIS; this = THIS;
GF_ASSERT(this); GF_ASSERT(this);
priv = this->private; priv = this->private;
GF_ASSERT(priv); GF_ASSERT(priv);
skipping to change at line 645 skipping to change at line 644
ret = dict_set_bin(priv->mgmt_v3_lock_timer, key, mgmt_lock_timer, ret = dict_set_bin(priv->mgmt_v3_lock_timer, key, mgmt_lock_timer,
sizeof(glusterd_mgmt_v3_lock_timer)); sizeof(glusterd_mgmt_v3_lock_timer));
if (ret) { if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED, gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Unable to set timer in mgmt_v3 lock"); "Unable to set timer in mgmt_v3 lock");
GF_FREE(key_dup); GF_FREE(key_dup);
GF_FREE(mgmt_lock_timer); GF_FREE(mgmt_lock_timer);
goto out; goto out;
} }
#ifdef DEBUG
char *bt = NULL;
/* Saving the backtrace into the pre-allocated buffer, ctx->btbuf*/ /* Saving the backtrace into the pre-allocated buffer, ctx->btbuf*/
if ((bt = gf_backtrace_save(NULL))) { if ((bt = gf_backtrace_save(NULL))) {
snprintf(key, sizeof(key), "debug.last-success-bt-%s", key_dup); snprintf(key, sizeof(key), "debug.last-success-bt-%s", key_dup);
ret = dict_set_dynstr_with_alloc(priv->mgmt_v3_lock, key, bt); ret = dict_set_dynstr_with_alloc(priv->mgmt_v3_lock, key, bt);
if (ret) if (ret)
gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_DICT_SET_FAILED, gf_msg(this->name, GF_LOG_WARNING, 0, GD_MSG_DICT_SET_FAILED,
"Failed to save " "Failed to save "
"the back trace for lock %s granted to %s", "the back trace for lock %s granted to %s",
key_dup, uuid_utoa(uuid)); key_dup, uuid_utoa(uuid));
ret = 0; ret = 0;
} }
#endif
gf_msg_debug(this->name, 0, "Lock for %s successfully held by %s", key_dup, gf_msg_debug(this->name, 0, "Lock for %s successfully held by %s", key_dup,
uuid_utoa(uuid)); uuid_utoa(uuid));
ret = 0; ret = 0;
out: out:
gf_msg_trace(this->name, 0, "Returning %d", ret); gf_msg_trace(this->name, 0, "Returning %d", ret);
return ret; return ret;
} }
/* /*
* This call back will ensure to unlock the lock_obj, in case we hit a situation * This call back will ensure to unlock the lock_obj, in case we hit a situation
* where unlocking failed and stale lock exist*/ * where unlocking failed and stale lock exist*/
void void
gd_mgmt_v3_unlock_timer_cbk(void *data) gd_mgmt_v3_unlock_timer_cbk(void *data)
{ {
xlator_t *this = NULL; xlator_t *this = NULL;
glusterd_conf_t *conf = NULL; glusterd_conf_t *conf = NULL;
glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL; glusterd_mgmt_v3_lock_timer *mgmt_lock_timer = NULL;
char *key = NULL; char *key = NULL;
int keylen; int keylen;
char bt_key[PATH_MAX] = "";
int bt_key_len = 0;
int32_t ret = -1; int32_t ret = -1;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL; glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL; xlator_t *mgmt_lock_timer_xl = NULL;
gf_timer_t *timer = NULL; gf_timer_t *timer = NULL;
this = THIS; this = THIS;
GF_VALIDATE_OR_GOTO("glusterd", this, out); GF_VALIDATE_OR_GOTO("glusterd", this, out);
conf = this->private; conf = this->private;
GF_VALIDATE_OR_GOTO(this->name, conf, out); GF_VALIDATE_OR_GOTO(this->name, conf, out);
GF_ASSERT(NULL != data); GF_ASSERT(NULL != data);
key = (char *)data; key = (char *)data;
keylen = strlen(key); keylen = strlen(key);
dict_deln(conf->mgmt_v3_lock, key, keylen); dict_deln(conf->mgmt_v3_lock, key, keylen);
#ifdef DEBUG
char bt_key[PATH_MAX] = "";
int bt_key_len = 0;
bt_key_len = snprintf(bt_key, PATH_MAX, "debug.last-success-bt-%s", key); bt_key_len = snprintf(bt_key, PATH_MAX, "debug.last-success-bt-%s", key);
if (bt_key_len != SLEN("debug.last-success-bt-") + keylen) { if (bt_key_len != SLEN("debug.last-success-bt-") + keylen) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CREATE_KEY_FAIL, gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CREATE_KEY_FAIL,
"Unable to create backtrace " "Unable to create backtrace "
"key"); "key");
goto out; goto out;
} }
dict_deln(conf->mgmt_v3_lock, bt_key, bt_key_len); dict_deln(conf->mgmt_v3_lock, bt_key, bt_key_len);
#endif
ret = dict_get_bin(conf->mgmt_v3_lock_timer, key, ret = dict_get_bin(conf->mgmt_v3_lock_timer, key,
(void **)&mgmt_lock_timer); (void **)&mgmt_lock_timer);
if (ret) { if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED, gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Unable to get lock owner in mgmt_v3 lock"); "Unable to get lock owner in mgmt_v3 lock");
} }
out: out:
if (mgmt_lock_timer && mgmt_lock_timer->timer) { if (mgmt_lock_timer && mgmt_lock_timer->timer) {
mgmt_lock_timer_xl = mgmt_lock_timer->xl; mgmt_lock_timer_xl = mgmt_lock_timer->xl;
GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_xl, ret_function); GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_xl, ret_function);
mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx; mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_ctx, ret_function); GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_ctx, ret_function);
timer = mgmt_lock_timer->timer; timer = mgmt_lock_timer->timer;
GF_FREE(timer->data); GF_FREE(timer->data);
gf_timer_call_cancel(mgmt_lock_timer_ctx, mgmt_lock_timer->timer); gf_timer_call_cancel(mgmt_lock_timer_ctx, mgmt_lock_timer->timer);
#ifdef DEBUG
dict_deln(conf->mgmt_v3_lock_timer, bt_key, bt_key_len); dict_deln(conf->mgmt_v3_lock_timer, bt_key, bt_key_len);
#endif
mgmt_lock_timer->timer = NULL; mgmt_lock_timer->timer = NULL;
gf_log(this->name, GF_LOG_INFO, gf_log(this->name, GF_LOG_INFO,
"unlock timer is cancelled for volume_type" "unlock timer is cancelled for volume_type"
" %s", " %s",
key); key);
} }
ret_function: ret_function:
return; return;
skipping to change at line 824 skipping to change at line 833
ret = dict_get_bin(priv->mgmt_v3_lock_timer, key, ret = dict_get_bin(priv->mgmt_v3_lock_timer, key,
(void **)&mgmt_lock_timer); (void **)&mgmt_lock_timer);
if (ret) { if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED, gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
"Unable to get mgmt lock key in mgmt_v3 lock"); "Unable to get mgmt lock key in mgmt_v3 lock");
goto out; goto out;
} }
(void)snprintf(key_dup, sizeof(key_dup), "%s", key); (void)snprintf(key_dup, sizeof(key_dup), "%s", key);
#ifdef DEBUG
/* Remove the backtrace key as well */ /* Remove the backtrace key as well */
ret = snprintf(key, sizeof(key), "debug.last-success-bt-%s", key_dup); ret = snprintf(key, sizeof(key), "debug.last-success-bt-%s", key_dup);
if (ret != SLEN("debug.last-success-bt-") + keylen) { if (ret != SLEN("debug.last-success-bt-") + keylen) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CREATE_KEY_FAIL, gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_CREATE_KEY_FAIL,
"Unable to create backtrace " "Unable to create backtrace "
"key"); "key");
ret = -1; ret = -1;
goto out; goto out;
} }
dict_deln(priv->mgmt_v3_lock, key, ret); dict_deln(priv->mgmt_v3_lock, key, ret);
#endif
gf_msg_debug(this->name, 0, "Lock for %s %s successfully released", type, gf_msg_debug(this->name, 0, "Lock for %s %s successfully released", type,
name); name);
/* Release owner reference which was held during lock */ /* Release owner reference which was held during lock */
if (mgmt_lock_timer && mgmt_lock_timer->timer) { if (mgmt_lock_timer && mgmt_lock_timer->timer) {
ret = -1; ret = -1;
mgmt_lock_timer_xl = mgmt_lock_timer->xl; mgmt_lock_timer_xl = mgmt_lock_timer->xl;
GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_xl, out); GF_VALIDATE_OR_GOTO(this->name, mgmt_lock_timer_xl, out);
 End of changes. 10 change blocks. 
4 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)