Blob Blame History Raw
From c96965f91adde2a59cea16b676a6632b332f68eb Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Mon, 10 Jul 2017 15:45:04 +0530
Subject: [PATCH 562/566] cluster/dht: Clear clean_dst flag on target change

If the target of a file migration was changed because
of min-free-disk limits, the dst_fd was closed but the
clean_dst flag was not set to false. If the file could
not be created on the new target for some reason, the
ftruncate call to clean up the dst was sent on the now
invalid fd causing the process to deadlock.

> BUG: 1469029
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-on: https://review.gluster.org/17735
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Amar Tumballi <amarts@redhat.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>

Change-Id: I5bfa80f519b04567413d84229cf62d143c6e2f04
BUG: 1469041
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/111944
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/cluster/dht/src/dht-rebalance.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 8f081c3..869c8b3 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1655,10 +1655,14 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
                 }
 
                 syncop_close (dst_fd);
+                dst_fd = NULL;
 
                 old_target = to;
                 to = new_target;
 
+                clean_dst = _gf_false;
+
+
                 /* if the file migration is successful to this new target, then
                  * update the xattr on the old destination to point the new
                  * destination. We need to do update this only post migration
@@ -1673,6 +1677,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
                 } else {
                         gf_msg (this->name, GF_LOG_INFO, 0, 0, "destination for file "
                                 "- %s is changed to - %s", loc->path, to->name);
+                        clean_dst = _gf_true;
                 }
         }
 
-- 
1.8.3.1