summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-11-10 16:39:31 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-16 01:54:34 -0800
commit3440b6d68a5e787a6a1baba2073ee0c44a9b1632 (patch)
tree1f664139a04ecdad268fc9eccbc276f9bedc2b1f /xlators/cluster/dht/src/dht-common.c
parenta3c49bb260263dce98d44c28e7106da2a2173ed9 (diff)
cluster/distribute: Use local call_cnt while winding
layout->cnt might be modified in cbk's or different threads, which will lead to corruptions Change-Id: Icfdab01ac583cb3d27d62f878b79e0098b597952 BUG: 3730 Reviewed-on: http://review.gluster.com/694 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index faf575d..501bd31 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1137,15 +1137,13 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
ret = dict_set_uint32 (local->xattr_req,
GLUSTERFS_OPEN_FD_COUNT, 4);
- for (i = 0; i < layout->cnt; i++) {
+ for (i = 0; i < call_cnt; i++) {
subvol = layout->list[i].xlator;
STACK_WIND (frame, dht_revalidate_cbk,
subvol, subvol->fops->lookup,
&local->loc, local->xattr_req);
- if (!--call_cnt)
- break;
}
} else {
do_fresh_lookup:
@@ -1806,6 +1804,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
uint32_t dir_spread = 0;
char value[4096] = {0,};
int forced_rebalance = 0;
+ int call_cnt = 0;
VALIDATE_OR_GOTO (frame, err);
@@ -1837,7 +1836,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->call_cnt = layout->cnt;
+ local->call_cnt = call_cnt = layout->cnt;
/* This key is sent by Unified File and Object storage
* to test xattr support in backend.
@@ -1849,7 +1848,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
local->op_ret = 0;
- for (i = 0; i < layout->cnt; i++) {
+ for (i = 0; i < call_cnt; i++) {
STACK_WIND (frame, dht_ufo_xattr_cbk,
layout->list[i].xlator,
layout->list[i].xlator->fops->setxattr,
@@ -1946,7 +1945,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
- for (i = 0; i < layout->cnt; i++) {
+ for (i = 0; i < call_cnt; i++) {
STACK_WIND (frame, dht_err_cbk,
layout->list[i].xlator,
layout->list[i].xlator->fops->setxattr,
@@ -2006,6 +2005,7 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
int op_errno = -1;
dht_local_t *local = NULL;
dht_layout_t *layout = NULL;
+ int call_cnt = 0;
int i;
@@ -2037,10 +2037,10 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
goto err;
}
- local->call_cnt = layout->cnt;
+ local->call_cnt = call_cnt = layout->cnt;
local->key = gf_strdup (key);
- for (i = 0; i < layout->cnt; i++) {
+ for (i = 0; i < call_cnt; i++) {
STACK_WIND (frame, dht_removexattr_cbk,
layout->list[i].xlator,
layout->list[i].xlator->fops->removexattr,