| Submitter | Pranith K |
|---|---|
| Date | 2010-09-29 04:58:28 |
| Message ID | <20100929045828.GA4243@dev.gluster.com> |
| Download | mbox | patch |
| Permalink | /patch/5058/ |
| State | Accepted |
| Headers | show |
Comments
Reviewed OK. Regards, Vijay On Wednesday 29 September 2010 10:28 AM, Pranith Kumar K wrote: > > Signed-off-by: Pranith Kumar K<pranithk@gluster.com> > --- > xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++++--- > 1 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c > index 71f23a8..d1d45a7 100644 > --- a/xlators/mgmt/glusterd/src/glusterd-utils.c > +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c > @@ -651,6 +651,7 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, > char *dup_brick = NULL; > char *free_ptr = NULL; > glusterd_brickinfo_t *tmp = NULL; > + uuid_t uuid = {0}; > > GF_ASSERT (brick); > GF_ASSERT (brickinfo); > @@ -679,18 +680,20 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, > goto out; > } > > + ret = glusterd_hostname_to_uuid (hostname, uuid); > + if (ret) > + goto out; > list_for_each_entry (tmp,&volinfo->bricks, brick_list) { > > - if ((!strcmp (tmp->hostname, hostname))&& > + if ((!uuid_compare (uuid, tmp->uuid))&& > !strcmp (tmp->path, path)) { > gf_log ("", GF_LOG_NORMAL, "Found brick"); > ret = 0; > + *brickinfo = tmp; > break; > } > } > > - *brickinfo = tmp; > - > out: > if (free_ptr) > GF_FREE (free_ptr); >
Patch
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 71f23a8..d1d45a7 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -651,6 +651,7 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, char *dup_brick = NULL; char *free_ptr = NULL; glusterd_brickinfo_t *tmp = NULL; + uuid_t uuid = {0}; GF_ASSERT (brick); GF_ASSERT (brickinfo); @@ -679,18 +680,20 @@ glusterd_brickinfo_get (char *brick, glusterd_volinfo_t *volinfo, goto out; } + ret = glusterd_hostname_to_uuid (hostname, uuid); + if (ret) + goto out; list_for_each_entry (tmp, &volinfo->bricks, brick_list) { - if ((!strcmp (tmp->hostname, hostname)) && + if ((!uuid_compare (uuid, tmp->uuid)) && !strcmp (tmp->path, path)) { gf_log ("", GF_LOG_NORMAL, "Found brick"); ret = 0; + *brickinfo = tmp; break; } } - *brickinfo = tmp; - out: if (free_ptr) GF_FREE (free_ptr);
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> --- xlators/mgmt/glusterd/src/glusterd-utils.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)