"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/protocol/client/src/client-lk.c" between
glusterfs-8.4.tar.gz and glusterfs-8.5.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 8.x.

client-lk.c  (glusterfs-8.4):client-lk.c  (glusterfs-8.5)
skipping to change at line 252 skipping to change at line 252
list_for_each_entry_safe(conf, t, &fdctx->lock_list, list) list_for_each_entry_safe(conf, t, &fdctx->lock_list, list)
{ {
if (!locks_overlap(conf, lock)) if (!locks_overlap(conf, lock))
continue; continue;
if (is_same_lkowner(&conf->owner, &lock->owner)) { if (is_same_lkowner(&conf->owner, &lock->owner)) {
if (conf->fl_type == lock->fl_type) { if (conf->fl_type == lock->fl_type) {
sum = add_locks(lock, conf); sum = add_locks(lock, conf);
sum->fd = lock->fd; sum->fd = lock->fd;
sum->owner = conf->owner;
__delete_client_lock(conf); __delete_client_lock(conf);
__destroy_client_lock(conf); __destroy_client_lock(conf);
__destroy_client_lock(lock); __destroy_client_lock(lock);
__insert_and_merge(fdctx, sum); __insert_and_merge(fdctx, sum);
return; return;
} else { } else {
sum = add_locks(lock, conf); sum = add_locks(lock, conf);
skipping to change at line 319 skipping to change at line 320
{ {
__insert_and_merge(fdctx, lock); __insert_and_merge(fdctx, lock);
} }
static void static void
destroy_client_lock(client_posix_lock_t *lock) destroy_client_lock(client_posix_lock_t *lock)
{ {
GF_FREE(lock); GF_FREE(lock);
} }
int32_t void
delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner) destroy_client_locks_from_list(struct list_head *deleted)
{ {
clnt_fd_ctx_t *fdctx = NULL;
client_posix_lock_t *lock = NULL; client_posix_lock_t *lock = NULL;
client_posix_lock_t *tmp = NULL; client_posix_lock_t *tmp = NULL;
xlator_t *this = NULL; xlator_t *this = THIS;
clnt_conf_t *conf = NULL;
struct list_head delete_list;
int ret = 0;
int count = 0; int count = 0;
INIT_LIST_HEAD(&delete_list); list_for_each_entry_safe(lock, tmp, deleted, list)
this = THIS; {
conf = this->private; list_del_init(&lock->list);
destroy_client_lock(lock);
count++;
}
pthread_spin_lock(&conf->fd_lock); /* FIXME: Need to actually print the locks instead of count */
gf_msg_trace(this->name, 0, "Number of locks cleared=%d", count);
}
void
__delete_granted_locks_owner_from_fdctx(clnt_fd_ctx_t *fdctx,
gf_lkowner_t *owner,
struct list_head *deleted)
{
client_posix_lock_t *lock = NULL;
client_posix_lock_t *tmp = NULL;
fdctx = this_fd_get_ctx(fd, this); gf_boolean_t is_null_lkowner = _gf_false;
if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock); if (is_lk_owner_null(owner)) {
is_null_lkowner = _gf_true;
gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
NULL);
ret = -1;
goto out;
} }
list_for_each_entry_safe(lock, tmp, &fdctx->lock_list, list) list_for_each_entry_safe(lock, tmp, &fdctx->lock_list, list)
{ {
if (is_same_lkowner(&lock->owner, owner)) { if (is_null_lkowner || is_same_lkowner(&lock->owner, owner)) {
list_del_init(&lock->list); list_del_init(&lock->list);
list_add_tail(&lock->list, &delete_list); list_add_tail(&lock->list, deleted);
count++;
} }
} }
}
pthread_spin_unlock(&conf->fd_lock); int32_t
delete_granted_locks_owner(fd_t *fd, gf_lkowner_t *owner)
{
clnt_fd_ctx_t *fdctx = NULL;
xlator_t *this = NULL;
clnt_conf_t *conf = NULL;
int ret = 0;
struct list_head deleted_locks;
if (!list_empty(&delete_list)) { this = THIS;
list_for_each_entry_safe(lock, tmp, &delete_list, list) conf = this->private;
{ INIT_LIST_HEAD(&deleted_locks);
list_del_init(&lock->list);
destroy_client_lock(lock); pthread_spin_lock(&conf->fd_lock);
{
fdctx = this_fd_get_ctx(fd, this);
if (!fdctx) {
pthread_spin_unlock(&conf->fd_lock);
gf_smsg(this->name, GF_LOG_WARNING, EINVAL, PC_MSG_FD_CTX_INVALID,
NULL);
ret = -1;
goto out;
} }
__delete_granted_locks_owner_from_fdctx(fdctx, owner, &deleted_locks);
} }
pthread_spin_unlock(&conf->fd_lock);
/* FIXME: Need to actually print the locks instead of count */ destroy_client_locks_from_list(&deleted_locks);
gf_msg_trace(this->name, 0, "Number of locks cleared=%d", count);
out: out:
return ret; return ret;
} }
int32_t int32_t
client_cmd_to_gf_cmd(int32_t cmd, int32_t *gf_cmd) client_cmd_to_gf_cmd(int32_t cmd, int32_t *gf_cmd)
{ {
int ret = 0; int ret = 0;
if (cmd == F_GETLK || cmd == F_GETLK64) if (cmd == F_GETLK || cmd == F_GETLK64)
 End of changes. 15 change blocks. 
32 lines changed or deleted 53 lines changed or added

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