From 233156d6fc1eabed41fcae6a877db3d66ff6f073 Mon Sep 17 00:00:00 2001 From: Richard Wareing Date: Wed, 18 Nov 2015 20:02:40 -0800 Subject: cluster/dht: Fix rebalance bug + better logging Summary: - Fixes edge case where lookup by gfid fails because it's not copied into the inode struct from the loc_t struct during the readdir loop - Improved logging for error conditions Test Plan: - Tested on dev server - Canaried build on Reviewers: dph, moox, sshreyas Reviewed By: sshreyas Differential Revision: https://phabricator.fb.com/D2676693 Tasks: 9034954 Change-Id: I7f0160b391c43fc38e679fdb660cee59d2267932 Signed-off-by: Jeff Darcy Reviewed-on: https://review.gluster.org/18040 Smoke: Gluster Build System Tested-by: Jeff Darcy CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/cluster/dht/src/dht-rebalance.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index ffd8bac9e4f..dc0b7dd619e 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1328,14 +1328,25 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, /* create the destination, with required modes/xattr */ ret = __dht_rebalance_create_dst_file (to, from, loc, &stbuf, &dst_fd, xattr); - if (ret) - goto out; + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_MIGRATE_FILE_FAILED, + "Migrate file failed: %s: " + "failed to create dest file on %s", + loc->path, to->name); + goto out; + } clean_dst = _gf_true; ret = __dht_check_free_space (to, from, loc, &stbuf, flag); if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_MIGRATE_FILE_FAILED, + "Migrate file failed: %s: " + "Disk space check failed on %s", + loc->path, to->name); goto out; } @@ -1345,7 +1356,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_MIGRATE_FILE_FAILED, - "Migrate file failed: failed to open %s on %s", + "Migrate file failed: %s: failed to open on %s", loc->path, from->name); goto out; } @@ -1360,7 +1371,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, if (ret) { gf_msg (this->name, GF_LOG_ERROR, -ret, DHT_MSG_MIGRATE_FILE_FAILED, - "Migrate file failed:failed to lookup %s on %s ", + "Migrate file failed: %s: failed to lookup %s ", loc->path, from->name); ret = -1; goto out; @@ -2427,6 +2438,9 @@ gf_defrag_get_entry (xlator_t *this, int i, struct dht_container **container, goto out; } + gf_uuid_copy (entry_loc.inode->gfid, + df_entry->d_stat.ia_gfid); + if (gf_uuid_is_null (df_entry->d_stat.ia_gfid)) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_GFID_NULL, -- cgit