From c1c18df3936b01ec4ea8b48b936c4087648f4b3b Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Tue, 26 May 2009 05:01:35 +0000 Subject: Always do itransform of the inode number from the first up child. Signed-off-by: Anand V. Avati --- xlators/cluster/afr/src/afr.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index ab10df8fc3d..81665612272 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -437,8 +437,10 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, afr_local_t * local = NULL; afr_private_t * priv = NULL; struct stat * lookup_buf = NULL; - int call_count = -1; - int child_index = -1; + + int call_count = -1; + int child_index = -1; + int first_up_child = -1; uint32_t open_fd_count = 0; int ret = 0; @@ -500,10 +502,11 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, local->cont.lookup.xattr = dict_ref (xattr); *lookup_buf = *buf; - lookup_buf->st_ino = afr_itransform (buf->st_ino, - priv->child_count, - child_index); + lookup_buf->st_ino = afr_itransform (buf->st_ino, + priv->child_count, + child_index); + if (priv->read_child >= 0) { afr_set_read_child (this, local->cont.lookup.inode, @@ -537,6 +540,15 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, local->need_data_self_heal = 1; } + first_up_child = afr_first_up_child (priv); + + if (child_index == first_up_child) { + local->cont.lookup.buf.st_ino = + afr_itransform (buf->st_ino, + priv->child_count, + first_up_child); + } + if (child_index == local->read_child_index) { /* @@ -553,9 +565,6 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, local->cont.lookup.xattr = dict_ref (xattr); *lookup_buf = *buf; - lookup_buf->st_ino = afr_itransform (buf->st_ino, - priv->child_count, - child_index); if (priv->read_child >= 0) { afr_set_read_child (this, -- cgit