From 5f117a4a1fca3ec2d163fe77615cf6859c0450e4 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 14 Feb 2012 22:40:34 +0530 Subject: cluster/afr: Self-heald, Index integration Change-Id: Ic68eb00b356a6ee3cb88fe2bde50374be7a64ba3 BUG: 763820 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2749 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heal-common.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c') 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; -- cgit