diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c index 344a657..22af9ee 100644 --- a/xlators/cluster/dht/src/switch.c +++ b/xlators/cluster/dht/src/switch.c @@ -75,7 +75,6 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, { struct switch_struct *cond = NULL; struct switch_struct *trav = NULL; - char *pathname = NULL; int idx = 0; cond = conf->private; @@ -83,10 +82,9 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, return hashed_subvol; trav = cond; - pathname = gf_strdup (path); while (trav) { if (fnmatch (trav->path_pattern, - pathname, FNM_NOESCAPE) == 0) { + path, FNM_NOESCAPE) == 0) { for (idx = 0; idx < trav->num_child; idx++) { if (trav->array[idx].xl == hashed_subvol) return hashed_subvol; @@ -97,7 +95,7 @@ get_switch_matching_subvol (const char *path, dht_conf_t *conf, } trav = trav->next; } - GF_FREE (pathname); + return hashed_subvol; } @@ -469,6 +467,7 @@ switch_create (call_frame_t *frame, xlator_t *this, goto err; } + local->params = dict_ref (params); local->fd = fd_ref (fd); local->mode = mode; local->flags = flags; @@ -732,6 +731,7 @@ set_switch_pattern (xlator_t *this, dht_conf_t *conf, if (childs) { dup_childs = gf_strdup (childs); child = strtok_r (dup_childs, ",", &tmp); + idx=0; while (child) { if (gf_switch_valid_child (this, child)) { idx++;