From 55a493f4db6752303ad2a88572e4d75453054bce Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 3 Sep 2015 09:49:56 +0530 Subject: afr: Do not wind the full writev payload to arbiter brick ...because the arbiter xlator just unwinds it without passing it down till posix anyway. Instead, send a one-byte vector so that afr write transaction works as expected. Change-Id: I52913ca51dfee0c8472cbadb62c5d39b7badef77 BUG: 1259572 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/12095 Reviewed-by: Pranith Kumar Karampuri Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Anuradha Talur --- xlators/cluster/afr/src/afr-inode-write.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 5dd52cf9c0d..0601b89090c 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -112,10 +112,17 @@ __afr_inode_write_fill (call_frame_t *frame, xlator_t *this, int child_index, dict_t *xattr, dict_t *xdata) { afr_local_t *local = NULL; + afr_private_t *priv = NULL; local = frame->local; + priv = this->private; local->replies[child_index].valid = 1; + + if (AFR_IS_ARBITER_BRICK(priv, child_index) && op_ret == 1) + op_ret = iov_length (local->cont.writev.vector, + local->cont.writev.count); + local->replies[child_index].op_ret = op_ret; local->replies[child_index].op_errno = op_errno; @@ -325,6 +332,24 @@ unlock: return 0; } +static int +afr_arbiter_writev_wind (call_frame_t *frame, xlator_t *this, int subvol) +{ + afr_local_t *local = frame->local; + afr_private_t *priv = this->private; + static char byte = 0xFF; + static struct iovec vector = {&byte, 1}; + int32_t count = 1; + + STACK_WIND_COOKIE (frame, afr_writev_wind_cbk, (void *) (long) subvol, + priv->children[subvol], + priv->children[subvol]->fops->writev, + local->fd, &vector, count, local->cont.writev.offset, + local->cont.writev.flags, local->cont.writev.iobref, + local->xdata_req); + + return 0; +} int afr_writev_wind (call_frame_t *frame, xlator_t *this, int subvol) @@ -335,6 +360,11 @@ afr_writev_wind (call_frame_t *frame, xlator_t *this, int subvol) local = frame->local; priv = this->private; + if (AFR_IS_ARBITER_BRICK(priv, subvol)) { + afr_arbiter_writev_wind (frame, this, subvol); + return 0; + } + STACK_WIND_COOKIE (frame, afr_writev_wind_cbk, (void *) (long) subvol, priv->children[subvol], priv->children[subvol]->fops->writev, -- cgit