From a988741713752c2ec04a0680224d8fa4d42dc203 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Tue, 6 Dec 2016 14:43:10 +0530 Subject: dht: At places needed use STACK_WIND_COOKIE Issue: frame has a void * cookie pointer. In case of STACK_WIND_COOKIE frame->cookie is assigned to what is sent by the caller. In case of STACK_WIND frame->cookie is assigned to point point to the frame itself. For ease of coding, at many places, the cookie in the cbk is used to get the pointer to the next xl. This is inconsistent when STACK_WIND_TAIL comes into picture. Eg: dht_setxattr () { for (i = 0 ; i < conf->subvolume_cnt ; i++) { STACK_WIND (..dht_checking_pathinfo_cbk, conf->subvolumes[i] ..); } dht_checking_pathinfo_cbk (...void *cookie...) { prev = cookie; ... for (i = 0; i < conf->subvolume_cnt; i++) { if (conf->subvolumes[i] == prev->this) { ... } } } Consider the below graph: dht (parent) readdir-ahead => Doesn't define setxattr and uses STACK_WIND_TAIL protocol-client With this graph, when dht_checking_pathinfo_cbk is called, cookie will have frame pointing to protocol-client. i.e. prev->this will be protocol-client. But dht was expecting it to be readdir-ahead as it has stored in conf->subvolumes[i] Solution: Hence, as a thumb rule, if cbk is using cookie, then we explicitly call STACK_WIND_COOKIE. Change-Id: I83aea1e24c809c5a91a0db7283e908e125471bd4 BUG: 1401812 Signed-off-by: Poornima G Reviewed-on: http://review.gluster.org/16039 Reviewed-by: Raghavendra G Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- libglusterfs/src/stack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 8a7a42a171d..b74989697da 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -332,7 +332,7 @@ STACK_RESET (call_stack_t *stack) "winding from %s to %s", \ frame->root, old_THIS->name, \ THIS->name); \ - if (obj->ctx->measure_latency) \ + if (obj->ctx->measure_latency) \ gf_latency_begin (_new, fn); \ fn (_new, obj, params); \ THIS = old_THIS; \ -- cgit