From ac568d561ba15a148d8de6a3d4431714bce230f6 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 5 Mar 2012 23:54:51 +0530 Subject: cluster/distribute: send proper 'dict' in readdirp() if we do the STACK_WIND from readdirp_cbk(), we were not sending the right dictionary which made our linkfile determination a failure. Change-Id: Ie3f26748608f1a81123fe475d8a42bf2717475c3 Signed-off-by: Amar Tumballi BUG: 799887 Reviewed-on: http://review.gluster.com/2869 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda --- xlators/cluster/dht/src/dht-common.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'xlators/cluster/dht') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index d76abdd5965..2bff9c87b58 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -2803,7 +2803,7 @@ done: STACK_WIND (frame, dht_readdirp_cbk, next_subvol, next_subvol->fops->readdirp, local->fd, local->size, next_offset, - local->xattr_req); + local->xattr); return 0; } @@ -2941,21 +2941,29 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, dht_deitransform (this, yoff, &xvol, (uint64_t *)&xoff); - if (dict) { - ret = dict_set_uint32 (dict, "trusted.glusterfs.dht.linkto", - 256); - if (ret) - gf_log (this->name, GF_LOG_WARNING, - "failed to set 'glusterfs.dht.linkto' key"); - } - /* TODO: do proper readdir */ - if (whichop == GF_FOP_READDIR) + if (whichop == GF_FOP_READDIRP) { + if (dict) + local->xattr = dict_ref (dict); + else + local->xattr = dict_new (); + + if (local->xattr) { + ret = dict_set_uint32 (local->xattr, + "trusted.glusterfs.dht.linkto", + 256); + if (ret) + gf_log (this->name, GF_LOG_WARNING, + "failed to set 'glusterfs.dht.linkto'" + " key"); + } + + STACK_WIND (frame, dht_readdirp_cbk, xvol, xvol->fops->readdirp, + fd, size, xoff, local->xattr); + } else { STACK_WIND (frame, dht_readdir_cbk, xvol, xvol->fops->readdir, fd, size, xoff); - else - STACK_WIND (frame, dht_readdirp_cbk, xvol, xvol->fops->readdirp, - fd, size, xoff, dict); + } return 0; -- cgit