From 3440b6d68a5e787a6a1baba2073ee0c44a9b1632 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 10 Nov 2011 16:39:31 +0530 Subject: 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 Reviewed-by: Jeff Darcy Reviewed-by: Amar Tumballi --- xlators/cluster/dht/src/dht-inode-read.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xlators/cluster/dht/src/dht-inode-read.c') 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, -- cgit