summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-08-16 16:04:37 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-22 13:55:42 -0700
commit413594ed647400f1b39e05d4f1b12ad846e48800 (patch)
treefd7072bc983754156eb66ff2348c7ac99773c9e2 /xlators/cluster/afr/src/afr.c
parenteddada59f7ad3cf21463a558a5f62591f4b72c68 (diff)
cluster/afr: Give option to do consistent-io
Problem: When tiering/rebalance does migrations and afr with 2-way replica is in picture, migration can read stale data if the source brick goes down and writes to the destination. After this deletion of the file leads to permanent loss of data after migration. Fix: Rebalance/tiering should migrate only when the data is definitely not stale. So introduce an option in afr called consistent-io which will be enabled in migration daemons. BUG: 1306398 Change-Id: I750f65091cc70a3ed4bf3c12f83d0949af43920a Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/13425 Reviewed-by: Anuradha Talur <atalur@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index da62564e93a..48beaf24a6e 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -132,6 +132,7 @@ reconfigure (xlator_t *this, dict_t *options)
int index = -1;
char *qtype = NULL;
char *fav_child_policy = NULL;
+ gf_boolean_t consistent_io = _gf_false;
priv = this->private;
@@ -258,6 +259,11 @@ reconfigure (xlator_t *this, dict_t *options)
priv->did_discovery = _gf_false;
+ GF_OPTION_RECONF ("consistent-io", consistent_io, options, bool, out);
+ if (priv->quorum_count != 0)
+ consistent_io = _gf_false;
+ priv->consistent_io = consistent_io;
+
ret = 0;
out:
return ret;
@@ -494,6 +500,10 @@ init (xlator_t *this)
GF_OPTION_INIT ("quorum-reads", priv->quorum_reads, bool, out);
GF_OPTION_INIT ("consistent-metadata", priv->consistent_metadata, bool,
out);
+ GF_OPTION_INIT ("consistent-io", priv->consistent_io, bool, out);
+
+ if (priv->quorum_count != 0)
+ priv->consistent_io = _gf_false;
priv->wait_count = 1;
@@ -594,14 +604,11 @@ fini (xlator_t *this)
struct xlator_fops fops = {
.lookup = afr_lookup,
- .open = afr_open,
.lk = afr_lk,
.flush = afr_flush,
.statfs = afr_statfs,
.fsync = afr_fsync,
.fsyncdir = afr_fsyncdir,
- .xattrop = afr_xattrop,
- .fxattrop = afr_fxattrop,
.inodelk = afr_inodelk,
.finodelk = afr_finodelk,
.entrylk = afr_entrylk,
@@ -629,9 +636,14 @@ struct xlator_fops fops = {
.fallocate = afr_fallocate,
.discard = afr_discard,
.zerofill = afr_zerofill,
+ .xattrop = afr_xattrop,
+ .fxattrop = afr_fxattrop,
- /* dir read */
+ /*inode open*/
.opendir = afr_opendir,
+ .open = afr_open,
+
+ /* dir read */
.readdir = afr_readdir,
.readdirp = afr_readdirp,
@@ -986,5 +998,11 @@ struct volume_options options[] = {
" with identical mtime and size in more than half the "
"number of bricks in the replica.",
},
+ { .key = {"consistent-io"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "no",
+ .description = "If this option is enabled, i/o will fail even if "
+ "one of the bricks is down in the replicas",
+ },
{ .key = {NULL} },
};