summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c26
-rw-r--r--xlators/cluster/afr/src/afr.h3
2 files changed, 23 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index a2627b9ca..f7604dbf6 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -597,9 +597,11 @@ afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
-
+
int call_count = -1;
+ int (*post_post_op) (call_frame_t *, xlator_t *);
+
priv = this->private;
local = frame->local;
@@ -610,11 +612,23 @@ afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
UNLOCK (&frame->lock);
if (call_count == 0) {
- if (afr_lock_server_count (priv, local->transaction.type) == 0) {
- local->transaction.done (frame, this);
- } else {
- afr_unlock (frame, this);
- }
+ if (local->transaction.post_post_op) {
+ post_post_op = local->transaction.post_post_op;
+
+ if (afr_lock_server_count (priv, local->transaction.type) == 0) {
+ local->transaction.post_post_op = local->transaction.done;
+ } else {
+ local->transaction.post_post_op = afr_unlock;
+ }
+
+ post_post_op (frame, this);
+ } else {
+ if (afr_lock_server_count (priv, local->transaction.type) == 0) {
+ local->transaction.done (frame, this);
+ } else {
+ afr_unlock (frame, this);
+ }
+ }
}
return 0;
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 412f38afc..23e75e612 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -493,6 +493,9 @@ typedef struct _afr_local {
int (*resume) (call_frame_t *frame, xlator_t *this);
int (*unwind) (call_frame_t *frame, xlator_t *this);
+
+ /* post-op hook */
+ int (*post_post_op) (call_frame_t *frame, xlator_t *this);
} transaction;
afr_self_heal_t self_heal;