summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-dir-read.c4
-rw-r--r--xlators/cluster/afr/src/afr.c16
-rw-r--r--xlators/cluster/afr/src/afr.h1
3 files changed, 21 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c
index 28bf89f2842..984ed9c6095 100644
--- a/xlators/cluster/afr/src/afr-dir-read.c
+++ b/xlators/cluster/afr/src/afr-dir-read.c
@@ -149,6 +149,10 @@ afr_validate_read_subvol (inode_t *inode, xlator_t *this, int par_read_subvol)
* either afr_data_subvol_get() or afr_metadata_subvol_get() would
* yield the same result. Hence, choosing afr_data_subvol_get() below.
*/
+
+ if (!priv->consistent_metadata)
+ return 0;
+
entry_read_subvol = afr_data_subvol_get (inode, this, 0, 0);
if (entry_read_subvol != par_read_subvol)
return -1;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 2c0ff05fd78..1382f266872 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -200,6 +200,9 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("iam-self-heal-daemon", priv->shd.iamshd, options,
bool, out);
+ GF_OPTION_RECONF ("consistent-metadata", priv->consistent_metadata,
+ options, bool, out);
+
priv->did_discovery = _gf_false;
ret = 0;
@@ -347,6 +350,9 @@ init (xlator_t *this)
GF_OPTION_INIT ("iam-self-heal-daemon", priv->shd.iamshd, bool, out);
+ GF_OPTION_INIT ("consistent-metadata", priv->consistent_metadata, bool,
+ out);
+
priv->wait_count = 1;
priv->child_up = GF_CALLOC (sizeof (unsigned char), child_count,
@@ -749,5 +755,15 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_BOOL,
.default_value = "off",
},
+ { .key = {"consistent-metadata"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "no",
+ .description = "If this option is enabled, readdirp will force "
+ "lookups on those entries read whose read child is "
+ "not the same as that of the parent. This will "
+ "guarantee that all read operations on a file serve "
+ "attributes from the same subvol as long as it holds "
+ " a good copy of the file/dir.",
+ },
{ .key = {NULL} },
};
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 4044fd59d4e..9448471752b 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -124,6 +124,7 @@ typedef struct _afr_private {
/* pump dependencies */
void *pump_private;
gf_boolean_t use_afr_in_pump;
+ gf_boolean_t consistent_metadata;
} afr_private_t;