summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c14
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c35
2 files changed, 46 insertions, 3 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);
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 354de84a2ba..e0928425c6a 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -42,18 +42,49 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = NULL;
int read_subvol = 0;
int i = 0;
+ afr_read_subvol_args_t args = {0,};
+ struct iatt *stbuf = NULL;
+ int ret = 0;
local = frame->local;
priv = this->private;
+ /*This code needs to stay till DHT sends fops on linked
+ * inodes*/
+ if (local->inode && !inode_is_linked (local->inode)) {
+ for (i = 0; i < priv->child_count; i++) {
+ if (!local->replies[i].valid)
+ continue;
+ if (local->replies[i].op_ret == -1)
+ continue;
+ if (!gf_uuid_is_null
+ (local->replies[i].poststat.ia_gfid)) {
+ gf_uuid_copy (args.gfid,
+ local->replies[i].poststat.ia_gfid);
+ args.ia_type =
+ local->replies[i].poststat.ia_type;
+ break;
+ } else {
+ ret = dict_get_bin (local->replies[i].xdata,
+ DHT_IATT_IN_XDATA_KEY,
+ (void **) &stbuf);
+ if (ret)
+ continue;
+ gf_uuid_copy (args.gfid, stbuf->ia_gfid);
+ args.ia_type = stbuf->ia_type;
+ break;
+ }
+ }
+ }
+
if (local->inode) {
if (local->transaction.type == AFR_METADATA_TRANSACTION)
read_subvol = afr_metadata_subvol_get (local->inode, this,
NULL, NULL,
- NULL);
+ &args);
else
read_subvol = afr_data_subvol_get (local->inode, this,
- NULL, NULL, NULL);
+ NULL, NULL, &args);
}
local->op_ret = -1;