From a96c7e748fccfa796a712b6aac92206212915cdc Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Fri, 9 Mar 2018 13:03:40 +0530 Subject: cluster/dht: Skipped files are not treated as errors For skipped files, use a return value of 1 to prevent error messages being logged. Change-Id: I18de31ac1a64d4460e88dea7826c3ba03c895861 BUG: 1553598 Signed-off-by: N Balachandran --- xlators/cluster/dht/src/dht-rebalance.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'xlators/cluster/dht') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 790aef7f482..c11ae58621e 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -41,6 +41,7 @@ uint64_t g_totalfiles = 0; uint64_t g_totalsize = 0; + void gf_defrag_free_dir_dfmeta (struct dir_dfmeta *meta, int local_subvols_cnt) { @@ -602,7 +603,7 @@ __check_file_has_hardlink (xlator_t *this, loc_t *loc, "Migration skipped for:" "%s: file has hardlinks", loc->path); *fop_errno = ENOTSUP; - ret = -1; + ret = 1; } } @@ -657,7 +658,7 @@ __is_file_migratable (xlator_t *this, loc_t *loc, "Migrate file failed: %s: File has locks." " Skipping file migration", loc->path); *fop_errno = ENOTSUP; - ret = -1; + ret = 1; goto out; } } @@ -1054,7 +1055,7 @@ __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, /* this is not a 'failure', but we don't want to consider this as 'success' too :-/ */ *fop_errno = ENOSPC; - ret = -1; + ret = 1; goto out; } } @@ -2537,10 +2538,7 @@ gf_defrag_handle_migrate_error (int32_t op_errno, gf_defrag_info_t *defrag) } if (op_errno == ENOSPC) { - /* rebalance process itself failed, may be - remote brick went down, or write failed due to - disk full etc etc.. */ - ret = 0; + ret = -1; } out: @@ -2811,7 +2809,7 @@ gf_defrag_migrate_single_file (void *opaque) ret = dht_migrate_file (this, &entry_loc, cached_subvol, hashed_subvol, rebal_type, &fop_errno); - if (ret < 0) { + if (ret == 1) { if (fop_errno == ENOSPC) { gf_msg_debug (this->name, 0, "migrate-data skipped for" " %s due to space constraints", @@ -2860,8 +2858,12 @@ gf_defrag_migrate_single_file (void *opaque) DHT_MSG_MIGRATE_FILE_SKIPPED, "File migration skipped for %s.", entry_loc.path); + } + + ret = 0; - } else if (fop_errno != EEXIST) { + } else if (ret < 0) { + if (fop_errno != EEXIST) { gf_msg (this->name, GF_LOG_ERROR, fop_errno, DHT_MSG_MIGRATE_FILE_FAILED, "migrate-data failed for %s", entry_loc.path); -- cgit