summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-02-14 22:40:34 +0530
committerVijay Bellur <vijay@gluster.com>2012-02-20 21:23:21 -0800
commit5f117a4a1fca3ec2d163fe77615cf6859c0450e4 (patch)
tree695913cadfb8d8fdacd240bf5e84dcb78a0cfdbc /xlators/cluster/afr/src/afr-self-heal-common.c
parent8456c28af75a4083286fc6ceadc03f2703f4c9b6 (diff)
cluster/afr: Self-heald, Index integration
Change-Id: Ic68eb00b356a6ee3cb88fe2bde50374be7a64ba3 BUG: 763820 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2749 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 8fbea8c9d09..36a1e04c9bc 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -2224,13 +2224,21 @@ afr_self_heal_type_for_transaction (afr_transaction_type type)
}
int
-afr_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name, uuid_t gfid)
+afr_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name)
{
int ret = -1;
+ uuid_t pargfid = {0};
- if (!child) {
+ if (!child)
+ goto out;
+
+ if (!uuid_is_null (parent->inode->gfid))
+ uuid_copy (pargfid, parent->inode->gfid);
+ else if (!uuid_is_null (parent->gfid))
+ uuid_copy (pargfid, parent->gfid);
+
+ if (uuid_is_null (pargfid))
goto out;
- }
if (strcmp (parent->path, "/") == 0)
ret = gf_asprintf ((char **)&child->path, "/%s", name);
@@ -2243,26 +2251,22 @@ afr_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name, uu
"asprintf failed while setting child path");
}
- if (!child->path) {
- goto out;
- }
-
child->name = strrchr (child->path, '/');
if (child->name)
child->name++;
child->parent = inode_ref (parent->inode);
child->inode = inode_new (parent->inode->table);
+ uuid_copy (child->pargfid, pargfid);
if (!child->inode) {
ret = -1;
goto out;
}
- uuid_copy (child->gfid, gfid);
ret = 0;
out:
- if (ret == -1)
+ if ((ret == -1) && child)
loc_wipe (child);
return ret;