From 45a9d1e70e0d3e0ab504643a3cd1bf3f0a3a43fd Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Fri, 26 Apr 2013 11:39:15 +0530 Subject: distribute: Fix fds being leaked during rebalance This patch is a backport of 2 patches from master branch which fixes the leak of fds during a rebalance process. The patches are, * libglusterfs/syncop: do not hold ref on the fd in cbk (e979c0de9dde14fe18d0ad7298c6da9cc878bbab) * cluster/distribute: Remove suprious fd_unref call (5d29e598665456b2b7250fdca14de7409098877a) Change-Id: Icea1d0b32cb3670f7decc24261996bca3fe816dc BUG: 928631 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.org/4888 Reviewed-by: Vijay Bellur Tested-by: Gluster Build System --- xlators/cluster/dht/src/dht-helper.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index d866a2cd1..18a0d9de2 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -711,6 +711,9 @@ dht_migration_complete_check_task (void *data) src_node = local->cached_subvol; + if (!local->loc.inode && !local->fd) + goto out; + /* getxattr on cached_subvol for 'linkto' value */ if (!local->loc.inode) ret = syncop_fgetxattr (src_node, local->fd, &dict, @@ -803,9 +806,6 @@ dht_migration_complete_check_task (void *data) local->cached_subvol = dst_node; ret = 0; - if (!local->fd) - goto out; - /* once we detect the migration complete, the fd-ctx is no more required.. delete the ctx, and do one extra 'fd_unref' for open fd */ ret = fd_ctx_del (local->fd, this, NULL); @@ -838,8 +838,6 @@ dht_migration_complete_check_task (void *data) goto out; } - /* need this unref for the fd on src_node */ - fd_unref (local->fd); ret = 0; out: @@ -890,6 +888,9 @@ dht_rebalance_inprogress_task (void *data) src_node = local->cached_subvol; + if (!local->loc.inode && !local->fd) + goto out; + /* getxattr on cached_subvol for 'linkto' value */ if (local->loc.inode) ret = syncop_getxattr (src_node, &local->loc, &dict, @@ -938,9 +939,6 @@ dht_rebalance_inprogress_task (void *data) ret = 0; - if (!local->fd) - goto out; - if (local->loc.inode) { ret = syncop_open (dst_node, &local->loc, local->fd->flags, local->fd); -- cgit