summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-12-15 13:32:29 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-21 05:20:10 -0800
commit9691ea1b203c82386ececc3c5ea9adad39304d7b (patch)
tree7ff749ddec5d09b1c607de591b037be04d59a1a7 /xlators/cluster/dht/src
parentb0e126d0edf10946701c2fd4f0f1cf8c7b07eda1 (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. 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>
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c11
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 78cccc02c48..08dbae0547a 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -545,6 +545,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),
@@ -604,9 +606,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;
@@ -881,6 +880,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)
@@ -926,9 +928,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: