diff options
author | shishir gowda <shishirng@gluster.com> | 2011-11-10 16:39:31 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-11-16 01:54:34 -0800 |
commit | 3440b6d68a5e787a6a1baba2073ee0c44a9b1632 (patch) | |
tree | 1f664139a04ecdad268fc9eccbc276f9bedc2b1f /xlators/cluster/dht/src/dht-inode-read.c | |
parent | a3c49bb260263dce98d44c28e7106da2a2173ed9 (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-inode-read.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-inode-read.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-inode-read.c b/xlators/cluster/dht/src/dht-inode-read.c index d6a2cf36971..7352e47bd62 100644 --- a/xlators/cluster/dht/src/dht-inode-read.c +++ b/xlators/cluster/dht/src/dht-inode-read.c @@ -271,6 +271,7 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) dht_local_t *local = NULL; dht_layout_t *layout = NULL; int i = 0; + int call_cnt = 0; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -304,9 +305,9 @@ dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) return 0; } - local->call_cnt = layout->cnt; + local->call_cnt = call_cnt = layout->cnt; - for (i = 0; i < layout->cnt; i++) { + for (i = 0; i < call_cnt; i++) { subvol = layout->list[i].xlator; STACK_WIND (frame, dht_attr_cbk, @@ -332,6 +333,7 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) dht_local_t *local = NULL; dht_layout_t *layout = NULL; int i = 0; + int call_cnt = 0; VALIDATE_OR_GOTO (frame, err); @@ -363,9 +365,9 @@ dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) return 0; } - local->call_cnt = layout->cnt; + local->call_cnt = call_cnt = layout->cnt; - for (i = 0; i < layout->cnt; i++) { + for (i = 0; i < call_cnt; i++) { subvol = layout->list[i].xlator; STACK_WIND (frame, dht_attr_cbk, subvol, subvol->fops->fstat, |