summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-12-16 19:01:20 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-01-08 01:42:32 -0800
commit419015d5f61c9d9dcd93f9dda3f7b66f735ded83 (patch)
tree9c2acf6b8645bc218524576acc247ee623c41410 /xlators
parenta0e35d4f09e63fa91737c6abf40a58401590acc7 (diff)
performance/readdir-ahead: indicate EOF for readdirp.
posix xlator sends op_errno as ENOENT and op_ret as 0, to indicate readdir has been completed. readdir-ahead should send that op_errno that it has saved in the fd context, when it serves the readdir requests. Otherwise some xlators sitting above performance xlators such as snapview-client, which checks for end of readdir operation by checking op_ret to 0 and op_errno to ENOENT will not be able to identify end of readdir. Change-Id: Ib0835136c61cb1e0d7df933226c479c7db703a71 BUG: 1175753 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/9283 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/9348
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/readdir-ahead/src/readdir-ahead.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
index ba96bfcd3af..1a567a03ea8 100644
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
@@ -83,6 +83,7 @@ rda_reset_ctx(struct rda_fd_ctx *ctx)
ctx->cur_offset = 0;
ctx->cur_size = 0;
ctx->next_offset = 0;
+ ctx->op_errno = 0;
gf_dirent_free(&ctx->entries);
}
@@ -142,7 +143,7 @@ rda_readdirp_stub(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
gf_dirent_t entries;
int32_t ret;
struct rda_fd_ctx *ctx;
- int op_errno = 0;
+ int op_errno = 0;
ctx = get_rda_fd_ctx(fd, this);
INIT_LIST_HEAD(&entries.list);
@@ -150,7 +151,6 @@ rda_readdirp_stub(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!ret && (ctx->state & RDA_FD_ERROR)) {
ret = -1;
- op_errno = ctx->op_errno;
ctx->state &= ~RDA_FD_ERROR;
/*
@@ -160,6 +160,12 @@ rda_readdirp_stub(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
ctx->state |= RDA_FD_BYPASS;
}
+ /*
+ * Use the op_errno sent by lower layers as xlators above will check
+ * the op_errno for identifying whether readdir is completed or not.
+ */
+ op_errno = ctx->op_errno;
+
STACK_UNWIND_STRICT(readdirp, frame, ret, op_errno, &entries, xdata);
gf_dirent_free(&entries);
@@ -282,6 +288,7 @@ rda_fill_fd_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
/* we've hit eod */
ctx->state &= ~RDA_FD_RUNNING;
ctx->state |= RDA_FD_EOD;
+ ctx->op_errno = op_errno;
} else if (op_ret == -1) {
/* kill the preload and pend the error */
ctx->state &= ~RDA_FD_RUNNING;