summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-12-16 19:01:20 +0530
committerVijay Bellur <vbellur@redhat.com>2014-12-17 18:50:16 -0800
commitcca09a2a342980f427b590f2655d23c371386a02 (patch)
tree66a8cc82188bc57c8f405ca9bd6336c932c59efa /xlators/performance
parent531e0a70ff7a7b87baf0a8886d1de880293c3fcb (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: 1174783 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>
Diffstat (limited to 'xlators/performance')
-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;