diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-11-24 08:45:08 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-24 06:40:04 -0800 |
commit | 218959e0597b16755a98b19786ed6a42cd15cbc4 (patch) | |
tree | 41284d9c6a80991d50a5760178ac2dd4201cf5c9 /xlators/cluster | |
parent | 9e3fddb13769288ddc13db3125b8bedf26058cdf (diff) |
cluster/afr: Provide a post-post_op hook in the transaction.
Signed-off-by: Vikas Gorur <vikas@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
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
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 26 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 3 |
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 a2627b9caca..f7604dbf612 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 412f38afc79..23e75e6126a 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; |