summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-open.c
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2010-08-22 14:08:43 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-22 22:27:40 -0700
commit63f9e2a49573a0b539c0082fd0c08c1b4d4db983 (patch)
treed697fb49e1a713bf1d83f4d8275857b0f0f1faa4 /xlators/cluster/afr/src/afr-open.c
parent37ec7db018979d04d02ae5670b53dbed7a498ba8 (diff)
cluster/afr: Use 2 phase locking for transactions and self heal.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 960 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=960
Diffstat (limited to 'xlators/cluster/afr/src/afr-open.c')
-rw-r--r--xlators/cluster/afr/src/afr-open.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index bc8786155..c8603be33 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -217,8 +217,9 @@ afr_up_down_flush_open_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret, int32_t op_errno,
fd_t *fd)
{
- afr_local_t *local = NULL;
- afr_private_t *priv = NULL;
+ afr_internal_lock_t *int_lock = NULL;
+ afr_local_t *local = NULL;
+ afr_private_t *priv = NULL;
int ret = 0;
@@ -228,8 +229,9 @@ afr_up_down_flush_open_cbk (call_frame_t *frame, void *cookie,
int call_count = 0;
int child_index = (long) cookie;
- priv = this->private;
- local = frame->local;
+ priv = this->private;
+ local = frame->local;
+ int_lock = &local->internal_lock;
LOCK (&frame->lock);
{
@@ -255,6 +257,7 @@ out:
call_count = afr_frame_return (frame);
if (call_count == 0) {
+ int_lock->lock_cbk = local->transaction.done;
local->transaction.post_post_op (frame, this);
}
@@ -434,6 +437,9 @@ out:
afr_local_transaction_cleanup (local, this);
+ gf_log (this->name, GF_LOG_TRACE,
+ "The up/down flush is over");
+
local->up_down_flush_cbk (frame, this);
return 0;
@@ -454,7 +460,7 @@ afr_up_down_flush (call_frame_t *frame, xlator_t *this, fd_t *fd,
local->op = GF_FOP_FLUSH;
-// local->fd = fd_ref (local->fd);
+ local->fd = fd_ref (local->fd);
local->transaction.fop = afr_up_down_flush_wind;
local->transaction.done = afr_up_down_flush_done;