diff options
author | Anand Avati <avati@gluster.com> | 2009-10-23 08:22:49 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-23 07:03:19 -0700 |
commit | 52b02bbabaaa78061c6b223715f57853cbcfd652 (patch) | |
tree | bb4168eed7a2d65664ca031f1b690797f678d9b4 /xlators/protocol/server/src | |
parent | 919d80171c73cf3ed516c089603f0c635cf5a376 (diff) |
protocol/server: send fresh lookups on revalidate failures
also unlink non existent dentries in lookup_cbk
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 315 (generation number support)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=315
Diffstat (limited to 'xlators/protocol/server/src')
-rw-r--r-- | xlators/protocol/server/src/server-protocol.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 4c222c3ff..415d53c9d 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -2095,9 +2095,24 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t gf_errno = 0; int32_t ret = -1; inode_t *link_inode = NULL; + loc_t fresh_loc = {0,}; state = CALL_STATE(frame); + if (state->is_revalidate == 1 && op_ret == -1) { + state->is_revalidate = 2; + loc_copy (&fresh_loc, &state->loc); + inode_unref (fresh_loc.inode); + fresh_loc.inode = inode_new (state->itable); + + STACK_WIND (frame, server_lookup_cbk, + BOUND_XL (frame), BOUND_XL (frame)->fops->lookup, + &fresh_loc, state->dict); + + loc_wipe (&fresh_loc); + return 0; + } + if (dict) { dict_len = dict_serialized_length (dict); if (dict_len < 0) { @@ -2146,13 +2161,18 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_stat_from_stat (&rsp->stat, stbuf); - if (inode->ino == 0) { + if (inode->ino != 1) { link_inode = inode_link (inode, state->loc.parent, state->loc.name, stbuf); inode_lookup (link_inode); inode_unref (link_inode); } } else { + if (state->is_revalidate && op_errno == ENOENT) { + inode_unlink (state->loc.inode, state->loc.parent, + state->loc.name); + } + gf_log (this->name, (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_DEBUG), "%"PRId64": LOOKUP %s (%"PRId64") ==> %"PRId32" (%s)", @@ -2308,6 +2328,8 @@ server_lookup_resume (call_frame_t *frame, xlator_t *bound_xl) if (!state->loc.inode) state->loc.inode = inode_new (state->itable); + else + state->is_revalidate = 1; STACK_WIND (frame, server_lookup_cbk, bound_xl, bound_xl->fops->lookup, |