summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-07-17 15:34:14 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-17 14:17:08 -0700
commitf4513b4de104f1c6f40f7bbe0a4bd698340db805 (patch)
treea536e7fb70d5285c75324a54318871fe617e2bd8
parent215b62f1db24bc7ff55d224046e343401d78c38b (diff)
Do not failover readdir in replicate
Backport of http://patches.gluster.com/patch/561/ to release-2.0 Also, the failover version of afr_readdir_cbk is buggy and crashes when it is called after a failover inevitably Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 150 (AFR readdir should not failover to other subvolume) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=150
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c52
1 files changed, 18 insertions, 34 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index f74deab6d..ba361cdd9 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -148,50 +148,34 @@ out:
int32_t
afr_readdir_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret, int32_t op_errno,
- gf_dirent_t *buf)
+ gf_dirent_t *entries)
{
- afr_private_t * priv = NULL;
- afr_local_t * local = NULL;
- xlator_t ** children = NULL;
+ afr_private_t * priv = NULL;
+ afr_local_t * local = NULL;
+ xlator_t ** children = NULL;
+
+ gf_dirent_t * entry = NULL;
- int unwind = 1;
- int last_tried = -1;
- int this_try = -1;
int child_index = -1;
- priv = this->private;
- children = priv->children;
+ priv = this->private;
+ children = priv->children;
- local = frame->local;
+ local = frame->local;
child_index = (long) cookie;
- if (op_ret == -1) {
- last_tried = local->cont.readdir.last_tried;
-
- if (all_tried (last_tried, priv->child_count)) {
- goto out;
- }
-
- this_try = ++local->cont.readdir.last_tried;
- unwind = 0;
-
- STACK_WIND (frame, afr_readdir_cbk,
- children[this_try],
- children[this_try]->fops->readdir,
- local->fd, local->cont.readdir.size,
- local->cont.readdir.offset);
- }
+ if (op_ret != -1) {
+ list_for_each_entry (entry, &entries->list, list) {
+ entry->d_ino = afr_itransform (entry->d_ino,
+ priv->child_count,
+ child_index);
+ }
+ }
-out:
- if (unwind) {
- buf->d_ino = afr_itransform (buf->d_ino, priv->child_count,
- child_index);
-
- AFR_STACK_UNWIND (frame, op_ret, op_errno, buf);
- }
+ AFR_STACK_UNWIND (frame, op_ret, op_errno, entries);
- return 0;
+ return 0;
}