diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2016-08-16 16:04:37 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-08-22 13:55:42 -0700 |
commit | 413594ed647400f1b39e05d4f1b12ad846e48800 (patch) | |
tree | fd7072bc983754156eb66ff2348c7ac99773c9e2 /xlators/cluster/afr/src/afr-transaction.c | |
parent | eddada59f7ad3cf21463a558a5f62591f4b72c68 (diff) |
cluster/afr: Give option to do consistent-io
Problem:
When tiering/rebalance does migrations and afr with 2-way replica is in
picture, migration can read stale data if the source brick goes down and writes
to the destination. After this deletion of the file leads to permanent loss of
data after migration.
Fix:
Rebalance/tiering should migrate only when the data is definitely not stale. So
introduce an option in afr called consistent-io which will be enabled in
migration daemons.
BUG: 1306398
Change-Id: I750f65091cc70a3ed4bf3c12f83d0949af43920a
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/13425
Reviewed-by: Anuradha Talur <atalur@redhat.com>
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 6130ad76543..64a42d9fc7e 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -207,6 +207,7 @@ afr_transaction_detach_fop_frame (call_frame_t *frame) local = frame->local; + afr_handle_inconsistent_fop (frame, &local->op_ret, &local->op_errno); LOCK (&frame->lock); { fop_frame = local->transaction.main_frame; @@ -2238,6 +2239,11 @@ afr_transaction (call_frame_t *frame, xlator_t *this, afr_transaction_type type) local->transaction.resume = afr_transaction_resume; local->transaction.type = type; + if (!afr_is_consistent_io_possible (local, priv, &ret)) { + ret = -ret; /*op_errno to ret conversion*/ + goto out; + } + ret = afr_transaction_local_init (local, this); if (ret < 0) goto out; |