diff options
author | Basavanagowda Kanur <gowda@gluster.com> | 2009-04-02 06:08:57 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-02 18:09:42 +0530 |
commit | 2b63980c5da5e82c1a80fe91115fb8d8af201755 (patch) | |
tree | e08a57d126614bffeeb454541eb2a3e243d5601a /xlators/cluster | |
parent | 60615a0a78ab8bc93dd027c1338c588c4f3d49a7 (diff) |
cluster/unify propogates ESTALE to parent translator, if any subvolume returns ESTALE during revalidate.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/unify/src/unify.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index 337cd4688..343210828 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -341,15 +341,29 @@ unify_lookup_cbk (call_frame_t *frame, callcnt = --local->call_count; if (op_ret == -1) { - if ((op_errno != ENOTCONN) && (op_errno != ENOENT)) { + if (local->revalidate && + (op_errno == ESTALE)) { + /* ESTALE takes priority */ + local->op_errno = op_errno; + local->failed = 1; + } + + if ((op_errno != ENOTCONN) + && (op_errno != ENOENT) + && (local->op_errno != ESTALE)) { + /* if local->op_errno is already ESTALE, then + * ESTALE has to propogated to the parent first. + * do not enter here. + */ gf_log (this->name, GF_LOG_ERROR, "child(%s): path(%s): %s", priv->xl_array[(long)cookie]->name, local->loc1.path, strerror (op_errno)); - local->op_errno = op_errno; + local->op_errno = op_errno; local->failed = 1; } else if (local->revalidate && + (local->op_errno != ESTALE) && !(priv->optimist && (op_errno == ENOENT))) { gf_log (this->name, @@ -420,7 +434,13 @@ unify_lookup_cbk (call_frame_t *frame, local->list [local->index++] = (int16_t)(long)cookie; } - + + if (!local->revalidate && S_ISDIR (buf->st_mode)) { + /* fresh lookup of a directory */ + inode_ctx_put (local->loc1.inode, this, + priv->inode_generation); + } + if ((!local->dict) && dict && (priv->xl_array[(long)cookie] != NS(this))) { local->dict = dict_ref (dict); @@ -507,7 +527,8 @@ unify_lookup_cbk (call_frame_t *frame, if ((local->op_ret >= 0) && local->failed && local->revalidate) { /* Done revalidate, but it failed */ - if (op_errno != ENOTCONN) { + if ((op_errno != ENOTCONN) + && (local->op_errno != ESTALE)) { gf_log (this->name, GF_LOG_ERROR, "Revalidate failed for path(%s): %s", local->loc1.path, strerror (op_errno)); @@ -572,6 +593,11 @@ unify_lookup (call_frame_t *frame, STACK_UNWIND (frame, -1, ENOMEM, loc->inode, NULL, NULL); return 0; } + + if (inode_ctx_get (loc->inode, this, NULL) + && S_ISDIR (loc->inode->st_mode)) { + local->revalidate = 1; + } if (!inode_ctx_get (loc->inode, this, NULL) && loc->inode->st_mode && |