cluster/afr: NFS-friendly logic changes
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 145 (NFSv3 related additions to 2.1 task list) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=145
This commit is contained in:
parent
a284bf490c
commit
78c98cac26
xlators/cluster/afr/src
@ -102,11 +102,15 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.create.ino;
|
||||
|
||||
local->cont.create.preparent.st_ino = local->cont.create.parent_ino;
|
||||
local->cont.create.postparent.st_ino = local->cont.create.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (create, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
local->cont.create.fd,
|
||||
local->cont.create.inode,
|
||||
unwind_buf, NULL, NULL);
|
||||
unwind_buf, &local->cont.create.preparent,
|
||||
&local->cont.create.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -176,6 +180,8 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.create.read_child_buf = *buf;
|
||||
local->cont.create.preparent = *preparent;
|
||||
local->cont.create.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->cont.create.inode = inode;
|
||||
@ -303,6 +309,9 @@ afr_create (call_frame_t *frame, xlator_t *this,
|
||||
local->cont.create.mode = mode;
|
||||
local->cont.create.fd = fd_ref (fd);
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.create.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_create_wind;
|
||||
local->transaction.done = afr_create_done;
|
||||
local->transaction.unwind = afr_create_unwind;
|
||||
@ -358,10 +367,14 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.mknod.ino;
|
||||
|
||||
local->cont.mknod.preparent.st_ino = local->cont.mknod.parent_ino;
|
||||
local->cont.mknod.postparent.st_ino = local->cont.mknod.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (mknod, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
local->cont.mknod.inode,
|
||||
unwind_buf, NULL, NULL);
|
||||
unwind_buf, &local->cont.mknod.preparent,
|
||||
&local->cont.mknod.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -418,6 +431,8 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.mknod.read_child_buf = *buf;
|
||||
local->cont.mknod.preparent = *preparent;
|
||||
local->cont.mknod.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->cont.mknod.inode = inode;
|
||||
@ -540,6 +555,9 @@ afr_mknod (call_frame_t *frame, xlator_t *this,
|
||||
local->cont.mknod.mode = mode;
|
||||
local->cont.mknod.dev = dev;
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.mknod.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_mknod_wind;
|
||||
local->transaction.done = afr_mknod_done;
|
||||
local->transaction.unwind = afr_mknod_unwind;
|
||||
@ -596,10 +614,14 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.mkdir.ino;
|
||||
|
||||
local->cont.mkdir.preparent.st_ino = local->cont.mkdir.parent_ino;
|
||||
local->cont.mkdir.postparent.st_ino = local->cont.mkdir.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (mkdir, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
local->cont.mkdir.inode,
|
||||
unwind_buf, NULL, NULL);
|
||||
unwind_buf, &local->cont.mkdir.preparent,
|
||||
&local->cont.mkdir.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -657,6 +679,8 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.mkdir.read_child_buf = *buf;
|
||||
local->cont.mkdir.preparent = *preparent;
|
||||
local->cont.mkdir.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->cont.mkdir.inode = inode;
|
||||
@ -779,6 +803,9 @@ afr_mkdir (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
local->cont.mkdir.mode = mode;
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.mkdir.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_mkdir_wind;
|
||||
local->transaction.done = afr_mkdir_done;
|
||||
local->transaction.unwind = afr_mkdir_unwind;
|
||||
@ -836,10 +863,14 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.link.ino;
|
||||
|
||||
local->cont.link.preparent.st_ino = local->cont.link.parent_ino;
|
||||
local->cont.link.postparent.st_ino = local->cont.link.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (link, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
local->cont.link.inode,
|
||||
unwind_buf, NULL, NULL);
|
||||
unwind_buf, &local->cont.link.preparent,
|
||||
&local->cont.link.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -885,6 +916,8 @@ afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.link.read_child_buf = *buf;
|
||||
local->cont.link.preparent = *preparent;
|
||||
local->cont.link.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->cont.link.inode = inode;
|
||||
@ -1007,6 +1040,9 @@ afr_link (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
local->cont.link.ino = oldloc->inode->ino;
|
||||
|
||||
if (oldloc->parent)
|
||||
local->cont.link.parent_ino = oldloc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_link_wind;
|
||||
local->transaction.done = afr_link_done;
|
||||
local->transaction.unwind = afr_link_unwind;
|
||||
@ -1064,10 +1100,14 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.symlink.ino;
|
||||
|
||||
local->cont.symlink.preparent.st_ino = local->cont.symlink.parent_ino;
|
||||
local->cont.symlink.postparent.st_ino = local->cont.symlink.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (symlink, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
local->cont.symlink.inode,
|
||||
unwind_buf, NULL, NULL);
|
||||
unwind_buf, &local->cont.symlink.preparent,
|
||||
&local->cont.symlink.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1123,6 +1163,8 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.symlink.read_child_buf = *buf;
|
||||
local->cont.symlink.preparent = *preparent;
|
||||
local->cont.symlink.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->cont.symlink.inode = inode;
|
||||
@ -1246,6 +1288,9 @@ afr_symlink (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
local->cont.symlink.linkpath = strdup (linkpath);
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.symlink.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_symlink_wind;
|
||||
local->transaction.done = afr_symlink_done;
|
||||
local->transaction.unwind = afr_symlink_unwind;
|
||||
@ -1301,10 +1346,18 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this)
|
||||
|
||||
unwind_buf->st_ino = local->cont.rename.ino;
|
||||
|
||||
local->cont.rename.preoldparent.st_ino = local->cont.rename.oldparent_ino;
|
||||
local->cont.rename.postoldparent.st_ino = local->cont.rename.oldparent_ino;
|
||||
local->cont.rename.prenewparent.st_ino = local->cont.rename.newparent_ino;
|
||||
local->cont.rename.postnewparent.st_ino = local->cont.rename.newparent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (rename, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
unwind_buf,
|
||||
NULL, NULL, NULL, NULL);
|
||||
&local->cont.rename.preoldparent,
|
||||
&local->cont.rename.postoldparent,
|
||||
&local->cont.rename.prenewparent,
|
||||
&local->cont.rename.postnewparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -1346,6 +1399,11 @@ afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.rename.read_child_buf = *buf;
|
||||
|
||||
local->cont.rename.preoldparent = *preoldparent;
|
||||
local->cont.rename.postoldparent = *postoldparent;
|
||||
local->cont.rename.prenewparent = *prenewparent;
|
||||
local->cont.rename.postnewparent = *postnewparent;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1459,6 +1517,11 @@ afr_rename (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
local->cont.rename.ino = oldloc->inode->ino;
|
||||
|
||||
if (oldloc->parent)
|
||||
local->cont.rename.oldparent_ino = oldloc->parent->ino;
|
||||
if (newloc->parent)
|
||||
local->cont.rename.newparent_ino = newloc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_rename_wind;
|
||||
local->transaction.done = afr_rename_done;
|
||||
local->transaction.unwind = afr_rename_unwind;
|
||||
@ -1506,10 +1569,15 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this)
|
||||
}
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
if (main_frame)
|
||||
if (main_frame) {
|
||||
local->cont.unlink.preparent.st_ino = local->cont.unlink.parent_ino;
|
||||
local->cont.unlink.postparent.st_ino = local->cont.unlink.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (unlink, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
NULL, NULL);
|
||||
&local->cont.unlink.preparent,
|
||||
&local->cont.unlink.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1526,22 +1594,38 @@ afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
int call_count = -1;
|
||||
int child_index = (long) cookie;
|
||||
int need_unwind = 0;
|
||||
int read_child = 0;
|
||||
|
||||
local = frame->local;
|
||||
priv = this->private;
|
||||
|
||||
|
||||
read_child = afr_read_child (this, local->loc.inode);
|
||||
|
||||
LOCK (&frame->lock);
|
||||
{
|
||||
if (child_index == local->read_child_index) {
|
||||
local->read_child_returned = _gf_true;
|
||||
}
|
||||
|
||||
if (afr_fop_failed (op_ret, op_errno))
|
||||
afr_transaction_fop_failed (frame, this, child_index);
|
||||
|
||||
if (op_ret != -1) {
|
||||
if (local->success_count == 0) {
|
||||
local->op_ret = op_ret;
|
||||
local->cont.unlink.preparent = *preparent;
|
||||
local->cont.unlink.postparent = *postparent;
|
||||
}
|
||||
|
||||
if (child_index == local->read_child_index) {
|
||||
local->cont.unlink.preparent = *preparent;
|
||||
local->cont.unlink.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
|
||||
if (local->success_count == priv->wait_count) {
|
||||
if ((local->success_count == priv->wait_count)
|
||||
&& local->read_child_returned) {
|
||||
need_unwind = 1;
|
||||
}
|
||||
}
|
||||
@ -1651,6 +1735,9 @@ afr_unlink (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
loc_copy (&local->loc, loc);
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.unlink.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_unlink_wind;
|
||||
local->transaction.done = afr_unlink_done;
|
||||
local->transaction.unwind = afr_unlink_unwind;
|
||||
@ -1697,10 +1784,15 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this)
|
||||
}
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
if (main_frame)
|
||||
if (main_frame) {
|
||||
local->cont.rmdir.preparent.st_ino = local->cont.rmdir.parent_ino;
|
||||
local->cont.rmdir.postparent.st_ino = local->cont.rmdir.parent_ino;
|
||||
|
||||
AFR_STACK_UNWIND (rmdir, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
NULL, NULL);
|
||||
&local->cont.rmdir.preparent,
|
||||
&local->cont.rmdir.postparent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1717,22 +1809,39 @@ afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
int call_count = -1;
|
||||
int child_index = (long) cookie;
|
||||
int need_unwind = 0;
|
||||
int read_child = 0;
|
||||
|
||||
local = frame->local;
|
||||
priv = this->private;
|
||||
|
||||
read_child = afr_read_child (this, local->loc.inode);
|
||||
|
||||
LOCK (&frame->lock);
|
||||
{
|
||||
if (child_index == read_child) {
|
||||
local->read_child_returned = _gf_true;
|
||||
}
|
||||
|
||||
if (afr_fop_failed (op_ret, op_errno))
|
||||
afr_transaction_fop_failed (frame, this, child_index);
|
||||
|
||||
if (op_ret != -1) {
|
||||
if (local->success_count == 0) {
|
||||
local->op_ret = op_ret;
|
||||
local->cont.rmdir.preparent = *preparent;
|
||||
local->cont.rmdir.postparent = *postparent;
|
||||
|
||||
}
|
||||
|
||||
if (child_index == read_child) {
|
||||
local->cont.rmdir.preparent = *preparent;
|
||||
local->cont.rmdir.postparent = *postparent;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
|
||||
if (local->success_count == priv->wait_count)
|
||||
if ((local->success_count == priv->wait_count)
|
||||
&& local->read_child_returned)
|
||||
need_unwind = 1;
|
||||
}
|
||||
|
||||
@ -1841,6 +1950,9 @@ afr_rmdir (call_frame_t *frame, xlator_t *this,
|
||||
|
||||
loc_copy (&local->loc, loc);
|
||||
|
||||
if (loc->parent)
|
||||
local->cont.rmdir.parent_ino = loc->parent->ino;
|
||||
|
||||
local->transaction.fop = afr_rmdir_wind;
|
||||
local->transaction.done = afr_rmdir_done;
|
||||
local->transaction.unwind = afr_rmdir_unwind;
|
||||
|
@ -470,6 +470,9 @@ afr_readlink_cbk (call_frame_t *frame, void *cookie,
|
||||
|
||||
out:
|
||||
if (unwind) {
|
||||
if (sbuf)
|
||||
sbuf->st_ino = local->cont.readlink.ino;
|
||||
|
||||
AFR_STACK_UNWIND (readlink, frame, op_ret, op_errno, buf, sbuf);
|
||||
}
|
||||
|
||||
@ -525,7 +528,9 @@ afr_readlink (call_frame_t *frame, xlator_t *this,
|
||||
}
|
||||
|
||||
loc_copy (&local->loc, loc);
|
||||
|
||||
local->cont.readlink.size = size;
|
||||
local->cont.readlink.ino = loc->inode->ino;
|
||||
|
||||
STACK_WIND_COOKIE (frame, afr_readlink_cbk,
|
||||
(void *) (long) call_child,
|
||||
|
@ -57,8 +57,6 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this)
|
||||
afr_private_t * priv = NULL;
|
||||
call_frame_t *main_frame = NULL;
|
||||
|
||||
struct stat * unwind_buf = NULL;
|
||||
|
||||
local = frame->local;
|
||||
priv = this->private;
|
||||
|
||||
@ -71,16 +69,13 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this)
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
if (main_frame) {
|
||||
if (local->cont.writev.read_child_buf.st_ino) {
|
||||
unwind_buf = &local->cont.writev.read_child_buf;
|
||||
} else {
|
||||
unwind_buf = &local->cont.writev.buf;
|
||||
}
|
||||
local->cont.writev.prebuf.st_ino = local->cont.writev.ino;
|
||||
local->cont.writev.postbuf.st_ino = local->cont.writev.ino;
|
||||
|
||||
unwind_buf->st_ino = local->cont.writev.ino;
|
||||
|
||||
AFR_STACK_UNWIND (writev, main_frame, local->op_ret,
|
||||
local->op_errno, unwind_buf, NULL);
|
||||
AFR_STACK_UNWIND (writev, main_frame,
|
||||
local->op_ret, local->op_errno,
|
||||
&local->cont.writev.prebuf,
|
||||
&local->cont.writev.postbuf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -115,12 +110,14 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (op_ret != -1) {
|
||||
if (local->success_count == 0) {
|
||||
local->op_ret = op_ret;
|
||||
local->cont.writev.buf = *postbuf;
|
||||
local->op_ret = op_ret;
|
||||
local->cont.writev.prebuf = *prebuf;
|
||||
local->cont.writev.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
if (child_index == read_child) {
|
||||
local->cont.writev.read_child_buf = *postbuf;
|
||||
local->cont.writev.prebuf = *prebuf;
|
||||
local->cont.writev.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
@ -245,11 +242,11 @@ afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
||||
transaction_frame->local = local;
|
||||
|
||||
local->op = GF_FOP_WRITE;
|
||||
local->cont.writev.vector = iov_dup (vector, count);
|
||||
local->cont.writev.count = count;
|
||||
local->cont.writev.offset = offset;
|
||||
local->cont.writev.ino = fd->inode->ino;
|
||||
local->cont.writev.iobref = iobref_ref (iobref);
|
||||
local->cont.writev.vector = iov_dup (vector, count);
|
||||
local->cont.writev.count = count;
|
||||
local->cont.writev.offset = offset;
|
||||
local->cont.writev.ino = fd->inode->ino;
|
||||
local->cont.writev.iobref = iobref_ref (iobref);
|
||||
|
||||
local->transaction.fop = afr_writev_wind;
|
||||
local->transaction.done = afr_writev_done;
|
||||
@ -291,8 +288,6 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this)
|
||||
afr_private_t * priv = NULL;
|
||||
call_frame_t *main_frame = NULL;
|
||||
|
||||
struct stat * unwind_buf = NULL;
|
||||
|
||||
local = frame->local;
|
||||
priv = this->private;
|
||||
|
||||
@ -305,17 +300,13 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this)
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
if (main_frame) {
|
||||
if (local->cont.truncate.read_child_buf.st_ino) {
|
||||
unwind_buf = &local->cont.truncate.read_child_buf;
|
||||
} else {
|
||||
unwind_buf = &local->cont.truncate.buf;
|
||||
}
|
||||
|
||||
unwind_buf->st_ino = local->cont.truncate.ino;
|
||||
local->cont.truncate.prebuf.st_ino = local->cont.truncate.ino;
|
||||
local->cont.truncate.postbuf.st_ino = local->cont.truncate.ino;
|
||||
|
||||
AFR_STACK_UNWIND (truncate, main_frame, local->op_ret,
|
||||
local->op_errno,
|
||||
unwind_buf, NULL);
|
||||
&local->cont.truncate.prebuf,
|
||||
&local->cont.truncate.postbuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -352,11 +343,13 @@ afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
if (op_ret != -1) {
|
||||
if (local->success_count == 0) {
|
||||
local->op_ret = op_ret;
|
||||
local->cont.truncate.buf = *postbuf;
|
||||
local->cont.truncate.prebuf = *prebuf;
|
||||
local->cont.truncate.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
if (child_index == read_child) {
|
||||
local->cont.truncate.read_child_buf = *postbuf;
|
||||
local->cont.truncate.prebuf = *prebuf;
|
||||
local->cont.truncate.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
@ -514,8 +507,6 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this)
|
||||
afr_private_t * priv = NULL;
|
||||
call_frame_t *main_frame = NULL;
|
||||
|
||||
struct stat * unwind_buf = NULL;
|
||||
|
||||
local = frame->local;
|
||||
priv = this->private;
|
||||
|
||||
@ -528,16 +519,13 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this)
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
if (main_frame) {
|
||||
if (local->cont.ftruncate.read_child_buf.st_ino) {
|
||||
unwind_buf = &local->cont.ftruncate.read_child_buf;
|
||||
} else {
|
||||
unwind_buf = &local->cont.ftruncate.buf;
|
||||
}
|
||||
|
||||
unwind_buf->st_ino = local->cont.ftruncate.ino;
|
||||
local->cont.ftruncate.prebuf.st_ino = local->cont.ftruncate.ino;
|
||||
local->cont.ftruncate.postbuf.st_ino = local->cont.ftruncate.ino;
|
||||
|
||||
AFR_STACK_UNWIND (ftruncate, main_frame, local->op_ret,
|
||||
local->op_errno, unwind_buf, NULL);
|
||||
local->op_errno,
|
||||
&local->cont.ftruncate.prebuf,
|
||||
&local->cont.ftruncate.postbuf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -573,11 +561,13 @@ afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
if (op_ret != -1) {
|
||||
if (local->success_count == 0) {
|
||||
local->op_ret = op_ret;
|
||||
local->cont.ftruncate.buf = *postbuf;
|
||||
local->cont.ftruncate.prebuf = *prebuf;
|
||||
local->cont.ftruncate.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
if (child_index == read_child) {
|
||||
local->cont.ftruncate.read_child_buf = *postbuf;
|
||||
local->cont.ftruncate.prebuf = *prebuf;
|
||||
local->cont.ftruncate.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
|
@ -1417,7 +1417,7 @@ afr_bgsh_completion_cbk (call_frame_t *bgsh_frame, xlator_t *this)
|
||||
local->cont.lookup.inode,
|
||||
&local->cont.lookup.buf,
|
||||
local->cont.lookup.xattr,
|
||||
NULL);
|
||||
&local->cont.lookup.postparent);
|
||||
}
|
||||
|
||||
LOCK (&priv->lock);
|
||||
@ -1457,7 +1457,7 @@ afr_bgsh_unwind (call_frame_t *bgsh_frame, xlator_t *this)
|
||||
local->cont.lookup.inode,
|
||||
&local->cont.lookup.buf,
|
||||
local->cont.lookup.xattr,
|
||||
NULL);
|
||||
&local->cont.lookup.postparent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ afr_self_heal_cbk (call_frame_t *frame, xlator_t *this)
|
||||
local->cont.lookup.inode,
|
||||
&local->cont.lookup.buf,
|
||||
local->cont.lookup.xattr,
|
||||
NULL);
|
||||
&local->cont.lookup.postparent);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -508,6 +508,7 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie,
|
||||
|
||||
local->cont.lookup.inode = inode;
|
||||
local->cont.lookup.xattr = dict_ref (xattr);
|
||||
local->cont.lookup.postparent = *postparent;
|
||||
|
||||
*lookup_buf = *buf;
|
||||
|
||||
@ -562,6 +563,7 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie,
|
||||
|
||||
local->cont.lookup.inode = inode;
|
||||
local->cont.lookup.xattr = dict_ref (xattr);
|
||||
local->cont.lookup.postparent = *postparent;
|
||||
|
||||
*lookup_buf = *buf;
|
||||
|
||||
@ -586,6 +588,8 @@ unlock:
|
||||
call_count = afr_frame_return (frame);
|
||||
|
||||
if (call_count == 0) {
|
||||
local->cont.lookup.postparent.st_ino = local->cont.lookup.parent_ino;
|
||||
|
||||
if (local->cont.lookup.ino) {
|
||||
local->cont.lookup.buf.st_ino = local->cont.lookup.ino;
|
||||
}
|
||||
@ -629,7 +633,7 @@ unlock:
|
||||
local->cont.lookup.inode,
|
||||
&local->cont.lookup.buf,
|
||||
local->cont.lookup.xattr,
|
||||
NULL);
|
||||
&local->cont.lookup.postparent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1146,22 +1150,49 @@ afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
int call_count = -1;
|
||||
|
||||
int child_index = (long) cookie;
|
||||
int read_child = 0;
|
||||
|
||||
local = frame->local;
|
||||
|
||||
read_child = afr_read_child (this, local->fd->inode);
|
||||
|
||||
LOCK (&frame->lock);
|
||||
{
|
||||
if (op_ret == 0)
|
||||
if (child_index == read_child) {
|
||||
local->read_child_returned = _gf_true;
|
||||
}
|
||||
|
||||
if (op_ret == 0) {
|
||||
local->op_ret = 0;
|
||||
|
||||
if (local->success_count == 0) {
|
||||
local->cont.fsync.prebuf = *prebuf;
|
||||
local->cont.fsync.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
if (child_index == read_child) {
|
||||
local->cont.fsync.prebuf = *prebuf;
|
||||
local->cont.fsync.postbuf = *postbuf;
|
||||
}
|
||||
|
||||
local->success_count++;
|
||||
}
|
||||
|
||||
local->op_errno = op_errno;
|
||||
}
|
||||
UNLOCK (&frame->lock);
|
||||
|
||||
call_count = afr_frame_return (frame);
|
||||
|
||||
if (call_count == 0)
|
||||
if (call_count == 0) {
|
||||
local->cont.fsync.prebuf.st_ino = local->cont.fsync.ino;
|
||||
local->cont.fsync.postbuf.st_ino = local->cont.fsync.ino;
|
||||
|
||||
AFR_STACK_UNWIND (fsync, frame, local->op_ret, local->op_errno,
|
||||
NULL, NULL);
|
||||
&local->cont.fsync.prebuf,
|
||||
&local->cont.fsync.postbuf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1198,12 +1229,15 @@ afr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
||||
call_count = local->call_count;
|
||||
frame->local = local;
|
||||
|
||||
local->cont.fsync.ino = fd->inode->ino;
|
||||
|
||||
for (i = 0; i < priv->child_count; i++) {
|
||||
if (local->child_up[i]) {
|
||||
STACK_WIND (frame, afr_fsync_cbk,
|
||||
priv->children[i],
|
||||
priv->children[i]->fops->fsync,
|
||||
fd, datasync);
|
||||
STACK_WIND_COOKIE (frame, afr_fsync_cbk,
|
||||
(void *) (long) i,
|
||||
priv->children[i],
|
||||
priv->children[i]->fops->fsync,
|
||||
fd, datasync);
|
||||
if (!--call_count)
|
||||
break;
|
||||
}
|
||||
|
@ -207,7 +207,9 @@ typedef struct _afr_local {
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat postparent;
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
dict_t *xattr;
|
||||
} lookup;
|
||||
|
||||
@ -246,6 +248,7 @@ typedef struct _afr_local {
|
||||
struct {
|
||||
size_t size;
|
||||
int last_tried;
|
||||
ino_t ino;
|
||||
} readlink;
|
||||
|
||||
struct {
|
||||
@ -322,8 +325,8 @@ typedef struct _afr_local {
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat prebuf;
|
||||
struct stat postbuf;
|
||||
|
||||
int32_t op_ret;
|
||||
|
||||
@ -333,18 +336,24 @@ typedef struct _afr_local {
|
||||
off_t offset;
|
||||
} writev;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
struct stat prebuf;
|
||||
struct stat postbuf;
|
||||
} fsync;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
off_t offset;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat prebuf;
|
||||
struct stat postbuf;
|
||||
} truncate;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
off_t offset;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat prebuf;
|
||||
struct stat postbuf;
|
||||
} ftruncate;
|
||||
|
||||
struct {
|
||||
@ -383,60 +392,87 @@ typedef struct _afr_local {
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
fd_t *fd;
|
||||
int32_t flags;
|
||||
mode_t mode;
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
struct stat read_child_buf;
|
||||
} create;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
dev_t dev;
|
||||
mode_t mode;
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
struct stat read_child_buf;
|
||||
} mknod;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
int32_t mode;
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
} mkdir;
|
||||
|
||||
struct {
|
||||
ino_t parent_ino;
|
||||
int32_t op_ret;
|
||||
int32_t op_errno;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
} unlink;
|
||||
|
||||
struct {
|
||||
ino_t parent_ino;
|
||||
int32_t op_ret;
|
||||
int32_t op_errno;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
} rmdir;
|
||||
|
||||
struct {
|
||||
ino_t oldparent_ino;
|
||||
ino_t newparent_ino;
|
||||
ino_t ino;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat preoldparent;
|
||||
struct stat prenewparent;
|
||||
struct stat postoldparent;
|
||||
struct stat postnewparent;
|
||||
} rename;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
} link;
|
||||
|
||||
struct {
|
||||
ino_t ino;
|
||||
ino_t parent_ino;
|
||||
inode_t *inode;
|
||||
struct stat buf;
|
||||
struct stat read_child_buf;
|
||||
char *linkpath;
|
||||
struct stat preparent;
|
||||
struct stat postparent;
|
||||
} symlink;
|
||||
|
||||
struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user