From 1bcb009cf65e57117653bbbb5cdf673f9d9142e9 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Wed, 25 Nov 2009 07:51:23 +0000 Subject: cluster/afr: Do self-heal on unopened fds. This patch completes the previous patch for self-heal of open fds in replicate. If an fd was never opened on a subvolume, we remember that and do the open after we've done self-heal on that fd. Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170 --- xlators/cluster/afr/src/afr-dir-write.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'xlators/cluster/afr/src/afr-dir-write.c') diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 9bea54c44..55fc1a006 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -126,6 +126,9 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, afr_local_t * local = NULL; afr_private_t * priv = NULL; + uint64_t ctx; + afr_fd_ctx_t *fd_ctx; + int ret = 0; int call_count = -1; @@ -154,6 +157,20 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = -ret; } + ret = fd_ctx_get (fd, this, &ctx); + + if (ret < 0) { + gf_log (this->name, GF_LOG_DEBUG, + "could not get fd ctx for fd=%p", fd); + local->op_ret = -1; + local->op_errno = -ret; + } + + fd_ctx = (afr_fd_ctx_t *)(long) ctx; + + fd_ctx->opened_on[child_index] = 1; + fd_ctx->flags = local->cont.create.flags; + if (local->success_count == 0) { local->cont.create.buf = *buf; -- cgit