diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-12-15 13:32:29 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-22 21:14:08 -0800 |
commit | 9a198ccd65c067e5269cbdfef0b8fab7073bc212 (patch) | |
tree | c17bd83227702393b2fbf23a2ab6c9103a9d53a1 | |
parent | 85d34ea0cf8b687c10093ae06417e498e252e563 (diff) |
tier/dht : Properly free file descriptors during data migration
While tier migration, free src and dst fd's when create of
destination or open of source fails.
Backport of http://review.gluster.org/12969
> Change-Id: I62978a669c6c9fbab5fed9df2716b9b2ba00ddf1
> BUG: 1291566
> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
> Reviewed-on: http://review.gluster.org/12969
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
> Tested-by: Dan Lambright <dlambrig@redhat.com>
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Change-Id: I4d745076b3258a64584778ba88dd665ddd907d27
BUG: 1293348
Reviewed-on: http://review.gluster.org/13046
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 239ac26fe24..ce607011dae 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -548,6 +548,8 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc fd_bind (fd); + if (dst_fd) + *dst_fd = fd; /*Reason of doing lookup after create again: *In the create, there is some time-gap between opening fd at the *server (posix_layer) and binding it in server (incrementing fd count), @@ -607,9 +609,6 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc "chown failed for %s on %s (%s)", loc->path, to->name, strerror (-ret)); - if (dst_fd) - *dst_fd = fd; - /* success */ ret = 0; @@ -884,6 +883,9 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc, } fd_bind (fd); + if (src_fd) + *src_fd = fd; + ret = -1; dict = dict_new (); if (!dict) @@ -929,9 +931,6 @@ __dht_rebalance_open_src_file (xlator_t *from, xlator_t *to, loc_t *loc, goto out; } - if (src_fd) - *src_fd = fd; - /* success */ ret = 0; out: |