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.h | |
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.h')
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 29008287e6d..983f07fcce9 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -152,6 +152,7 @@ typedef struct _afr_private { gf_boolean_t use_afr_in_pump; char *locking_scheme; gf_boolean_t esh_granular; + gf_boolean_t consistent_io; } afr_private_t; @@ -663,6 +664,10 @@ typedef struct _afr_local { } inodelk; struct { + entrylk_cmd cmd; + } entrylk; + + struct { off_t offset; gf_seek_what_t what; } seek; @@ -965,16 +970,25 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this); int afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd); -#define AFR_STACK_UNWIND(fop, frame, params ...) \ +#define AFR_STACK_UNWIND(fop, frame, op_ret, op_errno, params ...)\ do { \ afr_local_t *__local = NULL; \ xlator_t *__this = NULL; \ + int32_t __op_ret = 0; \ + int32_t __op_errno = 0; \ + \ + __op_ret = op_ret; \ + __op_errno = op_errno; \ if (frame) { \ __local = frame->local; \ __this = frame->this; \ + afr_handle_inconsistent_fop (frame, &__op_ret,\ + &__op_errno);\ frame->local = NULL; \ } \ - STACK_UNWIND_STRICT (fop, frame, params); \ + \ + STACK_UNWIND_STRICT (fop, frame, __op_ret, \ + __op_errno, params); \ if (__local) { \ afr_local_cleanup (__local, __this); \ mem_put (__local); \ @@ -1160,4 +1174,11 @@ afr_get_msg_id (char *op_type); int afr_set_in_flight_sb_status (xlator_t *this, afr_local_t *local, inode_t *inode); + +gf_boolean_t +afr_is_consistent_io_possible (afr_local_t *local, afr_private_t *priv, + int32_t *op_errno); +void +afr_handle_inconsistent_fop (call_frame_t *frame, int32_t *op_ret, + int32_t *op_errno); #endif /* __AFR_H__ */ |