From 79103a0f9eea2af4c68710e602f78963471ecec7 Mon Sep 17 00:00:00 2001 From: N Balachandran Date: Mon, 9 Nov 2015 15:49:50 +0530 Subject: cluster/tier: Do not delete linkto file on demotion The current DHT migration code will always delete the src linkto file after migration as dht always moves files to the hashed subvol. This is not the case in tiering. The lack of linkto files causes rename to fail leaving 2 files with the same name but different gfids on the volume. Modified to leave the linkto file behind if the source volume is the hashed subvolume. > Change-Id: I2b99f7d34b4b719aee6232dc40c6a8f8ba88225d > Signed-off-by: N Balachandran > Reviewed-on: http://review.gluster.org/12551 > Reviewed-by: Dan Lambright > Tested-by: Dan Lambright Change-Id: I210b94cdae0409c87af8ba198e3cd263a6c85190 BUG: 1283480 Signed-off-by: N Balachandran Reviewed-on: http://review.gluster.org/12655 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Dan Lambright Tested-by: Dan Lambright --- xlators/cluster/dht/src/dht-rebalance.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/dht/src/dht-rebalance.c') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index f1b0ecfeef0..027e74ac9f4 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -14,6 +14,7 @@ #include "config.h" #endif +#include "tier.h" #include "dht-common.h" #include "xlator.h" #include @@ -1180,6 +1181,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, gf_boolean_t clean_src = _gf_false; gf_boolean_t clean_dst = _gf_false; int log_level = GF_LOG_INFO; + gf_boolean_t delete_src_linkto = _gf_true; defrag = conf->defrag; if (!defrag) @@ -1466,9 +1468,11 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, /* store size of previous migrated file */ if (defrag->tier_conf.is_tier) { - if (from == conf->subvolumes[0]) { + if (from != TIER_HASHED_SUBVOL) { defrag->tier_conf.st_last_promoted_size = stbuf.ia_size; } else { + /* Don't delete the linkto file on the hashed subvol */ + delete_src_linkto = _gf_false; defrag->tier_conf.st_last_demoted_size = stbuf.ia_size; } } @@ -1535,8 +1539,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, rcvd_enoent_from_src = 1; } + if ((gf_uuid_compare (empty_iatt.ia_gfid, loc->gfid) == 0 ) && - (!rcvd_enoent_from_src)) { + (!rcvd_enoent_from_src) && delete_src_linkto) { /* take out the source from namespace */ ret = syncop_unlink (from, loc, NULL, NULL); if (ret) { -- cgit