summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server3_1-fops.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-03-03 17:28:17 +0530
committerAnand Avati <avati@redhat.com>2012-03-17 23:22:24 -0700
commit6aab9d9602dc1ef62a2d1d63aa1764a062bf9d9f (patch)
treea414f14eda54ce8560dda54ca683c307ae7e8407 /xlators/protocol/server/src/server3_1-fops.c
parent5e50175f56d05ab6c1295b0e0f0c11695e49c277 (diff)
protocol/server: Avoid race in add/del locker, connection_cleanup
conn->ltable address keeps changing in server_connection_cleanup every time it is called. i.e. New ltable is created every time it is called. Here is the race that happened: --------------------------------------------------- thread-1 | thread-2 add_locker is called with | conn->ltable. lets call the | ltable address lt1 | | connection cleanup is called | and do_lock_table_cleanup is | triggered for lt1. locker | lists are splice_inited under | the lt1->lock lt1 adds the locker under | lt1->lock (lets call this l1) | | GF_FREE(lt1) happens in | do_lock_table_cleanup The locker l1 that is added just before lt1 is freed will never be cleared in the subsequent server_connection_cleanups as there does not exist a reference to the locker. The stale lock remains in the locks xlator even though the transport on which it was issued is destroyed. Change-Id: I0a02f16c703d1e7598b083aa1057cda9624eb3fe BUG: 787601 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2957 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src/server3_1-fops.c')
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 3dae07b0385..3cf7eb2f820 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -219,11 +219,11 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret >= 0) {
if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn->ltable, state->volume,
+ gf_del_locker (conn, state->volume,
&state->loc, NULL, &frame->root->lk_owner,
GF_FOP_INODELK);
else
- gf_add_locker (conn->ltable, state->volume,
+ gf_add_locker (conn, state->volume,
&state->loc, NULL, frame->root->pid,
&frame->root->lk_owner,
GF_FOP_INODELK);
@@ -261,11 +261,11 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret >= 0) {
if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn->ltable, state->volume,
+ gf_del_locker (conn, state->volume,
NULL, state->fd,
&frame->root->lk_owner, GF_FOP_INODELK);
else
- gf_add_locker (conn->ltable, state->volume,
+ gf_add_locker (conn, state->volume,
NULL, state->fd,
frame->root->pid,
&frame->root->lk_owner, GF_FOP_INODELK);
@@ -302,11 +302,11 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret >= 0) {
if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn->ltable, state->volume,
+ gf_del_locker (conn, state->volume,
&state->loc, NULL, &frame->root->lk_owner,
GF_FOP_ENTRYLK);
else
- gf_add_locker (conn->ltable, state->volume,
+ gf_add_locker (conn, state->volume,
&state->loc, NULL, frame->root->pid,
&frame->root->lk_owner,
GF_FOP_ENTRYLK);
@@ -342,11 +342,11 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret >= 0) {
if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn->ltable, state->volume,
+ gf_del_locker (conn, state->volume,
NULL, state->fd, &frame->root->lk_owner,
GF_FOP_ENTRYLK);
else
- gf_add_locker (conn->ltable, state->volume,
+ gf_add_locker (conn, state->volume,
NULL, state->fd, frame->root->pid,
&frame->root->lk_owner, GF_FOP_ENTRYLK);
} else if ((op_errno != ENOSYS) && (op_errno != EAGAIN)) {