summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-selfheal.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-12-06 14:43:10 +0530
committerJeff Darcy <jdarcy@redhat.com>2017-01-09 10:37:02 -0800
commita988741713752c2ec04a0680224d8fa4d42dc203 (patch)
treeb0cfd626c7cf8b5475e7cc533333dd17a47dc988 /xlators/cluster/dht/src/dht-selfheal.c
parentcc55be619830bc64544a1044f05367b8be9421bc (diff)
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 <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/16039 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/dht/src/dht-selfheal.c')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index 331878b..7fa05a9 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -174,7 +174,7 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
dht_local_t *local = NULL;
int this_call_cnt = 0;
- call_frame_t *prev = NULL;
+ xlator_t *prev = NULL;
dht_layout_t *layout = NULL;
GF_VALIDATE_OR_GOTO ("dht", frame, err);
@@ -189,16 +189,16 @@ dht_refresh_layout_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
LOCK (&frame->lock);
{
- op_ret = dht_layout_merge (this, layout, prev->this,
+ op_ret = dht_layout_merge (this, layout, prev,
op_ret, op_errno, xattr);
- dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev);
if (op_ret == -1) {
local->op_errno = op_errno;
gf_msg_debug (this->name, op_errno,
"lookup of %s on %s returned error",
- local->loc.path, prev->this->name);
+ local->loc.path, prev->name);
goto unlock;
}
@@ -279,10 +279,10 @@ dht_refresh_layout (call_frame_t *frame)
}
for (i = 0; i < call_cnt; i++) {
- STACK_WIND (frame, dht_refresh_layout_cbk,
- conf->subvolumes[i],
- conf->subvolumes[i]->fops->lookup,
- &local->loc, local->xattr_req);
+ STACK_WIND_COOKIE (frame, dht_refresh_layout_cbk,
+ conf->subvolumes[i], conf->subvolumes[i],
+ conf->subvolumes[i]->fops->lookup,
+ &local->loc, local->xattr_req);
}
return 0;
@@ -1139,7 +1139,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
dht_local_t *local = NULL;
dht_layout_t *layout = NULL;
- call_frame_t *prev = NULL;
+ xlator_t *prev = NULL;
xlator_t *subvol = NULL;
int i = 0, ret = -1;
int this_call_cnt = 0;
@@ -1148,7 +1148,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
layout = local->selfheal.layout;
prev = cookie;
- subvol = prev->this;
+ subvol = prev;
if ((op_ret == 0) || ((op_ret == -1) && (op_errno == EEXIST))) {
for (i = 0; i < layout->cnt; i++) {
@@ -1168,8 +1168,8 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->loc.path, gfid );
goto out;
}
- dht_iatt_merge (this, &local->preparent, preparent, prev->this);
- dht_iatt_merge (this, &local->postparent, postparent, prev->this);
+ dht_iatt_merge (this, &local->preparent, preparent, prev);
+ dht_iatt_merge (this, &local->postparent, postparent, prev);
ret = 0;
out:
@@ -1277,13 +1277,14 @@ dht_selfheal_dir_mkdir_lookup_done (call_frame_t *frame, xlator_t *this)
"Creating directory %s on subvol %s",
loc->path, layout->list[i].xlator->name);
- STACK_WIND (frame, dht_selfheal_dir_mkdir_cbk,
- layout->list[i].xlator,
- layout->list[i].xlator->fops->mkdir,
- loc,
- st_mode_from_ia (local->stbuf.ia_prot,
- local->stbuf.ia_type),
- 0, dict);
+ STACK_WIND_COOKIE (frame, dht_selfheal_dir_mkdir_cbk,
+ layout->list[i].xlator,
+ layout->list[i].xlator,
+ layout->list[i].xlator->fops->mkdir,
+ loc,
+ st_mode_from_ia (local->stbuf.ia_prot,
+ local->stbuf.ia_type),
+ 0, dict);
}
}
@@ -1309,7 +1310,7 @@ dht_selfheal_dir_mkdir_lookup_cbk (call_frame_t *frame, void *cookie,
int missing_dirs = 0;
dht_layout_t *layout = NULL;
loc_t *loc = NULL;
- call_frame_t *prev = NULL;
+ xlator_t *prev = NULL;
VALIDATE_OR_GOTO (this->private, err);
@@ -1329,7 +1330,7 @@ dht_selfheal_dir_mkdir_lookup_cbk (call_frame_t *frame, void *cookie,
}
if (!op_ret) {
- dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev);
}
}
@@ -1413,10 +1414,10 @@ dht_selfheal_dir_mkdir_lock_cbk (call_frame_t *frame, void *cookie,
*/
for (i = 0; i < conf->subvolume_cnt; i++) {
- STACK_WIND (frame, dht_selfheal_dir_mkdir_lookup_cbk,
- conf->subvolumes[i],
- conf->subvolumes[i]->fops->lookup,
- &local->loc, NULL);
+ STACK_WIND_COOKIE (frame, dht_selfheal_dir_mkdir_lookup_cbk,
+ conf->subvolumes[i], conf->subvolumes[i],
+ conf->subvolumes[i]->fops->lookup,
+ &local->loc, NULL);
}
return 0;