summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-helpers.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-03-02 08:09:41 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-05 18:32:27 -0800
commit8fa36bc7a11968086e31ac32b9a24de07dd50d15 (patch)
tree0b6c15f4259083e74e432dc0d8f52ea6900d7042 /xlators/cluster/ec/src/ec-helpers.c
parent1a2c1e9bf8d711d821fbd166ed6d7f7d9bcce69d (diff)
cluster/ec: Allow heal on name less loc
loc->parent may not always be populated. Even in those cases, self-heal should happen if it can be completed using nameless loc. Change-Id: I8871fc811bec8b881ae7fb09dcd202c6693b9877 BUG: 1177601 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9717 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-helpers.c')
-rw-r--r--xlators/cluster/ec/src/ec-helpers.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c
index c580166ef00..783e3d475ce 100644
--- a/xlators/cluster/ec/src/ec-helpers.c
+++ b/xlators/cluster/ec/src/ec-helpers.c
@@ -335,7 +335,7 @@ int32_t ec_loc_setup_inode(xlator_t *xl, loc_t *loc)
} else if (loc->parent != NULL) {
if (!uuid_is_null(loc->gfid)) {
loc->inode = inode_find(loc->parent->table, loc->gfid);
- } else if (loc->path != NULL) {
+ } else if (loc->path && strchr (loc->path, '/')) {
loc->inode = inode_resolve(loc->parent->table, (char *)loc->path);
}
}
@@ -358,7 +358,7 @@ int32_t ec_loc_setup_parent(xlator_t *xl, loc_t *loc)
} else if (loc->inode != NULL) {
if (!uuid_is_null(loc->pargfid)) {
loc->parent = inode_find(loc->inode->table, loc->pargfid);
- } else if (loc->path != NULL) {
+ } else if (loc->path && strchr (loc->path, '/')) {
path = gf_strdup(loc->path);
if (path == NULL) {
gf_log(xl->name, GF_LOG_ERROR, "Unable to duplicate path '%s'",
@@ -387,10 +387,8 @@ int32_t ec_loc_setup_path(xlator_t *xl, loc_t *loc)
if (loc->path != NULL) {
name = strrchr(loc->path, '/');
if (name == NULL) {
- gf_log(xl->name, GF_LOG_ERROR, "Invalid path '%s' in loc",
- loc->path);
-
- goto out;
+ ret = 0; /*<gfid:gfid-str>*/
+ goto out;
}
if (name == loc->path) {
if (name[1] == 0) {
@@ -436,7 +434,7 @@ int32_t ec_loc_parent(xlator_t *xl, loc_t *loc, loc_t *parent)
if (!uuid_is_null(loc->pargfid)) {
uuid_copy(parent->gfid, loc->pargfid);
}
- if (loc->path != NULL) {
+ if (loc->path && strchr (loc->path, '/')) {
str = gf_strdup(loc->path);
if (str == NULL) {
gf_log(xl->name, GF_LOG_ERROR, "Unable to duplicate path '%s'",