diff options
author | Ravishankar N <ravishankar@redhat.com> | 2018-08-31 10:32:20 +0530 |
---|---|---|
committer | Ravishankar N <ravishankar@redhat.com> | 2018-09-05 08:28:23 +0000 |
commit | 69532c141be160b3fea03c1579ae4ac13018dcdf (patch) | |
tree | 87c1db97307ce692343144d147eaa7cf3b0b5dfc /xlators/cluster/afr/src/afr-common.c | |
parent | 560bd8671f2f9ae17530ad1d23a209dc95d41f82 (diff) |
afr: thin-arbiter read txn changes
If both data bricks are up, read subvol will be based on read_subvols.
If only one data brick is up:
- First qeury the data-brick that is up. If it blames the other brick,
allow the reads.
- If if doesn't, query the TA to obtain the source of truth.
TODO: See if in-memory state can be maintained for read txns (BZ 1624358).
updates: bz#1579788
Change-Id: I61eec35592af3a1aaf9f90846d9a358b2e4b2fcc
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 702973a6ef4..641485b1ed0 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1310,6 +1310,14 @@ afr_inode_refresh_done (call_frame_t *frame, xlator_t *this, int error) goto refresh_done; } + if (priv->thin_arbiter_count && local->is_read_txn && + AFR_COUNT (success_replies, priv->child_count) != + priv->child_count) { + /* We need to query the good bricks and/or thin-arbiter.*/ + error = EINVAL; + goto refresh_done; + } + ret = afr_replies_interpret (frame, this, local->refreshinode, &start_heal); @@ -6977,3 +6985,17 @@ afr_ta_post_op_unlock (xlator_t *this, loc_t *loc) out: return ret; } + +call_frame_t * +afr_ta_frame_create (xlator_t *this) +{ + call_frame_t *frame = NULL; + void *lk_owner = NULL; + + frame = create_frame (this, this->ctx->pool); + if (!frame) + return NULL; + lk_owner = (void *)this; + afr_set_lk_owner (frame, this, lk_owner); + return frame; +} |