From 10e091508ca6e5af815fce612be48287d354a01b Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Mon, 29 Feb 2016 05:16:50 +0000 Subject: afr: do not set arbiter as a readable subvol in inode context Problem: If afr_lookup_done() or afr_read_subvol_select_by_policy() chooses the arbiter brick to serve the stat() data, file size will be reported as zero from the mount, despite other data bricks being available. This can break programs like tar which use the stat info to decide how much to read. Fix: In the inode-context, mark arbiter as a non-readable subvol for both data and metadata. It it to be noted that by making this fix, we are *not* going to serve metadata FOPS anymore from the arbiter brick despite the brick storing the metadata. It makes sense to do this because the ever increasing over-loaded FOPs (getxattr returning stat data etc.) and compound FOPS in gluster will otherwise make it difficult to add checks in code to handle corner cases. >Change-Id: Ic60b25d77fd05e0897481b7fcb3716d4f2101001 >BUG: 1310171 >Signed-off-by: Ravishankar N >Reported-by: Mat Clayton >Reviewed-on: http://review.gluster.org/13539 >Reviewed-by: Anuradha Talur >Reviewed-by: Krutika Dhananjay >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Jeff Darcy BUG: 1313921 Change-Id: I07fc08d633ca2af48f7354454bc2ab75cedb850a Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/13609 Reviewed-by: Pranith Kumar Karampuri Tested-by: Pranith Kumar Karampuri Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- xlators/cluster/afr/src/afr-common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 36c22ad7dc0..bfff6048799 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -695,6 +695,10 @@ afr_replies_interpret (call_frame_t *frame, xlator_t *this, inode_t *inode) data_readable[i] = 1; metadata_readable[i] = 1; } + if (AFR_IS_ARBITER_BRICK (priv, ARBITER_BRICK_INDEX)) { + data_readable[ARBITER_BRICK_INDEX] = 0; + metadata_readable[ARBITER_BRICK_INDEX] = 0; + } for (i = 0; i < priv->child_count; i++) { if (!replies[i].valid) { @@ -1792,9 +1796,14 @@ unwind: read_subvol = spb_choice; else read_subvol = afr_first_up_child (frame, this); + } par_read_subvol = afr_get_parent_read_subvol (this, parent, replies, readable); + if (AFR_IS_ARBITER_BRICK (priv, read_subvol) && local->op_ret == 0) { + local->op_ret = -1; + local->op_errno = ENOTCONN; + } AFR_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno, local->inode, &local->replies[read_subvol].poststat, @@ -2241,6 +2250,10 @@ unwind: else read_subvol = afr_first_up_child (frame, this); } + if (AFR_IS_ARBITER_BRICK (priv, read_subvol) && local->op_ret == 0) { + local->op_ret = -1; + local->op_errno = ENOTCONN; + } AFR_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno, local->inode, &local->replies[read_subvol].poststat, -- cgit