diff options
author | Vikas Gorur <vikas@gluster.com> | 2010-03-01 17:47:06 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-03-04 02:04:00 -0800 |
commit | 85a1716cd55b002b5d20a7903e28f106ee614814 (patch) | |
tree | 757c6364de8e58fd9af7e8ecade3eb18f7466806 /xlators/cluster/afr/src/afr.c | |
parent | 2970ec54473fd55b27aeeb43a1f6bca879281cf0 (diff) |
cluster/afr: Failover readdir calls.
This patch makes the replicate readdir call fail over to the next
subvolume if the first call fails. It takes care to ensure that
entries are not duplicated.
The failover behavior of readdir only comes into effect if
the option 'strict-readdir' is on.
Signed-off-by: Vikas Gorur <vikas@dev.gluster.com>
Signed-off-by: root <root@client02.(none)>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 453 (afr_readdir does not fail over)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=453
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 91189267fe7..c041adc99e0 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -1128,6 +1128,8 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd) if (ret < 0) { op_ret = ret; } + + INIT_LIST_HEAD (&fd_ctx->entries); } unlock: UNLOCK (&fd->lock); @@ -2693,11 +2695,12 @@ init (xlator_t *this) int ret = -1; int op_errno = 0; - char * read_subvol = NULL; - char * fav_child = NULL; - char * self_heal = NULL; - char * algo = NULL; - char * change_log = NULL; + char * read_subvol = NULL; + char * fav_child = NULL; + char * self_heal = NULL; + char * algo = NULL; + char * change_log = NULL; + char * strict_readdir = NULL; int32_t background_count = 0; int32_t lock_server_count = 1; @@ -2893,6 +2896,20 @@ init (xlator_t *this) priv->entry_lock_server_count = lock_server_count; } + priv->strict_readdir = _gf_false; + + dict_ret = dict_get_str (this->options, "strict-readdir", + &strict_readdir); + if (dict_ret == 0) { + ret = gf_string2boolean (strict_readdir, &priv->strict_readdir); + if (ret < 0) { + gf_log (this->name, GF_LOG_WARNING, + "Invalid 'option strict-readdir %s'. " + "Defaulting to strict-readdir as 'off'.", + strict_readdir); + } + } + trav = this->children; while (trav) { if (!read_ret && !strcmp (read_subvol, trav->xlator->name)) { @@ -3037,7 +3054,8 @@ struct xlator_dumpops dumpops = { struct xlator_cbks cbks = { - .release = afr_release, + .release = afr_release, + .releasedir = afr_releasedir, }; @@ -3090,5 +3108,8 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_INT, .min = 0 }, + { .key = {"strict-readdir"}, + .type = GF_OPTION_TYPE_BOOL, + }, { .key = {NULL} }, }; |