From faef08b7cf84ca9e68437abacad12133ef7569be Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 15 Aug 2013 22:01:20 +0530 Subject: cluster/afr: Don't delay post op in cases of failures Change-Id: Ib0c3af6babc61dc3ed45252582876e2f243d6446 BUG: 958118 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/5635 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Anand Avati --- xlators/cluster/afr/src/afr-inode-write.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'xlators/cluster/afr/src/afr-inode-write.c') diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 7f7d9b4f8df..27107439606 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -133,6 +133,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { afr_local_t * local = NULL; + afr_private_t *priv = NULL; call_frame_t *fop_frame = NULL; int child_index = (long) cookie; int call_count = -1; @@ -142,6 +143,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t write_is_append = 0; local = frame->local; + priv = this->private; read_child = afr_inode_get_read_ctx (this, local->fd->inode, NULL); @@ -210,6 +212,10 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, afr_fd_report_unstable_write (this, local->fd); afr_writev_handle_short_writes (frame, this); + if (afr_any_fops_failed (local, priv)) { + //Don't unwind until post-op is complete + local->transaction.resume (frame, this); + } else { /* * Generally inode-write fops do transaction.unwind then * transaction.resume, but writev needs to make sure that @@ -221,10 +227,11 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * completed. */ - fop_frame = afr_transaction_detach_fop_frame (frame); - afr_writev_copy_outvars (frame, fop_frame); - local->transaction.resume (frame, this); - afr_writev_unwind (fop_frame, this); + fop_frame = afr_transaction_detach_fop_frame (frame); + afr_writev_copy_outvars (frame, fop_frame); + local->transaction.resume (frame, this); + afr_writev_unwind (fop_frame, this); + } } return 0; } -- cgit