summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-07-30 12:04:54 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-30 12:01:03 -0700
commit65c03aa578340e78bd828f1f1aae991ef0cdc448 (patch)
treefef3d9dbe3e0753d0c2be57bc6bb675875e1de2f /xlators
parentc8765d4d807cc9e63c8d96a568fc05002fa7cbd3 (diff)
replicate: Return ino from first subvolume on inode creation fops
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 177 (replicate: On file/dir creation, replicate returns inode from random subvolumes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=177
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 88a3ded5e..7be32ce4c 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -77,9 +77,11 @@ int
afr_create_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
+ afr_private_t * priv = NULL;
afr_local_t *local = NULL;
struct stat *unwind_buf = NULL;
+ priv = this->private;
local = frame->local;
LOCK (&frame->lock);
@@ -98,6 +100,8 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.create.buf;
}
+ unwind_buf->st_ino = local->cont.create.ino;
+
AFR_STACK_UNWIND (main_frame, local->op_ret, local->op_errno,
local->cont.create.fd,
local->cont.create.inode,
@@ -120,6 +124,7 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int call_count = -1;
int child_index = -1;
+ int first_up_child = 0;
local = frame->local;
priv = this->private;
@@ -147,10 +152,6 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0) {
local->cont.create.buf = *buf;
- local->cont.create.buf.st_ino =
- afr_itransform (buf->st_ino,
- priv->child_count,
- child_index);
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -161,6 +162,15 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
+ first_up_child = afr_first_up_child (priv);
+
+ if (child_index == first_up_child) {
+ local->cont.create.ino =
+ afr_itransform (buf->st_ino,
+ priv->child_count,
+ first_up_child);
+ }
+
if (child_index == local->read_child_index) {
local->cont.create.read_child_buf = *buf;
}
@@ -568,6 +578,8 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this)
unwind_buf = &local->cont.mkdir.buf;
}
+ unwind_buf->st_ino = local->cont.mkdir.ino;
+
AFR_STACK_UNWIND (main_frame, local->op_ret, local->op_errno,
local->cont.mkdir.inode,
unwind_buf);
@@ -587,6 +599,7 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int call_count = -1;
int child_index = -1;
+ int first_up_child = 0;
local = frame->local;
priv = this->private;
@@ -603,9 +616,6 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->success_count == 0) {
local->cont.mkdir.buf = *buf;
- local->cont.mkdir.buf.st_ino =
- afr_itransform (buf->st_ino, priv->child_count,
- child_index);
if (priv->read_child >= 0) {
afr_set_read_child (this, inode,
@@ -615,6 +625,15 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->read_child_index);
}
}
+
+ first_up_child = afr_first_up_child (priv);
+
+ if (child_index == first_up_child) {
+ local->cont.mkdir.ino =
+ afr_itransform (buf->st_ino,
+ priv->child_count,
+ first_up_child);
+ }
if (child_index == local->read_child_index) {
local->cont.mkdir.read_child_buf = *buf;
@@ -788,14 +807,14 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this)
UNLOCK (&frame->lock);
if (main_frame) {
- local->cont.link.buf.st_ino = local->cont.link.ino;
-
if (local->cont.link.read_child_buf.st_ino) {
unwind_buf = &local->cont.link.read_child_buf;
} else {
unwind_buf = &local->cont.link.buf;
}
+ unwind_buf->st_ino = local->cont.link.ino;
+
AFR_STACK_UNWIND (main_frame, local->op_ret, local->op_errno,
local->cont.link.inode,
unwind_buf);