diff options
author | Susant Palai <spalai@redhat.com> | 2017-07-27 16:33:12 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-08-03 14:13:07 +0000 |
commit | 6b1c044ea3046baf18c23dd75536fc2009e01af9 (patch) | |
tree | c18140dbc1c2790ba49ddf2c1c7378bef8864aae /xlators | |
parent | 196bbf161adee731f818aa998158ddf8f7ba58ee (diff) |
cluster/dht: Handle wrong rebalance status reporting
> Change-Id: Id91ef35f890055cd42b9a94462f92297c77f1fff
> Bug: 1475282
> Signed-off-by: Susant Palai <spalai@redhat.com>
> Reviewed-on: https://review.gluster.org/17868
> Tested-by: Raghavendra G <rgowdapp@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Signed-off-by: Susant Palai <spalai@redhat.com>
Change-Id: Id91ef35f890055cd42b9a94462f92297c77f1fff
Bug: 1477152
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: https://review.gluster.org/17943
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index d6718c55489..e20e392ceb0 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -872,7 +872,7 @@ static int __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc, struct iatt *stbuf, int flag, dht_conf_t *conf, gf_boolean_t *target_changed, xlator_t **new_subvol, - gf_boolean_t *ignore_failure, int *fop_errno) + int *fop_errno) { struct statvfs src_statfs = {0,}; struct statvfs dst_statfs = {0,}; @@ -882,7 +882,6 @@ __dht_check_free_space (xlator_t *this, xlator_t *to, xlator_t *from, loc_t *loc uint64_t src_statfs_blocks = 1; uint64_t dst_statfs_blocks = 1; double post_availspacepercent = 0; - int i = 0; xdata = dict_new (); if (!xdata) { @@ -1026,21 +1025,7 @@ find_new_subvol: " with space accomodating the file - %s. Consider adding " "bricks", loc->path); - /* For remove-brick case if the source is not one of the - * removed-brick, do not mark the error as failure */ - if (conf->decommission_subvols_cnt) { - *ignore_failure = _gf_true; - for (i = 0; i < conf->subvolume_cnt; i++) { - if (conf->decommissioned_bricks[i] == from) { - *ignore_failure = _gf_false; - break; - } - } - } else { - *ignore_failure = _gf_false; - } - - *target_changed = _gf_false; + *target_changed = _gf_false; *fop_errno = ENOSPC; ret = -1; goto out; @@ -1500,7 +1485,6 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, xlator_t *new_target = NULL; xlator_t *old_target = NULL; fd_t *linkto_fd = NULL; - gf_boolean_t ignore_failure = _gf_false; if (from == to) { @@ -1652,7 +1636,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, clean_dst = _gf_true; ret = __dht_check_free_space (this, to, from, loc, &stbuf, flag, conf, - &target_changed, &new_target, &ignore_failure, fop_errno); + &target_changed, &new_target, fop_errno); if (target_changed) { /* Can't handle for hardlinks. Marking this as failure */ if (flag == GF_DHT_MIGRATE_HARDLINK_IN_PROGRESS || stbuf.ia_nlink > 1) { @@ -1701,9 +1685,6 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, } if (ret) { - if (ignore_failure) - ret = 0; - goto out; } @@ -2528,6 +2509,8 @@ gf_defrag_migrate_single_file (void *opaque) gf_dht_migrate_data_type_t rebal_type = GF_DHT_MIGRATE_DATA; char value[MAX_REBAL_TYPE_SIZE] = {0,}; struct iatt *iatt_ptr = NULL; + gf_boolean_t update_skippedcount = _gf_true; + int i = 0; rebal_entry = (struct dht_container *)opaque; if (!rebal_entry) { @@ -2667,11 +2650,32 @@ gf_defrag_migrate_single_file (void *opaque) gf_msg_debug (this->name, 0, "migrate-data skipped for" " %s due to space constraints", entry_loc.path); - LOCK (&defrag->lock); - { - defrag->skipped += 1; + + /* For remove-brick case if the source is not one of the + * removed-brick, do not mark the error as failure */ + if (conf->decommission_subvols_cnt) { + for (i = 0; i < conf->subvolume_cnt; i++) { + if (conf->decommissioned_bricks[i] == cached_subvol) { + LOCK (&defrag->lock); + { + defrag->total_failures += 1; + update_skippedcount = _gf_false; + } + UNLOCK (&defrag->lock); + + break; + } + } } - UNLOCK (&defrag->lock); + + if (update_skippedcount) { + LOCK (&defrag->lock); + { + defrag->skipped += 1; + } + UNLOCK (&defrag->lock); + } + } else if (fop_errno == ENOTSUP) { gf_msg_debug (this->name, 0, "migrate-data skipped for" " hardlink %s ", entry_loc.path); @@ -2701,10 +2705,9 @@ gf_defrag_migrate_single_file (void *opaque) "migrate-data on %s failed:", entry_loc.path); } else if (ret == 1) { ret = 0; - goto out; - } else if (ret == -1) { - goto out; } + + goto out; } LOCK (&defrag->lock); |