summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2013-08-15 22:01:20 +0530
committerAnand Avati <avati@redhat.com>2013-08-28 15:40:31 -0700
commitfaef08b7cf84ca9e68437abacad12133ef7569be (patch)
tree0b2122a3762209327dd8d0145219b9e02562d304 /xlators/cluster
parent8fcf91b51ccd457d417e71c401f6e6af1dffc607 (diff)
cluster/afr: Don't delay post op in cases of failures
Change-Id: Ib0c3af6babc61dc3ed45252582876e2f243d6446 BUG: 958118 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/5635 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c15
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c30
-rw-r--r--xlators/cluster/afr/src/afr-transaction.h2
3 files changed, 36 insertions, 11 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 7f7d9b4f8df..27107439606 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -133,6 +133,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *postbuf, dict_t *xdata)
{
afr_local_t * local = NULL;
+ afr_private_t *priv = NULL;
call_frame_t *fop_frame = NULL;
int child_index = (long) cookie;
int call_count = -1;
@@ -142,6 +143,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uint32_t write_is_append = 0;
local = frame->local;
+ priv = this->private;
read_child = afr_inode_get_read_ctx (this, local->fd->inode, NULL);
@@ -210,6 +212,10 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_fd_report_unstable_write (this, local->fd);
afr_writev_handle_short_writes (frame, this);
+ if (afr_any_fops_failed (local, priv)) {
+ //Don't unwind until post-op is complete
+ local->transaction.resume (frame, this);
+ } else {
/*
* Generally inode-write fops do transaction.unwind then
* transaction.resume, but writev needs to make sure that
@@ -221,10 +227,11 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
* completed.
*/
- fop_frame = afr_transaction_detach_fop_frame (frame);
- afr_writev_copy_outvars (frame, fop_frame);
- local->transaction.resume (frame, this);
- afr_writev_unwind (fop_frame, this);
+ fop_frame = afr_transaction_detach_fop_frame (frame);
+ afr_writev_copy_outvars (frame, fop_frame);
+ local->transaction.resume (frame, this);
+ afr_writev_unwind (fop_frame, this);
+ }
}
return 0;
}
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 817645505c6..35547a2315a 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1338,10 +1338,21 @@ afr_are_multiple_fds_opened (inode_t *inode, xlator_t *this)
}
gf_boolean_t
+afr_any_fops_failed (afr_local_t *local, afr_private_t *priv)
+{
+ if (local->success_count != priv->child_count)
+ return _gf_true;
+ return _gf_false;
+}
+
+gf_boolean_t
is_afr_delayed_changelog_post_op_needed (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
gf_boolean_t res = _gf_false;
+ afr_private_t *priv = NULL;
+
+ priv = this->private;
local = frame->local;
if (!local)
@@ -1350,6 +1361,10 @@ is_afr_delayed_changelog_post_op_needed (call_frame_t *frame, xlator_t *this)
if (!local->delayed_post_op)
goto out;
+ //Mark pending changelog ASAP
+ if (afr_any_fops_failed (local, priv))
+ goto out;
+
if (local->fd && afr_are_multiple_fds_opened (local->fd->inode, this))
goto out;
@@ -1622,9 +1637,9 @@ afr_changelog_post_op_safe (call_frame_t *frame, xlator_t *this)
}
- void
+void
afr_delayed_changelog_post_op (xlator_t *this, call_frame_t *frame, fd_t *fd,
- call_stub_t *stub)
+ call_stub_t *stub)
{
afr_fd_ctx_t *fd_ctx = NULL;
call_frame_t *prev_frame = NULL;
@@ -1669,7 +1684,7 @@ out:
}
- void
+void
afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
@@ -1691,14 +1706,14 @@ afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
The @stub gets saved in @local and gets resumed in
afr_local_cleanup()
*/
- void
+void
afr_delayed_changelog_wake_resume (xlator_t *this, fd_t *fd, call_stub_t *stub)
{
afr_delayed_changelog_post_op (this, NULL, fd, stub);
}
- void
+void
afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd)
{
afr_delayed_changelog_post_op (this, NULL, fd, NULL);
@@ -1748,8 +1763,9 @@ afr_transaction_resume (call_frame_t *frame, xlator_t *this)
* afr_transaction_fop_failed - inform that an fop failed
*/
- void
-afr_transaction_fop_failed (call_frame_t *frame, xlator_t *this, int child_index)
+void
+afr_transaction_fop_failed (call_frame_t *frame, xlator_t *this,
+ int child_index)
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h
index 108131276ea..05d1c1a8d45 100644
--- a/xlators/cluster/afr/src/afr-transaction.h
+++ b/xlators/cluster/afr/src/afr-transaction.h
@@ -43,4 +43,6 @@ afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd);
void
__mark_all_success (int32_t *pending[], int child_count,
afr_transaction_type type);
+gf_boolean_t
+afr_any_fops_failed (afr_local_t *local, afr_private_t *priv);
#endif /* __TRANSACTION_H__ */