summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2012-01-17 05:28:51 +0530
committerAnand Avati <avati@gluster.com>2012-01-24 20:14:17 -0800
commitb02afc6d008f9959db28244eb2b9dd3b9ef92393 (patch)
treec0bad790fb34f8ab2747b480d334cf9af75c5514 /xlators/protocol/server/src/server-helpers.c
parent0694749c3e5039be327110a64dd66619b5d9121c (diff)
core: change lk-owner as a 1k buffer
so, NLM can send the lk-owner field directly to the locks translators, while doing the same effort, also enabled sending maximum of 500 aux gid over protocol. Change-Id: I87c2514392748416f7ffe21d5154faad2e413969 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 767229 Reviewed-on: http://review.gluster.com/779 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r--xlators/protocol/server/src/server-helpers.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index f259a651fe1..43f60e0e2e4 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -39,7 +39,7 @@ server_decode_groups (call_frame_t *frame, rpcsvc_request_t *req)
if (frame->root->ngrps == 0)
return 0;
- if (frame->root->ngrps > GF_REQUEST_MAXGROUPS)
+ if (frame->root->ngrps > GF_MAX_AUX_GROUPS)
return -1;
for (; i < frame->root->ngrps; ++i)
@@ -134,7 +134,7 @@ free_state (server_state_t *state)
int
gf_add_locker (struct _lock_table *table, const char *volume,
- loc_t *loc, fd_t *fd, pid_t pid, uint64_t owner,
+ loc_t *loc, fd_t *fd, pid_t pid, gf_lkowner_t *owner,
glusterfs_fop_t type)
{
int32_t ret = -1;
@@ -158,7 +158,7 @@ gf_add_locker (struct _lock_table *table, const char *volume,
}
new->pid = pid;
- new->owner = owner;
+ new->owner = *owner;
LOCK (&table->lock);
{
@@ -175,7 +175,8 @@ out:
int
gf_del_locker (struct _lock_table *table, const char *volume,
- loc_t *loc, fd_t *fd, uint64_t owner, glusterfs_fop_t type)
+ loc_t *loc, fd_t *fd, gf_lkowner_t *owner,
+ glusterfs_fop_t type)
{
struct _locker *locker = NULL;
struct _locker *tmp = NULL;
@@ -197,17 +198,15 @@ gf_del_locker (struct _lock_table *table, const char *volume,
}
list_for_each_entry_safe (locker, tmp, head, lockers) {
- if (locker->fd && fd &&
- (locker->fd == fd) && (locker->owner == owner)
- && !strcmp (locker->volume, volume)) {
+ if (!is_same_lkowner (&locker->owner, owner) ||
+ strcmp (locker->volume, volume))
+ continue;
+
+ if (locker->fd && fd && (locker->fd == fd))
list_move_tail (&locker->lockers, &del);
- } else if (locker->loc.inode &&
- loc &&
- (locker->loc.inode == loc->inode) &&
- (locker->owner == owner)
- && !strcmp (locker->volume, volume)) {
+ else if (locker->loc.inode && loc &&
+ (locker->loc.inode == loc->inode))
list_move_tail (&locker->lockers, &del);
- }
}
}
UNLOCK (&table->lock);
@@ -314,9 +313,9 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn,
lock owner = 0 is a special case that tells posix-locks
to release all locks from this transport
*/
- tmp_frame->root->pid = 0;
- tmp_frame->root->lk_owner = 0;
- tmp_frame->root->trans = conn;
+ tmp_frame->root->pid = 0;
+ tmp_frame->root->trans = conn;
+ memset (&tmp_frame->root->lk_owner, 0, sizeof (gf_lkowner_t));
if (locker->fd) {
GF_ASSERT (locker->fd->inode);
@@ -361,9 +360,9 @@ do_lock_table_cleanup (xlator_t *this, server_connection_t *conn,
list_for_each_entry_safe (locker, tmp, &entrylk_lockers, lockers) {
tmp_frame = copy_frame (frame);
- tmp_frame->root->lk_owner = 0;
- tmp_frame->root->pid = 0;
- tmp_frame->root->trans = conn;
+ tmp_frame->root->pid = 0;
+ tmp_frame->root->trans = conn;
+ memset (&tmp_frame->root->lk_owner, 0, sizeof (gf_lkowner_t));
if (locker->fd) {
GF_ASSERT (locker->fd->inode);
@@ -480,7 +479,9 @@ do_fd_cleanup (xlator_t *this, server_connection_t *conn, call_frame_t *frame,
tmp_frame->root->pid = 0;
tmp_frame->root->trans = conn;
- tmp_frame->root->lk_owner = 0;
+ memset (&tmp_frame->root->lk_owner, 0,
+ sizeof (gf_lkowner_t));
+
STACK_WIND (tmp_frame,
server_connection_cleanup_flush_cbk,
bound_xl, bound_xl->fops->flush, fd);
@@ -630,8 +631,9 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
lock_owner = 0 is a special case that tells posix-locks
to release all locks from this transport
*/
- tmp_frame->root->lk_owner = 0;
tmp_frame->root->trans = conn;
+ memset (&tmp_frame->root->lk_owner, 0,
+ sizeof (gf_lkowner_t));
if (locker->fd) {
GF_ASSERT (locker->fd->inode);
@@ -676,8 +678,9 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
list_for_each_entry_safe (locker, tmp, &entrylk_lockers, lockers) {
tmp_frame = copy_frame (frame);
- tmp_frame->root->lk_owner = 0;
tmp_frame->root->trans = conn;
+ memset (&tmp_frame->root->lk_owner, 0,
+ sizeof (gf_lkowner_t));
if (locker->fd) {
GF_ASSERT (locker->fd->inode);