diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2012-12-18 09:24:38 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-01-16 23:11:17 -0800 |
commit | b445678d03b5ad18f85b025f72384b9a343ec9ee (patch) | |
tree | 834d136fc28cbb3d0d67509f6be468280816378d | |
parent | 8307ae12fa47db0510ef4353017ad5627adba75d (diff) |
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 <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4310
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 5e636d8dcc5..73dd50f67eb 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, |