diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-07-09 05:33:54 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-15 23:14:43 -0700 |
commit | 161188e919968f1d782e857151f2f4dca1fdfc22 (patch) | |
tree | fc7df0be2f5c649dd28f985693e5437e8b7d8ad2 /xlators | |
parent | c276dfe936dbb48cd5569099c5cc142122d160f8 (diff) |
Return inode number always from the first up subvolume in AFR.
Also fixes a bug in the "KLUDGE" part. It was setting lookup_buf
when it should have been setting local->cont.lookup.buf
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 116 (Replicate: Need inode number from first subvolume on fresh lookup)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=116
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 25 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 1 |
2 files changed, 16 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 31c81ffd41a..6fa15b1aea3 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -486,6 +486,16 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, &open_fd_count); local->open_fd_count += open_fd_count; + + first_up_child = afr_first_up_child (priv); + + if (child_index == first_up_child) { + local->cont.lookup.ino = + afr_itransform (buf->st_ino, + priv->child_count, + first_up_child); + } + /* in case of revalidate, we need to send stat of the * child whose stat was sent during the first lookup. * (so that time stamp does not vary with revalidate. @@ -540,15 +550,6 @@ 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) { /* @@ -587,11 +588,15 @@ unlock: call_count = afr_frame_return (frame); if (call_count == 0) { + if (local->cont.lookup.ino) { + local->cont.lookup.buf.st_ino = local->cont.lookup.ino; + } + if (local->op_ret == 0) { /* KLUDGE: assuming DHT will not itransform in revalidate */ if (local->cont.lookup.inode->ino) - lookup_buf->st_ino = + local->cont.lookup.buf.st_ino = local->cont.lookup.inode->ino; } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 2871bfc47dd..a4facf2074f 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -182,6 +182,7 @@ typedef struct _afr_local { struct { inode_t *inode; struct stat buf; + ino_t ino; dict_t *xattr; } lookup; |