From 2f218e1335d5fdab0b41716cc5c8976b20c367f6 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 22 Nov 2013 12:09:53 +0530 Subject: cluster/dht: Handle Link-info getxattr failure in rebalance When getxattr fails with errno other than ENODATA fail rebalance on that file. Log the reason for error. Change-Id: Ia519870b88e6e6dd464d1c0415411aa999f80bc9 BUG: 1032927 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/6341 Tested-by: Gluster Build System Reviewed-by: Shishir Gowda Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Vijay Bellur --- xlators/cluster/dht/src/dht-rebalance.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 99d92459c..c123a4425 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -1128,6 +1128,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, double elapsed = {0,}; struct timeval start = {0,}; int32_t err = 0; + int loglevel = GF_LOG_TRACE; gf_log (this->name, GF_LOG_INFO, "migrate data called on %s", loc->path); @@ -1268,17 +1269,24 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, /* if distribute is present, it will honor this key. - * -1 is returned if distribute is not present or file - * doesn't have a link-file. If file has link-file, the - * path of link-file will be the value, and also that - * guarantees that file has to be mostly migrated */ + * -1, ENODATA is returned if distribute is not present + * or file doesn't have a link-file. If file has + * link-file, the path of link-file will be the value, + * and also that guarantees that file has to be mostly + * migrated */ ret = syncop_getxattr (this, &entry_loc, &dict, GF_XATTR_LINKINFO_KEY); if (ret < 0) { - gf_log (this->name, GF_LOG_TRACE, "failed to " - "get link-to key for %s", - entry_loc.path); + if (errno != ENODATA) { + loglevel = GF_LOG_ERROR; + defrag->total_failures += 1; + } else { + loglevel = GF_LOG_TRACE; + } + gf_log (this->name, loglevel, "%s: failed to " + "get "GF_XATTR_LINKINFO_KEY" key - %s", + entry_loc.path, strerror (errno)); continue; } -- cgit