summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-03-22 04:43:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-25 04:11:49 -0700
commitcd3d977b10e24c4b46e55f9831113aba3a241583 (patch)
tree3b965765e7bcd25b603c71b0ce195b9bafdaa0c0 /xlators/cluster/dht
parent0ed446b7c8c8bcda74a5d64cdb8f0ac2d11b2389 (diff)
Process dir/link from other subvol if error in dht_readdir
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2137 (dhtafr - self heal after renaming directory) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2137
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 5042ad065..25aa3c444 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2898,13 +2898,20 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
int count = 0;
dht_layout_t *layout = 0;
dht_conf_t *conf = NULL;
- xlator_t *subvol = 0;
+ xlator_t *subvol = NULL;
+ uint64_t value = 0;
INIT_LIST_HEAD (&entries.list);
prev = cookie;
local = frame->local;
conf = this->private;
+ if (!fd_ctx_get (local->fd, this, &value))
+ subvol = (xlator_t *)(long)value;
+
+ if (!subvol)
+ goto unwind;
+
if (op_ret < 0)
goto done;
@@ -2918,7 +2925,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
if (check_is_linkfile (NULL, (&orig_entry->d_stat), NULL)
|| (check_is_dir (NULL, (&orig_entry->d_stat), NULL)
- && (prev->this != dht_first_up_subvol (this)))) {
+ && (prev->this != subvol))) {
continue;
}
@@ -2977,6 +2984,9 @@ done:
if (!next_subvol) {
goto unwind;
}
+ if ((op_ret < 0) && (prev->this == subvol))
+ fd_ctx_set (local->fd, this,
+ (uint64_t)(long)next_subvol);
STACK_WIND (frame, dht_readdirp_cbk,
next_subvol, next_subvol->fops->readdirp,
@@ -3128,10 +3138,13 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (whichop == GF_FOP_READDIR)
STACK_WIND (frame, dht_readdir_cbk, xvol, xvol->fops->readdir,
fd, size, xoff);
- else
+ else {
+ if (yoff == 0)
+ fd_ctx_set (fd, this, (uint64_t)(long)xvol);
+
STACK_WIND (frame, dht_readdirp_cbk, xvol, xvol->fops->readdirp,
fd, size, xoff);
-
+ }
return 0;
err: