summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-dir-write.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-03-25 06:04:23 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-03-28 05:13:41 -0700
commit2d0c2a9e15a581950a966841866f1f18a8888440 (patch)
tree6c5f77605f568c42ec6177fbbc6855581dc8ebac /xlators/cluster/afr/src/afr-dir-write.c
parent06d50c1c00fe35c6bc2192a392b8a749984f3efc (diff)
cluster/afr: Fix read-child selection in entry create fop
When an entry is being created the inode is yet to be linked so args must be filled with gfid and ia_type for it to give consistent iatt. Also handle Dht sending fops on inode not yet linked. BUG: 1302948 Change-Id: I6969cacb437cad02f66716f3bf8ec004ffe7c691 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/13827 Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anuradha Talur <atalur@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-write.c')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 741a07ad9c0..b6b81d737b0 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -83,15 +83,27 @@ __afr_dir_write_finalize (call_frame_t *frame, xlator_t *this)
int parent_read_subvol = -1;
int parent2_read_subvol = -1;
int i = 0;
+ afr_read_subvol_args_t args = {0,};
local = frame->local;
priv = this->private;
+ for (i = 0; i < priv->child_count; i++) {
+ if (!local->replies[i].valid)
+ continue;
+ if (local->replies[i].op_ret == -1)
+ continue;
+ gf_uuid_copy (args.gfid, local->replies[i].poststat.ia_gfid);
+ args.ia_type = local->replies[i].poststat.ia_type;
+ break;
+ }
+
if (local->inode) {
afr_replies_interpret (frame, this, local->inode, NULL);
inode_read_subvol = afr_data_subvol_get (local->inode, this,
- NULL, NULL, NULL);
+ NULL, NULL, &args);
}
+
if (local->parent)
parent_read_subvol = afr_data_subvol_get (local->parent, this,
NULL, NULL, NULL);