From a9bb3dcb1d22c5bfb527b9b85ad238b0137d3282 Mon Sep 17 00:00:00 2001 From: Dan Lambright Date: Wed, 16 Sep 2015 10:26:44 -0400 Subject: cluster/tier do not flag migration error on already migrated file In some cases a brick will try to migrate a file that has already been migrated. This is a legal case, e.g. when both bricks are replica pairs. Change-Id: If2578b947014cbbdfb3c6591db9044d6b1d92774 BUG: 1263726 Signed-off-by: Dan Lambright Reviewed-on: http://review.gluster.org/12185 Tested-by: NetBSD Build System Reviewed-by: Joseph Fernandes Tested-by: Gluster Build System --- xlators/cluster/dht/src/tier.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index a6199173688..aa968b6f352 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -253,7 +253,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, "failed parsing %s\n", link_str); per_link_status = -1; - goto error; + goto abort; } gf_uuid_copy (p_loc.gfid, link_info->pargfid); @@ -264,7 +264,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, "failed parsing %s\n", link_str); per_link_status = -1; - goto error; + goto abort; } ret = syncop_lookup (this, &p_loc, &par_stbuf, NULL, @@ -274,7 +274,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, " ERROR in parent lookup\n"); per_link_status = -1; - goto error; + goto abort; } linked_inode = inode_link (p_loc.inode, NULL, NULL, &par_stbuf); @@ -292,7 +292,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, "ERROR in " "memory allocation\n"); per_link_status = -1; - goto error; + goto abort; } loc.path = gf_strdup (link_info->file_path); @@ -301,7 +301,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, "ERROR in " "memory allocation\n"); per_link_status = -1; - goto error; + goto abort; } gf_uuid_copy (loc.parent->gfid, link_info->pargfid); @@ -313,7 +313,7 @@ tier_migrate_using_query_file (void *_args) DHT_MSG_LOG_TIER_ERROR, "ERROR in " "current lookup\n"); per_link_status = -1; - goto error; + goto abort; } linked_inode = inode_link (loc.inode, NULL, NULL, ¤t); @@ -322,20 +322,19 @@ tier_migrate_using_query_file (void *_args) /* * Do not promote/demote if file already is where it - * should be. This shall become a skipped count. + * should be. It means another brick moved the file + * so is not an error. */ src_subvol = dht_subvol_get_cached(this, loc.inode); if (query_cbk_args->is_promotion && src_subvol == conf->subvolumes[1]) { - per_link_status = -1; - goto error; + goto abort; } if (!query_cbk_args->is_promotion && src_subvol == conf->subvolumes[0]) { - per_link_status = -1; - goto error; + goto abort; } gf_msg (this->name, GF_LOG_INFO, 0, @@ -347,7 +346,7 @@ tier_migrate_using_query_file (void *_args) if (tier_check_same_node (this, &loc, defrag)) { per_link_status = -1; - goto error; + goto abort; } gf_uuid_copy (loc.gfid, loc.inode->gfid); @@ -361,15 +360,14 @@ tier_migrate_using_query_file (void *_args) loc.name, loc.path); per_link_status = -1; - goto error; + goto abort; } if (query_cbk_args->is_promotion) defrag->total_files_promoted++; else defrag->total_files_demoted++; - -error: +abort: loc_wipe(&loc); loc_wipe(&p_loc); -- cgit