summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-inode-write.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2015-09-03 09:49:56 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-09-07 19:13:42 -0700
commit55a493f4db6752303ad2a88572e4d75453054bce (patch)
treef3e34733f2d635c20d2079353f75797fbfef63e1 /xlators/cluster/afr/src/afr-inode-write.c
parentda882973235c7d2fc2ad20c030dadd327366a58c (diff)
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 <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/12095 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anuradha Talur <atalur@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-inode-write.c')
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c30
1 files changed, 30 insertions, 0 deletions
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,