summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-rebalance.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/dht-rebalance.c')
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 89cc3a82f0b..39c1647d364 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -1545,6 +1545,7 @@ gf_defrag_migrate_single_file (void *opaque)
struct timeval end = {0,};
double elapsed = {0,};
struct dht_container *rebal_entry = NULL;
+ inode_t *inode = NULL;
rebal_entry = (struct dht_container *)opaque;
if (!rebal_entry) {
@@ -1602,8 +1603,6 @@ gf_defrag_migrate_single_file (void *opaque)
gf_uuid_copy (entry_loc.pargfid, loc->gfid);
- entry_loc.inode->ia_type = entry->d_stat.ia_type;
-
ret = syncop_lookup (this, &entry_loc, &iatt, NULL, NULL, NULL);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -1614,6 +1613,11 @@ gf_defrag_migrate_single_file (void *opaque)
goto out;
}
+ inode = inode_link (entry_loc.inode, entry_loc.parent, entry->d_name, &iatt);
+ inode_unref (entry_loc.inode);
+ /* use the inode returned by inode_link */
+ entry_loc.inode = inode;
+
ret = syncop_setxattr (this, &entry_loc, migrate_data, 0, NULL, NULL);
if (ret < 0) {
op_errno = -ret;