summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-diskusage.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2015-06-16 20:35:46 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-08-23 23:06:31 -0700
commit1626fb105c99ef623be3687f3f48d9247ab9b7c4 (patch)
treecda2fc88f521eaf69041ca7a8d343dad02f7c87c /xlators/cluster/dht/src/dht-diskusage.c
parenta586b30c1bd968d23562406cefbb76b82a0e236c (diff)
dht: block/handle create op falling to decommissioned brick
Problem: Post remove-brick start till commit phase, the client layout may not be in sync with disk layout because of lack of lookup. Hence,a create call may fall on the decommissioned brick. Solution: Will acquire a lock on hashed subvol. So that a fix-layout or selfheal can not step on layout while reading the layout. Even if we read a layout before remove-brick fix-layout and the file falls on the decommissioned brick, the file should be migrated to a new brick as per the fix-layout. Change-Id: If84a12ec34f981adb2b9b224e80f535cfe5bf9f2 BUG: 1232378 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/11260 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-diskusage.c')
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index 9ebf6bf8732..b85c78a540b 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -334,7 +334,8 @@ out:
}
static inline
-int32_t dht_subvol_has_err (xlator_t *this, dht_layout_t *layout)
+int32_t dht_subvol_has_err (dht_conf_t *conf, xlator_t *this,
+ dht_layout_t *layout)
{
int ret = -1;
int i = 0;
@@ -350,6 +351,17 @@ int32_t dht_subvol_has_err (xlator_t *this, dht_layout_t *layout)
goto out;
}
}
+
+ /* discard decommissioned subvol */
+ if (conf->decommission_subvols_cnt) {
+ for (i = 0; i < conf->subvolume_cnt; i++) {
+ if (conf->decommissioned_bricks[i] &&
+ conf->decommissioned_bricks[i] == this)
+ ret = -1;
+ goto out;
+ }
+ }
+
ret = 0;
out:
return ret;
@@ -371,8 +383,9 @@ dht_subvol_with_free_space_inodes(xlator_t *this, xlator_t *subvol,
conf = this->private;
for(i=0; i < conf->subvolume_cnt; i++) {
- /* check if subvol has layout errors, before selecting it */
- ignore_subvol = dht_subvol_has_err (conf->subvolumes[i],
+ /* check if subvol has layout errors and also it is not a
+ * decommissioned brick, before selecting it */
+ ignore_subvol = dht_subvol_has_err (conf, conf->subvolumes[i],
layout);
if (ignore_subvol)
continue;
@@ -419,8 +432,10 @@ dht_subvol_maxspace_nonzeroinode (xlator_t *this, xlator_t *subvol,
conf = this->private;
for (i = 0; i < conf->subvolume_cnt; i++) {
- /* check if subvol has layout errors, before selecting it */
- ignore_subvol = dht_subvol_has_err (conf->subvolumes[i],
+ /* check if subvol has layout errors and also it is not a
+ * decommissioned brick, before selecting it*/
+
+ ignore_subvol = dht_subvol_has_err (conf, conf->subvolumes[i],
layout);
if (ignore_subvol)
continue;