From b445678d03b5ad18f85b025f72384b9a343ec9ee Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 18 Dec 2012 09:24:38 +0530 Subject: cluster/afr: Pre-op should be undone for non-piggyback post-op Problem: When fop fails post-op is always performed over the network irrespective of whether pre-op is piggybacked or not. Decrementing Pre-op-done count even for the piggybacked ones is wrong. I have added an assert for pre_op_done to be non-zero and when dd of=a if=/dev/urandom bs=5M count=1000 is executed and a brick is taken down, the mount is crashing. Fix: Decrement pre-op-done count only when the post-op is not piggybacked. Change-Id: Ie837251a43bfb437f0fada191302eeee60be1601 BUG: 863939 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/4310 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/afr/src/afr-transaction.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 5e636d8dc..73dd50f67 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -165,8 +165,10 @@ __mark_pre_op_undone_on_fd (call_frame_t *frame, xlator_t *this, int child_index LOCK (&local->fd->lock); { - if (local->transaction.type == AFR_DATA_TRANSACTION) + if (local->transaction.type == AFR_DATA_TRANSACTION) { + GF_ASSERT (fd_ctx->pre_op_done[child_index]); fd_ctx->pre_op_done[child_index]--; + } } UNLOCK (&local->fd->lock); out: @@ -655,7 +657,9 @@ afr_changelog_post_op_now (call_frame_t *frame, xlator_t *this) afr_changelog_post_op_cbk (frame, (void *)(long)i, this, 1, 0, xattr[i], NULL); } else { - __mark_pre_op_undone_on_fd (frame, this, i); + if (!piggyback) + __mark_pre_op_undone_on_fd (frame, this, + i); STACK_WIND_COOKIE (frame, afr_changelog_post_op_cbk, (void *) (long) i, -- cgit