diff options
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-read.c | 4 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 14 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 1 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 6 |
4 files changed, 25 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 f435767f5e4..f962fb6494e 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -213,6 +213,8 @@ reconfigure (xlator_t *this, dict_t *options) GF_OPTION_RECONF ("quorum-reads", priv->quorum_reads, options, bool, out); + GF_OPTION_RECONF ("consistent-metadata", priv->consistent_metadata, + options, bool, out); priv->did_discovery = _gf_false; @@ -363,6 +365,8 @@ init (xlator_t *this) GF_OPTION_INIT ("heal-timeout", priv->shd.timeout, int32, out); GF_OPTION_INIT ("quorum-reads", priv->quorum_reads, bool, out); + GF_OPTION_INIT ("consistent-metadata", priv->consistent_metadata, bool, + out); priv->wait_count = 1; @@ -780,5 +784,15 @@ struct volume_options options[] = { .description = "time interval for checking the need to self-heal " "in self-heal-daemon" }, + { .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 dff70e89bb3..d7d15c69845 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -125,6 +125,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; diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index b0a3b0c8c39..891801fd755 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -517,6 +517,12 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = 3, .flags = OPT_FLAG_CLIENT_OPT }, + { .key = "cluster.consistent-metadata", + .voltype = "cluster/replicate", + .type = DOC, + .op_version = GD_OP_VERSION_3_7_0, + .flags = OPT_FLAG_CLIENT_OPT + }, /* Stripe xlator options */ { .key = "cluster.stripe-block-size", |