From 218959e0597b16755a98b19786ed6a42cd15cbc4 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Tue, 24 Nov 2009 08:45:08 +0000 Subject: cluster/afr: Provide a post-post_op hook in the transaction. 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-transaction.c | 26 ++++++++++++++++++++------ xlators/cluster/afr/src/afr.h | 3 +++ 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/afr') 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; -- cgit