summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c6
-rw-r--r--xlators/cluster/afr/src/afr-open.c7
-rw-r--r--xlators/cluster/afr/src/afr.h1
3 files changed, 11 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 5d10944b1fd..b40af1b069f 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -355,7 +355,6 @@ afr_open_fd_fix (call_frame_t *frame, xlator_t *this, gf_boolean_t pause_fop)
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
gf_boolean_t fop_continue = _gf_true;
- gf_boolean_t queue_fop = _gf_false;
local = frame->local;
priv = this->private;
@@ -384,6 +383,7 @@ afr_open_fd_fix (call_frame_t *frame, xlator_t *this, gf_boolean_t pause_fop)
fd_ctx->up_count = priv->up_count;
fd_ctx->down_count = priv->down_count;
}
+
for (i = 0; i < priv->child_count; i++) {
if ((fd_ctx->opened_on[i] == AFR_FD_NOT_OPENED) &&
local->child_up[i]) {
@@ -396,11 +396,11 @@ afr_open_fd_fix (call_frame_t *frame, xlator_t *this, gf_boolean_t pause_fop)
need_open_count++;
} else if (pause_fop && local->child_up[i] &&
(fd_ctx->opened_on[i] == AFR_FD_OPENING)) {
- queue_fop = _gf_true;
+ local->fop_paused = _gf_true;
}
}
- if (queue_fop) {
+ if (local->fop_paused) {
GF_ASSERT (pause_fop);
gf_log (this->name, GF_LOG_INFO, "Pause fd %p",
local->fd);
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index ee037e5dfbb..ae585186064 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -263,6 +263,7 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int call_count = 0;
int child_index = (long) cookie;
struct list_head paused_calls = {0};
+ gf_boolean_t fop_paused = _gf_false;
priv = this->private;
local = frame->local;
@@ -277,6 +278,7 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
+ fop_paused = local->fop_paused;
LOCK (&local->fd->lock);
{
if (op_ret >= 0) {
@@ -297,12 +299,17 @@ afr_openfd_fix_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
if (call_count == 0) {
afr_resume_calls (this, &paused_calls);
+ //If the fop is paused then resume_calls will continue the fop
+ if (fop_paused)
+ goto done;
+
if (local->fop_call_continue)
local->fop_call_continue (frame, this);
else
AFR_STACK_DESTROY (frame);
}
+done:
return 0;
}
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index a392dbefa97..06e1a664e23 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -386,6 +386,7 @@ typedef struct _afr_local {
dict_t *dict;
int optimistic_change_log;
+ gf_boolean_t fop_paused;
int (*fop_call_continue) (call_frame_t *frame, xlator_t *this);
/*