diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-10-01 06:58:47 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-01 07:22:46 -0700 |
commit | e11d66c8d6dea72d02f9bcdbf65c67bd5c60b5cc (patch) | |
tree | ffa96a3f78b79db2704a5bc410174714fd66fa67 /xlators | |
parent | 186a86f342625a9dce53fe537f8237c6099d5c54 (diff) |
Global: NFS-friendly prototype 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
Diffstat (limited to 'xlators')
40 files changed, 1689 insertions, 506 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 51629234f..5cd05b138 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -115,7 +115,8 @@ afr_create_unwind (call_frame_t *frame, xlator_t *this) int afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -366,9 +367,10 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this) int -afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) +afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -601,9 +603,10 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this) int -afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) +afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -840,7 +843,8 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this) int afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1065,7 +1069,8 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this) int afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1297,7 +1302,9 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this) int afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1496,7 +1503,8 @@ afr_unlink_unwind (call_frame_t *frame, xlator_t *this) int afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -1683,7 +1691,8 @@ afr_rmdir_unwind (call_frame_t *frame, xlator_t *this) int afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c index 203206511..8c0431f5a 100644 --- a/xlators/cluster/afr/src/afr-inode-read.c +++ b/xlators/cluster/afr/src/afr-inode-read.c @@ -428,7 +428,7 @@ out: int32_t afr_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, struct stat *sbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 591f7cd49..601913a0f 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -88,7 +88,8 @@ afr_writev_unwind (call_frame_t *frame, xlator_t *this) int afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -115,11 +116,11 @@ 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 = *buf; + local->cont.writev.buf = *postbuf; } if (child_index == read_child) { - local->cont.writev.read_child_buf = *buf; + local->cont.writev.read_child_buf = *postbuf; } local->success_count++; @@ -323,7 +324,8 @@ afr_truncate_unwind (call_frame_t *frame, xlator_t *this) int afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -350,11 +352,11 @@ 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 = *buf; + local->cont.truncate.buf = *postbuf; } if (child_index == read_child) { - local->cont.truncate.read_child_buf = *buf; + local->cont.truncate.read_child_buf = *postbuf; } local->success_count++; @@ -543,7 +545,8 @@ afr_ftruncate_unwind (call_frame_t *frame, xlator_t *this) int afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -570,11 +573,11 @@ 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 = *buf; + local->cont.ftruncate.buf = *postbuf; } if (child_index == read_child) { - local->cont.ftruncate.read_child_buf = *buf; + local->cont.ftruncate.read_child_buf = *postbuf; } local->success_count++; diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.c b/xlators/cluster/afr/src/afr-self-heal-algorithm.c index 46d451913..5197f6be4 100644 --- a/xlators/cluster/afr/src/afr-self-heal-algorithm.c +++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.c @@ -55,7 +55,8 @@ sh_full_read_write_iter (call_frame_t *frame, xlator_t *this); static int sh_full_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -281,7 +282,8 @@ sh_diff_iter (call_frame_t *frame, xlator_t *this); static int sh_diff_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 4a260ed90..ef25204a1 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -831,7 +831,9 @@ static int sh_missing_entries_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, + struct stat *preparent, + struct stat *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; @@ -1044,7 +1046,7 @@ static int sh_missing_entries_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *link) + const char *link, struct stat *sbuf) { if (op_ret > 0) sh_missing_entries_symlink (frame, this, link); @@ -1164,7 +1166,8 @@ static int sh_missing_entries_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { int child_index = 0; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 576a15e06..5300f0a75 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -395,7 +395,8 @@ afr_sh_data_erase_pending (call_frame_t *frame, xlator_t *this) int afr_sh_data_trim_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -600,7 +601,7 @@ afr_sh_data_open (call_frame_t *frame, xlator_t *this) (void *) (long) source, priv->children[source], priv->children[source]->fops->open, - &local->loc, O_RDWR|O_LARGEFILE, fd); + &local->loc, O_RDWR|O_LARGEFILE, fd, 0); call_count--; /* open sinks */ @@ -613,7 +614,7 @@ afr_sh_data_open (call_frame_t *frame, xlator_t *this) priv->children[i], priv->children[i]->fops->open, &local->loc, - O_RDWR|O_LARGEFILE, fd); + O_RDWR|O_LARGEFILE, fd, 0); if (!--call_count) break; @@ -758,7 +759,8 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) int afr_sh_data_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index b3bb67209..fa9384158 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -426,7 +426,9 @@ afr_sh_entry_expunge_entry_done (call_frame_t *frame, xlator_t *this, int afr_sh_entry_expunge_remove_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -564,7 +566,8 @@ int afr_sh_entry_expunge_lookup_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -626,7 +629,8 @@ int afr_sh_entry_expunge_entry_cbk (call_frame_t *expunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *expunge_local = NULL; @@ -1021,7 +1025,9 @@ int afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { int call_count = 0; afr_private_t *priv = NULL; @@ -1188,7 +1194,7 @@ int afr_sh_entry_impunge_readlink_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *linkname) + const char *linkname, struct stat *sbuf) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1264,7 +1270,7 @@ afr_sh_entry_impunge_recreate_lookup_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr,struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1372,7 +1378,8 @@ int afr_sh_entry_impunge_entry_cbk (call_frame_t *impunge_frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *x) + inode_t *inode, struct stat *buf, dict_t *x, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *impunge_local = NULL; @@ -1861,7 +1868,8 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this) int afr_sh_entry_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_private_t *priv = NULL; afr_local_t *local = NULL; diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 686446b5f..9a02ab6dd 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -591,7 +591,8 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this) int afr_sh_metadata_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_local_t *local = NULL; afr_self_heal_t *sh = NULL; diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index ef93e5078..b65a4dc46 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -448,7 +448,8 @@ afr_self_heal_cbk (call_frame_t *frame, xlator_t *this) int afr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { afr_local_t * local = NULL; afr_private_t * priv = NULL; @@ -789,7 +790,8 @@ out: int afr_open_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t * local = frame->local; int ret = 0; @@ -864,8 +866,8 @@ afr_open_cbk (call_frame_t *frame, void *cookie, int -afr_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +afr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { afr_private_t * priv = NULL; afr_local_t * local = NULL; @@ -910,7 +912,7 @@ afr_open (call_frame_t *frame, xlator_t *this, STACK_WIND_COOKIE (frame, afr_open_cbk, (void *) (long) i, priv->children[i], priv->children[i]->fops->open, - loc, wind_flags, fd); + loc, wind_flags, fd, wbflags); if (!--call_count) break; @@ -1152,8 +1154,9 @@ out: /* {{{ fsync */ int -afr_fsync_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno) +afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { afr_local_t *local = NULL; @@ -1294,7 +1297,7 @@ afr_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, for (i = 0; i < priv->child_count; i++) { if (local->child_up[i]) { - STACK_WIND (frame, afr_fsync_cbk, + STACK_WIND (frame, afr_fsyncdir_cbk, priv->children[i], priv->children[i]->fops->fsyncdir, fd, datasync); diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index d5d6f4c3e..49af12101 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -79,7 +79,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -190,7 +191,8 @@ selfheal: int dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -308,7 +310,8 @@ int dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -345,7 +348,8 @@ unwind: int dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { dht_conf_t *conf = NULL; dht_local_t *local = NULL; @@ -521,7 +525,8 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { call_frame_t *prev = NULL; dht_local_t *local = NULL; @@ -622,7 +627,8 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc) int dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_layout_t *layout = NULL; char is_linkfile = 0; @@ -853,6 +859,48 @@ err: int +dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + dht_stat_merge (this, &local->stbuf, prebuf, prev->this); + + if (local->inode) + local->stbuf.st_ino = local->inode->ino; + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + + return 0; +} + + + +int dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, struct stat *stbuf) { @@ -1031,7 +1079,7 @@ dht_truncate (call_frame_t *frame, xlator_t *this, local->inode = inode_ref (loc->inode); local->call_cnt = 1; - STACK_WIND (frame, dht_attr_cbk, + STACK_WIND (frame, dht_truncate_cbk, subvol, subvol->fops->truncate, loc, offset); @@ -1077,7 +1125,7 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this, local->inode = inode_ref (fd->inode); local->call_cnt = 1; - STACK_WIND (frame, dht_attr_cbk, + STACK_WIND (frame, dht_truncate_cbk, subvol, subvol->fops->ftruncate, fd, offset); @@ -1092,6 +1140,78 @@ err: int +dht_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int op_ret, int op_errno, struct stat *preparent, + struct stat *postparent) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno); + + return 0; +} + + +int +dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, + int op_errno, struct stat *prebuf, struct stat *postbuf) +{ + dht_local_t *local = NULL; + int this_call_cnt = 0; + call_frame_t *prev = NULL; + + + local = frame->local; + prev = cookie; + + LOCK (&frame->lock); + { + if (op_ret == -1) { + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_DEBUG, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto unlock; + } + + local->op_ret = 0; + } +unlock: + UNLOCK (&frame->lock); + + this_call_cnt = dht_frame_return (frame); + if (is_last_call (this_call_cnt)) + DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno); + + return 0; +} + + + +int dht_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno) { @@ -1175,9 +1295,9 @@ err: int dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, const char *path) + int op_ret, int op_errno, const char *path, struct stat *sbuf) { - DHT_STACK_UNWIND (frame, op_ret, op_errno, path); + DHT_STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -1397,7 +1517,7 @@ unlock: int dht_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int flags, fd_t *fd) + loc_t *loc, int flags, fd_t *fd, int wbflags) { xlator_t *subvol = NULL; int ret = -1; @@ -1438,7 +1558,7 @@ dht_open (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_fd_cbk, subvol, subvol->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; @@ -1499,9 +1619,10 @@ err: int dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, struct stat *stbuf) + int op_ret, int op_errno, struct stat *prebuf, + struct stat *postbuf) { - DHT_STACK_UNWIND (frame, op_ret, op_errno, stbuf); + DHT_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1616,7 +1737,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this, } local->call_cnt = 1; - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync, fd, datasync); @@ -2010,7 +2131,8 @@ err: int dht_newfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2052,7 +2174,8 @@ int dht_mknod_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -2235,11 +2358,11 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) if (hashed_subvol != cached_subvol) local->call_cnt++; - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_unlink_cbk, cached_subvol, cached_subvol->fops->unlink, loc); if (hashed_subvol != cached_subvol) - STACK_WIND (frame, dht_err_cbk, + STACK_WIND (frame, dht_unlink_cbk, hashed_subvol, hashed_subvol->fops->unlink, loc); return 0; @@ -2255,7 +2378,8 @@ err: int dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2289,7 +2413,8 @@ out: int dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *srcvol = NULL; @@ -2393,7 +2518,8 @@ err: int dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf) + fd_t *fd, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { call_frame_t *prev = NULL; dht_layout_t *layout = NULL; @@ -2435,7 +2561,8 @@ int dht_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; xlator_t *cached_subvol = NULL; @@ -2570,7 +2697,8 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie, int dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -2618,8 +2746,9 @@ unlock: int dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + xlator_t *this, int op_ret, int op_errno, + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; int ret = -1; @@ -2764,7 +2893,8 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno) + int op_ret, int op_errno, struct stat *preparent, + struct stat *postparent) { uint64_t tmp_layout = 0; dht_local_t *local = NULL; diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 213d3f2bf..d28f7beca 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -40,7 +40,7 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno, local->linkfile.inode, - &local->linkfile.stbuf); + &local->linkfile.stbuf, NULL, NULL); return 0; } @@ -48,8 +48,9 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -104,8 +105,8 @@ err: str_data = NULL; } - local->linkfile.linkfile_cbk (frame, cookie, this, - op_ret, op_errno, inode, stbuf); + local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno, + inode, stbuf, preparent, postparent); return 0; } @@ -132,7 +133,8 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, int dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 6c34dabad..f91d1983d 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -33,7 +33,9 @@ int dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { dht_local_t *local = NULL; int this_call_cnt = 0; @@ -213,7 +215,8 @@ err: int dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -240,7 +243,9 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -369,7 +374,8 @@ dht_do_rename (call_frame_t *frame) int dht_rename_links_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index df8b2047b..d3b36363e 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -196,7 +196,8 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout) int dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { dht_local_t *local = NULL; dht_layout_t *layout = NULL; diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c index 6be7206bf..17516a122 100644 --- a/xlators/cluster/dht/src/nufa.c +++ b/xlators/cluster/dht/src/nufa.c @@ -30,7 +30,8 @@ int nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf, dict_t *xattr) + inode_t *inode, struct stat *stbuf, dict_t *xattr, + struct stat *postparent) { dht_layout_t *layout = NULL; xlator_t *subvol = NULL; @@ -268,7 +269,9 @@ err: int nufa_create_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; @@ -374,8 +377,9 @@ err: int nufa_mknod_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int op_ret, int op_errno, - inode_t *inode, struct stat *stbuf) + int op_ret, int op_errno, inode_t *inode, + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { dht_local_t *local = NULL; call_frame_t *prev = NULL; diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index b380cb1e9..b2ca48b10 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -64,7 +64,8 @@ ha_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -307,7 +308,8 @@ ha_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int ret = -1; @@ -316,7 +318,8 @@ ha_truncate_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); } return 0; } @@ -357,7 +360,8 @@ ha_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int ret = -1; @@ -367,7 +371,7 @@ ha_ftruncate_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, postbuf); } return 0; } @@ -458,7 +462,8 @@ ha_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { int ret = -1; @@ -468,7 +473,8 @@ ha_readlink_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + sbuf); } return 0; } @@ -511,7 +517,8 @@ ha_mknod_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -573,7 +580,9 @@ ha_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -708,7 +717,8 @@ ha_mkdir_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -762,7 +772,9 @@ ha_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -886,7 +898,9 @@ ha_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int ret = -1; @@ -931,7 +945,9 @@ ha_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int ret = -1; @@ -982,7 +998,8 @@ ha_symlink_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1036,7 +1053,9 @@ ha_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1163,7 +1182,11 @@ ha_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int ret = -1; @@ -1211,7 +1234,8 @@ ha_link_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1265,7 +1289,9 @@ ha_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1405,7 +1431,9 @@ ha_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1602,7 +1630,7 @@ int32_t ha_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int wbflags) { ha_local_t *local = NULL; ha_private_t *pvt = NULL; @@ -1646,7 +1674,7 @@ ha_open (call_frame_t *frame, ha_open_cbk, children[i], children[i]->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); if (--cnt == 0) break; } @@ -1719,7 +1747,8 @@ ha_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); @@ -1728,7 +1757,8 @@ ha_writev_cbk (call_frame_t *frame, STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); } return 0; } @@ -1820,7 +1850,9 @@ ha_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { int ret = 0; ret = ha_handle_cbk (frame, cookie, op_ret, op_errno); diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 3eb49e2ed..91cf8eb24 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -92,14 +92,15 @@ map_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -109,14 +110,15 @@ map_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, buf->st_ino, &buf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -138,9 +140,10 @@ map_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -149,9 +152,11 @@ map_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -160,9 +165,11 @@ map_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); return 0; } @@ -173,7 +180,11 @@ map_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { call_frame_t *prev = NULL; prev = cookie; @@ -191,7 +202,9 @@ map_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -240,14 +253,15 @@ map_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { call_frame_t *prev = NULL; prev = cookie; - map_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); + map_itransform (this, prev->this, postbuf->st_ino, &postbuf->st_ino); - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -268,9 +282,11 @@ map_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -476,7 +492,9 @@ map_newentry_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -497,7 +515,9 @@ map_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -605,7 +625,8 @@ map_single_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { call_frame_t *prev = NULL; prev = cookie; @@ -625,7 +646,8 @@ map_root_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int callcnt = 0; map_local_t *local = NULL; @@ -1210,7 +1232,7 @@ int32_t map_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int wbflags) { int32_t op_errno = 1; xlator_t *subvol = NULL; @@ -1228,7 +1250,7 @@ map_open (call_frame_t *frame, } STACK_WIND (frame, map_open_cbk, subvol, - subvol->fops->open, loc, flags, fd); + subvol->fops->open, loc, flags, fd, wbflags); return 0; err: diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 5a02d17bc..2d875ab3e 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -70,6 +70,19 @@ stripe_get_matching_bs (const char *path, struct stripe_options *opts, /* + * stripe_common_remove_cbk - + */ +int32_t +stripe_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + struct stat *preparent, struct stat *postparent) +{ + STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); + return 0; +} + + +/* * stripe_common_cbk - */ int32_t @@ -127,6 +140,169 @@ stripe_stack_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } + +int32_t +stripe_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + if (op_ret >= 0) + local->op_ret = op_ret; + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno); + } + return 0; +} + + + +/** + * stripe_stack_unwind_remove_cbk - This function is used for unlink + * _cbk without any extra arguments (other than the minimum given) + * This is called from functions like fsync,unlink,rmdir etc. + * + */ +int32_t +stripe_stack_unwind_unlink_cbk (call_frame_t *frame, void *cookie, + xlator_t *this, int32_t op_ret, + int32_t op_errno, struct stat *preparent, + struct stat *postparent) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + if (op_ret >= 0) + local->op_ret = op_ret; + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno); + } + return 0; +} + + +int32_t +stripe_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned error %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + + if (op_ret == 0) { + local->op_ret = 0; + if (local->stbuf.st_blksize == 0) { + local->stbuf = *postbuf; + /* Because st_blocks gets added again */ + local->stbuf.st_blocks = 0; + } + + if (FIRST_CHILD(this) == + ((call_frame_t *)cookie)->this) { + /* Always, pass the inode number of + first child to the above layer */ + local->stbuf.st_ino = postbuf->st_ino; + local->stbuf.st_mtime = postbuf->st_mtime; + } + + local->stbuf.st_blocks += postbuf->st_blocks; + if (local->stbuf.st_size < postbuf->st_size) + local->stbuf.st_size = postbuf->st_size; + if (local->stbuf.st_blksize != postbuf->st_blksize) { + /* TODO: add to blocks in terms of + original block size */ + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + int32_t stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf) @@ -135,6 +311,76 @@ stripe_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, return 0; } + +int32_t +stripe_stack_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) +{ + int32_t callcnt = 0; + stripe_local_t *local = NULL; + + local = frame->local; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, + "%s returned error %s", + ((call_frame_t *)cookie)->this->name, + strerror (op_errno)); + local->op_errno = op_errno; + if (op_errno == ENOTCONN) + local->failed = 1; + } + + if (op_ret == 0) { + local->op_ret = 0; + if (local->stbuf.st_blksize == 0) { + local->stbuf = *buf; + /* Because st_blocks gets added again */ + local->stbuf.st_blocks = 0; + } + + if (FIRST_CHILD(this) == + ((call_frame_t *)cookie)->this) { + /* Always, pass the inode number of + first child to the above layer */ + local->stbuf.st_ino = buf->st_ino; + local->stbuf.st_mtime = buf->st_mtime; + } + + local->stbuf.st_blocks += buf->st_blocks; + if (local->stbuf.st_size < buf->st_size) + local->stbuf.st_size = buf->st_size; + if (local->stbuf.st_blksize != buf->st_blksize) { + /* TODO: add to blocks in terms of + original block size */ + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->failed) + local->op_ret = -1; + + if (local->loc.path) + loc_wipe (&local->loc); + if (local->loc2.path) + loc_wipe (&local->loc2); + + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + /** * stripe_stack_unwind_buf_cbk - This function is used for all the _cbk with * 'struct stat *buf' as extra argument (other than minimum) @@ -214,9 +460,11 @@ stripe_stack_unwind_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_common_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -232,7 +480,8 @@ int32_t stripe_stack_unwind_inode_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -293,7 +542,7 @@ stripe_stack_unwind_inode_cbk (call_frame_t *frame, void *cookie, int32_t stripe_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { int32_t callcnt = 0; dict_t *tmp_dict = NULL; @@ -611,7 +860,7 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) send_fop_to_all = 1; if (!send_fop_to_all) { - STACK_WIND (frame, stripe_common_buf_cbk, trav->xlator, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->truncate, loc, offset); } else { /* Initialization */ @@ -626,7 +875,7 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->truncate, loc, offset); trav = trav->next; @@ -822,7 +1071,9 @@ stripe_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t stripe_first_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { stripe_local_t *local = NULL; xlator_list_t *trav = NULL; @@ -840,7 +1091,7 @@ stripe_first_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, trav = trav->next; /* Skip first child */ while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, + STACK_WIND (frame, stripe_stack_rename_cbk, trav->xlator, trav->xlator->fops->rename, &local->loc, &local->loc2); trav = trav->next; @@ -933,9 +1184,10 @@ stripe_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) */ int32_t stripe_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -994,7 +1246,7 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) send_fop_to_all = 1; if (!send_fop_to_all) { - STACK_WIND (frame, stripe_common_cbk, trav->xlator, + STACK_WIND (frame, stripe_common_remove_cbk, trav->xlator, trav->xlator->fops->unlink, loc); } else { /* Don't unlink a file if a node is down */ @@ -1014,7 +1266,7 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, + STACK_WIND (frame, stripe_stack_unwind_unlink_cbk, trav->xlator, trav->xlator->fops->unlink, loc); trav = trav->next; @@ -1030,7 +1282,9 @@ stripe_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int32_t stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) + { xlator_list_t *trav = NULL; stripe_local_t *local = NULL; @@ -1047,7 +1301,7 @@ stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, trav = trav->next; /* Skip first child */ while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, trav->xlator, + STACK_WIND (frame, stripe_stack_unwind_unlink_cbk, trav->xlator, trav->xlator->fops->rmdir, &local->loc); trav = trav->next; } @@ -1139,7 +1393,8 @@ stripe_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t stripe_mknod_ifreg_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -1216,7 +1471,8 @@ stripe_mknod_ifreg_setxattr_cbk (call_frame_t *frame, void *cookie, int32_t stripe_mknod_ifreg_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { int ret = 0; int32_t callcnt = 0; @@ -1544,7 +1800,8 @@ stripe_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) int32_t stripe_create_fail_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; fd_t *lfd = NULL; @@ -1632,7 +1889,8 @@ stripe_create_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t stripe_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -2015,7 +2273,7 @@ stripe_open_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, while (trav) { STACK_WIND (frame, stripe_open_cbk, trav->xlator, trav->xlator->fops->open, &local->loc, - local->flags, local->fd); + local->flags, local->fd, 0); trav = trav->next; } } @@ -2035,7 +2293,7 @@ stripe_open_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t stripe_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { stripe_local_t *local = NULL; stripe_private_t *priv = NULL; @@ -2100,7 +2358,8 @@ stripe_open (call_frame_t *frame, xlator_t *this, loc_t *loc, while (trav) { STACK_WIND (frame, stripe_open_cbk, trav->xlator, trav->xlator->fops->open, - &local->loc, local->flags, local->fd); + &local->loc, local->flags, local->fd, + wbflags); trav = trav->next; } } @@ -2464,7 +2723,7 @@ stripe_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_cbk, trav->xlator, + STACK_WIND (frame, stripe_fsync_cbk, trav->xlator, trav->xlator->fops->fsync, fd, flags); trav = trav->next; } @@ -2552,7 +2811,7 @@ stripe_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) local->call_count = priv->child_count; while (trav) { - STACK_WIND (frame, stripe_stack_unwind_buf_cbk, trav->xlator, + STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->ftruncate, fd, offset); trav = trav->next; } @@ -2823,7 +3082,8 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { int32_t callcnt = 0; stripe_local_t *local = NULL; @@ -2844,7 +3104,7 @@ stripe_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } if (op_ret >= 0) { local->op_ret += op_ret; - local->stbuf = *stbuf; + local->stbuf = *postbuf; } } UNLOCK (&frame->lock); diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index b641fb330..80ba10278 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -328,7 +328,8 @@ unify_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -788,7 +789,9 @@ unify_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -849,7 +852,9 @@ unify_ns_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; @@ -928,7 +933,9 @@ unify_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -960,7 +967,9 @@ unify_ns_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int16_t index = 0; unify_private_t *priv = this->private; @@ -1237,7 +1246,8 @@ unify_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { unify_private_t *priv = this->private; unify_local_t *local = NULL; @@ -1305,7 +1315,7 @@ unify_open (call_frame_t *frame, priv->xl_array[file_list[index]]->fops->open, loc, flags, - fd); + fd, wbflags); if (need_break) break; } @@ -1319,7 +1329,9 @@ unify_create_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; inode_t *inode = local->loc1.inode; @@ -1432,7 +1444,8 @@ unify_create_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int32_t callcnt = 0; int16_t index = 0; @@ -1514,7 +1527,7 @@ unify_create_lookup_cbk (call_frame_t *frame, priv->xl_array[file_list[index]]->fops->open, &local->loc1, local->flags, - local->fd); + local->fd, 0); if (need_break) break; } @@ -1535,7 +1548,9 @@ unify_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; unify_local_t *local = frame->local; @@ -1592,7 +1607,9 @@ unify_ns_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -1921,6 +1938,69 @@ unify_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, /** + * unify_ftruncate_cbk - + */ +int32_t +unify_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf) +{ + int32_t callcnt = 0; + unify_private_t *priv = this->private; + unify_local_t *local = frame->local; + call_frame_t *prev_frame = cookie; + + LOCK (&frame->lock); + { + callcnt = --local->call_count; + + if (op_ret == -1) { + gf_log (this->name, GF_LOG_ERROR, + "child(%s): path(%s): %s", + prev_frame->this->name, + (local->loc1.path)?local->loc1.path:"", + strerror (op_errno)); + local->op_errno = op_errno; + if (!((op_errno == ENOENT) && priv->optimist)) + local->op_ret = -1; + } + + if (op_ret >= 0) { + if (NS (this) == prev_frame->this) { + local->st_ino = buf->st_ino; + /* If the entry is directory, get the + stat from NS node */ + if (S_ISDIR (buf->st_mode) || + !local->stbuf.st_blksize) { + local->stbuf = *buf; + } + } + + if ((!S_ISDIR (buf->st_mode)) && + (NS (this) != prev_frame->this)) { + /* If file, take the stat info from + Storage node. */ + local->stbuf = *buf; + } + } + } + UNLOCK (&frame->lock); + + if (!callcnt) { + if (local->st_ino) + local->stbuf.st_ino = local->st_ino; + else + local->op_ret = -1; + unify_local_wipe (local); + STACK_UNWIND (frame, local->op_ret, local->op_errno, + &local->stbuf); + } + + return 0; +} + + + +/** * unify_truncate_cbk - */ int32_t @@ -1929,7 +2009,8 @@ unify_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -1953,20 +2034,20 @@ unify_truncate_cbk (call_frame_t *frame, if (op_ret >= 0) { if (NS (this) == prev_frame->this) { - local->st_ino = buf->st_ino; + local->st_ino = postbuf->st_ino; /* If the entry is directory, get the stat from NS node */ - if (S_ISDIR (buf->st_mode) || + if (S_ISDIR (postbuf->st_mode) || !local->stbuf.st_blksize) { - local->stbuf = *buf; + local->stbuf = *postbuf; } } - if ((!S_ISDIR (buf->st_mode)) && + if ((!S_ISDIR (postbuf->st_mode)) && (NS (this) != prev_frame->this)) { /* If file, take the stat info from Storage node. */ - local->stbuf = *buf; + local->stbuf = *postbuf; } } } @@ -2027,7 +2108,7 @@ unify_truncate (call_frame_t *frame, } /* Don't send truncate to NS node */ - STACK_WIND (frame, unify_truncate_cbk, NS(this), + STACK_WIND (frame, unify_ftruncate_cbk, NS(this), NS(this)->fops->stat, loc); callcnt--; @@ -2057,9 +2138,10 @@ unify_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -2117,7 +2199,9 @@ unify_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_private_t *priv = this->private; @@ -2245,9 +2329,10 @@ unify_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -2307,11 +2392,11 @@ unify_ftruncate (call_frame_t *frame, local->call_count = 2; - STACK_WIND (frame, unify_truncate_cbk, + STACK_WIND (frame, unify_truncate_cbk, child, child->fops->ftruncate, fd, offset); - STACK_WIND (frame, unify_truncate_cbk, + STACK_WIND (frame, unify_ftruncate_cbk, NS(this), NS(this)->fops->fstat, fd); @@ -2363,9 +2448,11 @@ unify_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -3015,7 +3102,9 @@ unify_mknod_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3039,7 +3128,9 @@ unify_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3073,7 +3164,9 @@ unify_ns_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; xlator_t *sched_xl = NULL; @@ -3177,7 +3270,9 @@ unify_symlink_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; if (op_ret == -1) @@ -3199,7 +3294,9 @@ unify_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3238,7 +3335,9 @@ unify_ns_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { struct sched_ops *sched_ops = NULL; @@ -3347,7 +3446,9 @@ unify_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { int32_t callcnt = 0; unify_local_t *local = frame->local; @@ -3382,7 +3483,11 @@ unify_ns_rename_undo_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { unify_local_t *local = frame->local; @@ -3405,7 +3510,11 @@ unify_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3561,7 +3670,11 @@ unify_ns_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { int32_t index = 0; int32_t callcnt = 0; @@ -3680,7 +3793,9 @@ unify_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_local_t *local = frame->local; @@ -3704,7 +3819,9 @@ unify_ns_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { unify_private_t *priv = this->private; unify_local_t *local = frame->local; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 5aee0af41..04b4e67b4 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -52,7 +52,8 @@ error_gen_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -197,12 +198,14 @@ error_gen_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -234,12 +237,14 @@ error_gen_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - buf); + prebuf, + postbuf); return 0; } @@ -308,12 +313,14 @@ error_gen_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, - path); + path, + sbuf); return 0; } @@ -347,7 +354,9 @@ error_gen_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -386,7 +395,9 @@ error_gen_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -422,7 +433,9 @@ error_gen_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -453,7 +466,9 @@ error_gen_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, @@ -489,7 +504,9 @@ error_gen_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -523,7 +540,11 @@ error_gen_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -558,7 +579,9 @@ error_gen_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -594,7 +617,9 @@ error_gen_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -641,7 +666,7 @@ int32_t error_gen_open (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { int op_errno = 0; op_errno = error_gen(this); @@ -655,7 +680,7 @@ error_gen_open (call_frame_t *frame, error_gen_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -713,12 +738,14 @@ error_gen_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } @@ -792,7 +819,9 @@ error_gen_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { STACK_UNWIND (frame, op_ret, diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 662762100..44e037184 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -79,7 +79,9 @@ io_stats_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -144,9 +146,10 @@ io_stats_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -180,9 +183,11 @@ io_stats_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -204,7 +209,9 @@ io_stats_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -216,7 +223,11 @@ io_stats_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -228,9 +239,10 @@ io_stats_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; } @@ -242,7 +254,8 @@ io_stats_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postmaster) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -255,7 +268,9 @@ io_stats_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -268,7 +283,9 @@ io_stats_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -282,7 +299,9 @@ io_stats_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -295,7 +314,9 @@ io_stats_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -330,7 +351,9 @@ io_stats_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -342,9 +365,10 @@ io_stats_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -466,9 +490,10 @@ io_stats_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -863,7 +888,7 @@ io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { BUMP_HIT(OPEN); @@ -873,7 +898,7 @@ io_stats_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, wbflags); return 0; } diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index 2b66720a0..250470762 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -63,7 +63,9 @@ trace_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this); @@ -207,23 +209,24 @@ trace_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this); if (trace_fop_names[GF_FOP_WRITE].enabled) { if (op_ret >= 0) { - strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_atime)); - strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_mtime)); - strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&buf->st_ctime)); + strftime (atime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_atime)); + strftime (mtime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_mtime)); + strftime (ctime_buf, 256, "[%b %d %H:%M:%S]", localtime (&postbuf->st_ctime)); gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_ino=%"PRIu64", " "st_size=%"PRId64", st_blocks=%"PRId64", st_atime=%s, " "st_mtime=%s, st_ctime=%s})", - frame->root->unique, op_ret, buf->st_ino, buf->st_size, - buf->st_blocks, atime_buf, mtime_buf, ctime_buf); + frame->root->unique, op_ret, postbuf->st_ino, postbuf->st_size, + postbuf->st_blocks, atime_buf, mtime_buf, ctime_buf); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -231,7 +234,7 @@ trace_writev_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -282,7 +285,9 @@ trace_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -418,7 +423,9 @@ trace_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -438,7 +445,11 @@ trace_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { ERR_EINVAL_NORETURN (!this ); @@ -459,7 +470,8 @@ trace_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { ERR_EINVAL_NORETURN (!this ); @@ -481,7 +493,8 @@ trace_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -514,7 +527,9 @@ trace_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); @@ -551,7 +566,9 @@ trace_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { char atime_buf[256], mtime_buf[256], ctime_buf[256]; ERR_EINVAL_NORETURN (!this ); @@ -591,7 +608,9 @@ trace_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -613,7 +632,9 @@ trace_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -679,7 +700,9 @@ trace_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { ERR_EINVAL_NORETURN (!this ); @@ -699,7 +722,8 @@ trace_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -708,8 +732,8 @@ trace_truncate_cbk (call_frame_t *frame, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_size=%"PRId64", st_blksize=%" GF_PRI_BLKSIZE", st_blocks=%"PRId64"})", - frame->root->unique, op_ret, buf->st_size, buf->st_blksize, - buf->st_blocks); + frame->root->unique, op_ret, postbuf->st_size, postbuf->st_blksize, + postbuf->st_blocks); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -717,7 +741,7 @@ trace_truncate_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -855,7 +879,8 @@ trace_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { ERR_EINVAL_NORETURN (!this ); @@ -864,8 +889,8 @@ trace_ftruncate_cbk (call_frame_t *frame, gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, *buf {st_size=%"PRId64", " "st_blksize=%"GF_PRI_BLKSIZE", st_blocks=%"PRId64"})", - frame->root->unique, op_ret, buf->st_size, buf->st_blksize, - buf->st_blocks); + frame->root->unique, op_ret, postbuf->st_size, postbuf->st_blksize, + postbuf->st_blocks); } else { gf_log (this->name, GF_LOG_NORMAL, "%"PRId64": (op_ret=%d, op_errno=%d)", @@ -873,7 +898,7 @@ trace_ftruncate_cbk (call_frame_t *frame, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1554,7 +1579,7 @@ trace_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { ERR_EINVAL_NORETURN (!this || !loc); @@ -1570,7 +1595,7 @@ trace_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, wbflags); return 0; } diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index 738b8414f..5d691a2be 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -100,9 +100,10 @@ rot13_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/filter/src/filter.c b/xlators/features/filter/src/filter.c index 673956557..ce31753a4 100644 --- a/xlators/features/filter/src/filter.c +++ b/xlators/features/filter/src/filter.c @@ -202,7 +202,8 @@ filter_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -360,12 +361,13 @@ filter_truncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -410,12 +412,13 @@ filter_ftruncate_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (buf, this->private); + update_stat (postbuf, this->private); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -441,9 +444,10 @@ filter_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *path) + const char *path, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, path); + STACK_UNWIND (frame, op_ret, op_errno, path, sbuf); return 0; } @@ -483,7 +487,9 @@ filter_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; @@ -541,7 +547,9 @@ filter_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -595,7 +603,9 @@ filter_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -644,7 +654,9 @@ filter_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -695,7 +707,9 @@ filter_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -751,7 +765,11 @@ filter_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { if (op_ret >= 0) { update_stat (buf, this->private); @@ -809,7 +827,9 @@ filter_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -856,7 +876,9 @@ filter_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { int ret = 0; if (op_ret >= 0) { @@ -922,7 +944,8 @@ filter_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { int32_t ret = 0; ret = update_frame (frame, loc->inode, this->private); @@ -960,7 +983,7 @@ filter_open (call_frame_t *frame, filter_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -1012,15 +1035,17 @@ filter_writev_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *prebuf, + struct stat *postbuf) { if (op_ret >= 0) { - update_stat (stbuf, this->private); + update_stat (postbuf, this->private); } STACK_UNWIND (frame, op_ret, op_errno, - stbuf); + prebuf, + postbuf); return 0; } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 605902641..379c2d915 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -58,7 +58,8 @@ struct _truncate_ops { int pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct _truncate_ops *local = NULL; @@ -67,7 +68,7 @@ pl_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->op == TRUNCATE) loc_wipe (&local->loc); - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -307,13 +308,13 @@ pl_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -pl_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +pl_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { /* why isn't O_TRUNC being handled ? */ STACK_WIND (frame, pl_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags & ~O_TRUNC, fd); + loc, flags & ~O_TRUNC, fd, wbflags); return 0; } @@ -322,7 +323,8 @@ pl_open (call_frame_t *frame, xlator_t *this, int pl_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); @@ -354,9 +356,10 @@ pl_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int pl_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index b53286104..9657def90 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -134,7 +134,9 @@ path_create_cbk (call_frame_t *frame, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, buf); return 0; @@ -184,9 +186,10 @@ path_readlink_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - const char *buf) + const char *buf, + struct stat *sbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, buf, sbuf); return 0; } @@ -198,7 +201,8 @@ path_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -212,7 +216,9 @@ path_symlink_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -225,7 +231,9 @@ path_mknod_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -239,7 +247,9 @@ path_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -252,7 +262,9 @@ path_link_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, + struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -271,7 +283,25 @@ path_opendir_cbk (call_frame_t *frame, } -int32_t +int32_t +path_rename_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + + +int32_t path_common_buf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -296,6 +326,25 @@ path_common_dict_cbk (call_frame_t *frame, } int32_t +path_common_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *preparent, + struct stat *postparent) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + +int32_t +path_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno,struct stat *prebuf, + struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + +int32_t path_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -465,7 +514,7 @@ path_unlink (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); @@ -492,7 +541,7 @@ path_rmdir (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_cbk, + path_common_remove_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); @@ -558,7 +607,7 @@ path_rename (call_frame_t *frame, newloc->path = tmp_newloc_path; STACK_WIND (frame, - path_common_buf_cbk, + path_rename_buf_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, @@ -677,7 +726,7 @@ path_truncate (call_frame_t *frame, loc->path = tmp_path; STACK_WIND (frame, - path_common_buf_cbk, + path_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, @@ -696,7 +745,8 @@ path_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { char *loc_path = (char *)loc->path; char *tmp_path = NULL; @@ -713,7 +763,8 @@ path_open (call_frame_t *frame, FIRST_CHILD(this)->fops->open, loc, flags, - fd); + fd, + wbflags); loc->path = loc_path; if (tmp_path != loc_path) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 94a7ec83b..e6c5b5dbf 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -154,7 +154,8 @@ gf_quota_check_free_disk (xlator_t *this) int quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = this->private; struct quota_local *local = NULL; @@ -163,11 +164,11 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); loc_wipe (&local->loc); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -225,7 +226,8 @@ quota_truncate (call_frame_t *frame, xlator_t *this, int quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -235,11 +237,11 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if ((op_ret >= 0) && priv->disk_usage_limit) { gf_quota_usage_subtract (this, (local->stbuf.st_blocks - - buf->st_blocks) * 512); + postbuf->st_blocks) * 512); fd_unref (local->fd); } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -299,7 +301,8 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, int quota_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -349,7 +352,8 @@ quota_mknod (call_frame_t *frame, xlator_t *this, int quota_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -399,7 +403,8 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) int quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -473,7 +478,8 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { struct quota_local *local = NULL; @@ -543,7 +549,8 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) int quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { struct quota_priv *priv = NULL; @@ -593,7 +600,8 @@ quota_symlink (call_frame_t *frame, xlator_t *this, int quota_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { struct quota_priv *priv = this->private; int ret = 0; @@ -656,20 +664,21 @@ quota_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -quota_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) +quota_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, int32_t wbflags) { STACK_WIND (frame, quota_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } int quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { struct quota_priv *priv = NULL; struct quota_local *local = NULL; @@ -680,14 +689,14 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (priv->disk_usage_limit) { if (op_ret >= 0) { - gf_quota_usage_add (this, (stbuf->st_blocks - + gf_quota_usage_add (this, (postbuf->st_blocks - local->stbuf.st_blocks) * 512); } fd_unref (local->fd); iobref_unref (local->iobref); } - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c index fa5d752ea..cc5a69152 100644 --- a/xlators/features/trash/src/trash.c +++ b/xlators/features/trash/src/trash.c @@ -56,14 +56,22 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); int32_t trash_rename_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf); + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent); /** * trash_common_unwind_cbk - @@ -73,7 +81,9 @@ trash_common_unwind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; @@ -91,6 +101,39 @@ trash_common_unwind_cbk (call_frame_t *frame, return 0; } + +/** + * trash_rename_unwind_buf_cbk - + */ +int32_t +trash_rename_unwind_buf_cbk (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno, + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) +{ + trash_local_t *local = frame->local; + + if (!local) + goto out; + + if (local->loc1.path) + loc_wipe (&local->loc1); + + if (local->loc2.path) + loc_wipe (&local->loc2); + + out: + STACK_UNWIND (frame, op_ret, op_errno, buf); + return 0; +} + + /** * trash_common_unwind_buf_cbk - */ @@ -125,7 +168,9 @@ trash_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -189,7 +234,11 @@ trash_unlink_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -302,7 +351,9 @@ trash_rename_mkdir_cbk (call_frame_t *frame, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, + struct stat *preparent, + struct stat *postparent) { trash_local_t *local = frame->local; char *tmp_str = strdup (local->newpath); @@ -367,7 +418,11 @@ trash_rename_rename_cbk (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *buf) + struct stat *buf, + struct stat *preoldparent, + struct stat *postoldparent, + struct stat *prenewparent, + struct stat *postnewparent) { trash_local_t *local = frame->local; if (op_ret == -1 && op_errno == ENOENT) { @@ -407,7 +462,7 @@ trash_rename_rename_cbk (call_frame_t *frame, .path = local->loc2.path, }; STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -427,13 +482,14 @@ trash_rename_lookup_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *buf, - dict_t *xattr) + dict_t *xattr, + struct stat *postparent) { trash_local_t *local = frame->local; if (op_ret == -1) { STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, &local->loc1, @@ -481,7 +537,7 @@ trash_rename (call_frame_t *frame, /* Trying to rename from the trash can dir, do the actual rename */ STACK_WIND (frame, - trash_common_unwind_buf_cbk, + trash_rename_unwind_buf_cbk, this->children->xlator, this->children->xlator->fops->rename, oldloc, diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index b002d264c..8b97800a9 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -494,7 +494,117 @@ stat2attr (struct stat *st, struct fuse_attr *fa) static int fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict); + inode_t *inode, struct stat *stat, dict_t *dict, + struct stat *postparent); + + +static int +fuse_newentry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) +{ + fuse_state_t *state = NULL; + fuse_in_header_t *finh = NULL; + struct fuse_entry_out feo = {0, }; + struct fuse_attr_out *fao = NULL; + fuse_private_t *priv = NULL; + + priv = this->private; + state = frame->root->state; + finh = state->finh; + + if (!op_ret && state->loc.ino == 1) { + buf->st_ino = 1; + } + + if (state->is_revalidate == 1 + && need_fresh_lookup (op_ret, op_errno, &state->loc, buf)) { + inode_unref (state->loc.inode); + state->loc.inode = inode_new (state->itable); + state->is_revalidate = 2; + + STACK_WIND (frame, fuse_lookup_cbk, + FIRST_CHILD (this), + FIRST_CHILD (this)->fops->lookup, + &state->loc, state->dict); + + return 0; + } + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => %"PRId64" (%"PRId64")", + frame->root->unique, gf_fop_list[frame->root->op], + state->loc.path, buf->st_ino, state->loc.ino); + + inode_link (inode, state->loc.parent, state->loc.name, buf); + + inode_lookup (inode); + + buf->st_blksize = this->ctx->page_size; + stat2attr (buf, &feo.attr); + + if (!inode->ino || !buf->st_ino) { + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s returning inode 0", + frame->root->unique, + gf_fop_list[frame->root->op], state->loc.path); + } + + if (state->loc.parent) { + /* TODO: make these timeouts configurable (via meta?) */ + feo.nodeid = inode->ino; + +#ifdef GF_DARWIN_HOST_OS + feo.generation = 0; +#else + feo.generation = buf->st_ctime; +#endif + + feo.entry_valid = + calc_timeout_sec (priv->entry_timeout); + feo.entry_valid_nsec = + calc_timeout_nsec (priv->entry_timeout); + feo.attr_valid = + calc_timeout_sec (priv->attribute_timeout); + feo.attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, &feo) : + send_fuse_data (this, finh, &feo, + FUSE_COMPAT_ENTRY_OUT_SIZE); + } else { + /* Refurbish the entry_out as attr_out. Too hacky?... */ + fao = (struct fuse_attr_out *) + ((char *)&feo.attr - + offsetof (struct fuse_attr_out, attr)); + + fao->attr_valid = + calc_timeout_sec (priv->attribute_timeout); + fao->attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, fao) : + send_fuse_data (this, finh, fao, + FUSE_COMPAT_ATTR_OUT_SIZE); + } + } else { + gf_log ("glusterfs-fuse", + (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_WARNING), + "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, + gf_fop_list[frame->root->op], state->loc.path, + strerror (op_errno)); + send_fuse_err (this, state->finh, op_errno); + } + + free_state (state); + STACK_DESTROY (frame->root); + return 0; +} + static int fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -606,7 +716,8 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stat, dict_t *dict) + inode_t *inode, struct stat *stat, dict_t *dict, + struct stat *postparent) { fuse_entry_cbk (frame, cookie, this, op_ret, op_errno, inode, stat); return 0; @@ -682,6 +793,62 @@ fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg) FREE (finh); } + + +static int +fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *postbuf) +{ + fuse_state_t *state; + fuse_in_header_t *finh; + fuse_private_t *priv = NULL; + struct fuse_attr_out fao; + + priv = this->private; + state = frame->root->state; + finh = state->finh; + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => %"PRId64, frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + buf->st_ino); + + /* TODO: make these timeouts configurable via meta */ + /* TODO: what if the inode number has changed by now */ + buf->st_blksize = this->ctx->page_size; + stat2attr (buf, &fao.attr); + + fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); + fao.attr_valid_nsec = + calc_timeout_nsec (priv->attribute_timeout); + + priv->proto_minor >= 9 ? + send_fuse_obj (this, finh, &fao) : + send_fuse_data (this, finh, &fao, + FUSE_COMPAT_ATTR_OUT_SIZE); + } else { + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + strerror (op_errno)); + + if (can_fuse_return (state, 0)) + send_fuse_err (this, finh, op_errno); + } + + if (state->callcount == 0) { + free_state (state); + STACK_DESTROY (frame->root); + } + + return 0; +} + + static int @@ -926,10 +1093,10 @@ static void fuse_do_truncate (fuse_state_t *state, struct fuse_setattr_in *fsi) { if (state->fd) { - FUSE_FOP (state, fuse_attr_cbk, GF_FOP_FTRUNCATE, + FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_FTRUNCATE, ftruncate, state->fd, fsi->size); } else { - FUSE_FOP (state, fuse_attr_cbk, GF_FOP_TRUNCATE, + FUSE_FOP (state, fuse_truncate_cbk, GF_FOP_TRUNCATE, truncate, &state->loc, fsi->size); } @@ -1032,6 +1199,58 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) static int gf_fuse_xattr_enotsup_log; +static int +fuse_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + fuse_state_t *state = frame->root->state; + fuse_in_header_t *finh = state->finh; + + if (op_ret == 0) { + gf_log ("glusterfs-fuse", GF_LOG_TRACE, + "%"PRIu64": %s() %s => 0", frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR"); + + send_fuse_err (this, finh, 0); + } else { + if (frame->root->op == GF_FOP_SETXATTR) { + op_ret = gf_compat_setxattr (state->dict); + if (op_ret == 0) + op_errno = 0; + if (op_errno == ENOTSUP) { + gf_fuse_xattr_enotsup_log++; + if (!(gf_fuse_xattr_enotsup_log % GF_UNIVERSAL_ANSWER)) + gf_log ("glusterfs-fuse", + GF_LOG_CRITICAL, + "extended attribute not " + "supported by the backend " + "storage"); + } + } else { + if ((frame->root->op == GF_FOP_REMOVEXATTR) + && (op_errno == ENOATTR)) { + goto nolog; + } + gf_log ("glusterfs-fuse", GF_LOG_WARNING, + "%"PRIu64": %s() %s => -1 (%s)", + frame->root->unique, + gf_fop_list[frame->root->op], + state->loc.path ? state->loc.path : "ERR", + strerror (op_errno)); + } + nolog: + + send_fuse_err (this, finh, op_errno); + } + + free_state (state); + STACK_DESTROY (frame->root); + + return 0; +} + static int fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1087,7 +1306,8 @@ fuse_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int fuse_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1157,7 +1377,8 @@ fuse_access (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *linkname) + int32_t op_ret, int32_t op_errno, const char *linkname, + struct stat *buf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1249,7 +1470,7 @@ fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": MKNOD %s", finh->unique, state->loc.path); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_MKNOD, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKNOD, mknod, &state->loc, fmi->mode, fmi->rdev); return; @@ -1282,7 +1503,7 @@ fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": MKDIR %s", finh->unique, state->loc.path); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_MKDIR, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKDIR, mkdir, &state->loc, fmi->mode); return; @@ -1379,7 +1600,7 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": SYMLINK %s -> %s", finh->unique, state->loc.path, linkname); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_SYMLINK, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_SYMLINK, symlink, linkname, &state->loc); return; @@ -1388,7 +1609,9 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg) int fuse_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1513,7 +1736,7 @@ fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) finh->unique, state->loc2.path, state->loc2.ino, state->loc.path, state->loc.ino); - FUSE_FOP (state, fuse_entry_cbk, GF_FOP_LINK, + FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_LINK, link, &state->loc2, &state->loc); return; @@ -1523,7 +1746,8 @@ fuse_link (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *buf) + fd_t *fd, inode_t *inode, struct stat *buf, + struct stat *preparent, struct stat *postparent) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1683,7 +1907,7 @@ fuse_open (xlator_t *this, fuse_in_header_t *finh, void *msg) state->loc.path); FUSE_FOP (state, fuse_fd_cbk, GF_FOP_OPEN, - open, &state->loc, foi->flags, fd); + open, &state->loc, foi->flags, fd, 0); return; } @@ -1761,7 +1985,7 @@ fuse_readv (xlator_t *this, fuse_in_header_t *finh, void *msg) static int fuse_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct stat *stbuf) + struct stat *stbuf, struct stat *postbuf) { fuse_state_t *state = NULL; fuse_in_header_t *finh = NULL; @@ -1949,7 +2173,7 @@ fuse_fsync (xlator_t *this, fuse_in_header_t *finh, void *msg) "%"PRIu64": FSYNC %p", finh->unique, fd); /* fsync_flags: 1 means "datasync" (no defines for this) */ - FUSE_FOP (state, fuse_err_cbk, GF_FOP_FSYNC, + FUSE_FOP (state, fuse_fsync_cbk, GF_FOP_FSYNC, fsync, fd, fsi->fsync_flags & 1); return; @@ -2810,7 +3034,8 @@ static fuse_handler_t *fuse_ops[FUSE_712_OP_HIGH]; int fuse_root_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { fuse_private_t *priv = NULL; diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index db1e204fd..53c7b1f10 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -163,7 +163,7 @@ ioc_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t ioc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf, dict_t *dict) + struct stat *stbuf, dict_t *dict, struct stat *postparent) { ioc_inode_t *ioc_inode = NULL; ioc_local_t *local = frame->local; @@ -745,7 +745,8 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { ioc_local_t *local = NULL; ioc_table_t *table = NULL; @@ -811,7 +812,7 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int32_t ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { ioc_local_t *local = NULL; @@ -830,7 +831,7 @@ ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, frame->local = local; STACK_WIND (frame, ioc_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; } @@ -1160,7 +1161,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { ioc_local_t *local = NULL; uint64_t ioc_inode = 0; @@ -1171,7 +1173,7 @@ ioc_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ioc_inode) ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1230,13 +1232,37 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, */ int32_t ioc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } + +/* + * ioc_ftruncate_cbk - + * + * @frame: + * @cookie: + * @this: + * @op_ret: + * @op_errno: + * @buf: + * + */ +int32_t +ioc_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + /* * ioc_truncate - * @@ -1278,7 +1304,7 @@ ioc_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) if (ioc_inode) ioc_inode_flush ((ioc_inode_t *)(long)ioc_inode); - STACK_WIND (frame, ioc_truncate_cbk, FIRST_CHILD(this), + STACK_WIND (frame, ioc_ftruncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset); return 0; } diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index dc4b55616..3a7504f32 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -316,7 +316,8 @@ out: int iot_lookup_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf, xattr); return 0; @@ -516,7 +517,8 @@ out: int iot_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *sbuf) { STACK_UNWIND (frame, op_ret, op_errno, path); return 0; @@ -568,7 +570,8 @@ out: int iot_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -618,7 +621,8 @@ out: int iot_mkdir_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -665,7 +669,8 @@ out: int iot_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -712,7 +717,8 @@ out: int iot_symlink_cbk (call_frame_t *frame, void * cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; @@ -762,7 +768,9 @@ out: int iot_rename_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { STACK_UNWIND (frame, op_ret, op_errno, buf); return 0; @@ -820,22 +828,22 @@ iot_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int iot_open_wrapper (call_frame_t * frame, xlator_t * this, loc_t *loc, - int32_t flags, fd_t * fd) + int32_t flags, fd_t * fd, int32_t wbflags) { STACK_WIND (frame, iot_open_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->open, loc, flags, fd); + FIRST_CHILD (this)->fops->open, loc, flags, fd, wbflags); return 0; } int iot_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { call_stub_t *stub = NULL; int ret = -1; - stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd); + stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd, wbflags); if (!stub) { gf_log (this->name, GF_LOG_ERROR, "cannot create open call stub" @@ -863,7 +871,8 @@ out: int iot_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, fd, inode, stbuf); return 0; @@ -1020,9 +1029,10 @@ out: int iot_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1071,9 +1081,10 @@ out: int iot_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1288,9 +1299,10 @@ out: int iot_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1349,9 +1361,10 @@ out: int iot_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1450,7 +1463,8 @@ out: int iot_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno); return 0; @@ -1503,7 +1517,7 @@ out: int iot_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, struct stat *postparent) { STACK_UNWIND (frame, op_ret, op_errno, inode, buf); return 0; diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 1249da87b..3e732e51a 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -149,7 +149,7 @@ out: int32_t qr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { data_t *content = NULL; qr_file_t *qr_file = NULL; @@ -415,7 +415,7 @@ out: int32_t qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { qr_file_t *qr_file = NULL; int32_t ret = -1; @@ -516,7 +516,7 @@ unwind: wind: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; } @@ -709,7 +709,7 @@ qr_validate_cache (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - &loc, flags, fd); + &loc, flags, fd, 0); qr_loc_wipe (&loc); } else if (can_wind) { @@ -949,7 +949,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - &loc, flags, fd); + &loc, flags, fd, 0); qr_loc_wipe (&loc); } else if (can_wind) { @@ -974,10 +974,11 @@ out: int32_t -qr_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *stbuf) +qr_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1081,7 +1082,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1174,7 +1175,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1274,7 +1275,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1372,7 +1373,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, &loc, open_flags, - fd); + fd, 0); qr_loc_wipe (&loc); } @@ -1472,7 +1473,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1644,7 +1645,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1743,7 +1744,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -1754,9 +1755,9 @@ out: int32_t qr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1836,7 +1837,7 @@ out: STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, &loc, open_flags, - fd); + fd, 0); qr_loc_wipe (&loc); } @@ -1847,7 +1848,8 @@ out: int32_t qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { int32_t ret = 0; uint64_t value = 0; @@ -1873,7 +1875,8 @@ qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (qr_file) { LOCK (&qr_file->lock); { - if (qr_file->stbuf.st_size != buf->st_size) { + if (qr_file->stbuf.st_size != postbuf->st_size) + { dict_unref (qr_file->xattr); qr_file->xattr = NULL; } @@ -1883,7 +1886,7 @@ qr_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } out: - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1977,7 +1980,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } @@ -2073,7 +2076,7 @@ out: } STACK_WIND (frame, qr_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, &loc, flags, fd); + FIRST_CHILD(this)->fops->open, &loc, flags, fd, 0); qr_loc_wipe (&loc); } diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c index 6d1c5a2bc..a6b6f2f25 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -112,7 +112,8 @@ unwind: int ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { ra_conf_t *conf = NULL; ra_file_t *file = NULL; @@ -177,12 +178,12 @@ unwind: int ra_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { STACK_WIND (frame, ra_open_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -525,6 +526,16 @@ ra_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, } + +int +ra_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + int ra_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) { @@ -577,7 +588,7 @@ ra_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync) flush_region (frame, file, 0, file->pages.prev->offset+1); } - STACK_WIND (frame, ra_flush_cbk, + STACK_WIND (frame, ra_fsync_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->fsync, fd, datasync); @@ -591,7 +602,8 @@ unwind: int ra_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { fd_t *fd = NULL; ra_file_t *file = NULL; @@ -606,7 +618,7 @@ ra_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, flush_region (frame, file, 0, file->pages.prev->offset+1); frame->local = NULL; - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -650,6 +662,16 @@ unwind: int +ra_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) +{ + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + +int ra_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct stat *buf) { @@ -683,7 +705,7 @@ ra_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) } UNLOCK (&inode->lock); - STACK_WIND (frame, ra_attr_cbk, + STACK_WIND (frame, ra_truncate_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->truncate, loc, offset); @@ -748,7 +770,7 @@ ra_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) } UNLOCK (&inode->lock); - STACK_WIND (frame, ra_attr_cbk, + STACK_WIND (frame, ra_truncate_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->ftruncate, fd, offset); diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 67a61fc47..e2771314a 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -362,7 +362,7 @@ unlock: int32_t sp_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { struct stat *stbuf = NULL; int32_t ret = -1; @@ -401,7 +401,7 @@ out: int32_t sp_lookup_behind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf, dict_t *dict) + struct stat *buf, dict_t *dict, struct stat *postparent) { sp_local_t *local = NULL; sp_cache_t *cache = NULL; @@ -672,10 +672,24 @@ unwind: int32_t -sp_stbuf_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *buf) +sp_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - SP_STACK_UNWIND (frame, op_ret, op_errno, buf); + SP_STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); + return 0; +} + + + +int32_t +sp_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *buf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, buf, preoldparent, + postoldparent, prenewparent, postnewparent); return 0; } @@ -712,7 +726,7 @@ out: int32_t sp_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int wbflags) { sp_local_t *local = NULL; int32_t ret = -1; @@ -728,7 +742,7 @@ sp_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, } STACK_WIND (frame, sp_fd_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, loc, flags, fd); + FIRST_CHILD(this)->fops->open, loc, flags, fd, wbflags); return 0; unwind: @@ -740,7 +754,8 @@ unwind: static int32_t sp_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { sp_local_t *local = NULL; sp_fd_ctx_t *fd_ctx = NULL; @@ -837,9 +852,11 @@ unwind: int32_t sp_new_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { - STACK_UNWIND (frame, op_ret, op_errno, inode, buf); + STACK_UNWIND (frame, op_ret, op_errno, inode, buf, preparent, + postparent); return 0; } @@ -972,7 +989,7 @@ sp_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) sp_cache_remove_entry (cache, (char *)loc->name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, offset); return 0; @@ -1007,7 +1024,7 @@ sp_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset) sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset); return 0; @@ -1054,9 +1071,10 @@ unwind: int32_t sp_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path) + int32_t op_ret, int32_t op_errno, const char *path, + struct stat *buf) { - SP_STACK_UNWIND (frame, op_ret, op_errno, path); + SP_STACK_UNWIND (frame, op_ret, op_errno, path, buf); return 0; } @@ -1084,6 +1102,16 @@ unwind: return 0; } +int32_t +sp_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) +{ + SP_STACK_UNWIND (frame, op_ret, op_errno, preparent, postparent); + return 0; +} + + int32_t sp_err_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1115,7 +1143,7 @@ sp_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) goto unwind; } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc); return 0; @@ -1169,7 +1197,7 @@ sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) goto unwind; } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc); return 0; @@ -1251,7 +1279,7 @@ sp_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, iobref); return 0; @@ -1287,7 +1315,7 @@ sp_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags) sp_cache_remove_entry (cache, name, 0); } - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags); return 0; @@ -1338,7 +1366,7 @@ sp_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,loc_t *newloc) sp_remove_caches_from_all_fds_opened (this, oldloc->inode); } - STACK_WIND (frame, sp_stbuf_cbk, FIRST_CHILD(this), + STACK_WIND (frame, sp_rename_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, newloc); return 0; diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c index ad0836c5e..791fde3c5 100644 --- a/xlators/performance/symlink-cache/src/symlink-cache.c +++ b/xlators/performance/symlink-cache/src/symlink-cache.c @@ -242,7 +242,7 @@ sc_cache_get (xlator_t *this, inode_t *inode, char **link) int sc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - const char *link) + const char *link, struct stat *sbuf) { if (op_ret > 0) sc_cache_update (this, frame->local, link); @@ -287,7 +287,8 @@ sc_readlink (call_frame_t *frame, xlator_t *this, int sc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *buf) + inode_t *inode, struct stat *buf, struct stat *preparent, + struct stat *postparent) { if (op_ret == 0) { if (frame->local) { @@ -318,7 +319,8 @@ sc_symlink (call_frame_t *frame, xlator_t *this, int sc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, int op_errno, - inode_t *inode, struct stat *buf, dict_t *xattr) + inode_t *inode, struct stat *buf, dict_t *xattr, + struct stat *postparent) { if (op_ret == 0) sc_cache_validate (this, inode, buf); diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 300d68465..57311f6d4 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -310,7 +310,7 @@ wb_file_destroy (wb_file_t *file) int32_t wb_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, struct stat *stbuf) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { wb_local_t *local = NULL; list_head_t *winds = NULL; @@ -774,7 +774,8 @@ wb_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) int32_t wb_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -795,7 +796,7 @@ wb_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); if (request) { wb_request_unref (request); @@ -916,7 +917,8 @@ wb_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) int32_t wb_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -936,7 +938,7 @@ wb_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -1211,7 +1213,7 @@ wb_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { frame->local = (void *)(long)flags; @@ -1219,7 +1221,7 @@ wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, wb_open_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, - loc, flags, fd); + loc, flags, fd, wbflags); return 0; } @@ -1227,7 +1229,8 @@ wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, int32_t wb_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct stat *buf) + struct stat *buf, struct stat *preparent, + struct stat *postparent) { long flags = 0; wb_file_t *file = NULL; @@ -1702,9 +1705,10 @@ out: int32_t wb_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { - STACK_UNWIND (frame, op_ret, op_errno, stbuf); + STACK_UNWIND (frame, op_ret, op_errno, prebuf, postbuf); return 0; } @@ -2124,7 +2128,7 @@ wb_flush (call_frame_t *frame, xlator_t *this, fd_t *fd) static int32_t wb_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno) + int32_t op_errno, struct stat *prebuf, struct stat *postbuf) { wb_local_t *local = NULL; wb_file_t *file = NULL; diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 43f997706..b3014463f 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -708,7 +708,7 @@ unwind: int client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, int32_t wbflags) { int ret = -1; gf_hdr_common_t *hdr = NULL; @@ -744,6 +744,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, req->ino = hton64 (ino); req->flags = hton32 (gf_flags_from_flags (flags)); + req->wbflags = hton32 (wbflags); strcpy (req->path, loc->path); ret = protocol_client_xfer (frame, this, @@ -3941,7 +3942,7 @@ client_truncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->prestat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4001,7 +4002,7 @@ client_ftruncate_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret == 0) { - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->prestat, &stbuf); } STACK_UNWIND (frame, op_ret, op_errno, &stbuf); @@ -4078,7 +4079,7 @@ client_write_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); if (op_ret >= 0) - gf_stat_to_stat (&rsp->stat, &stbuf); + gf_stat_to_stat (&rsp->poststat, &stbuf); STACK_UNWIND (frame, op_ret, op_errno, &stbuf); diff --git a/xlators/protocol/server/src/server-dentry.c b/xlators/protocol/server/src/server-dentry.c index d3a69a393..940bc3bee 100644 --- a/xlators/protocol/server/src/server-dentry.c +++ b/xlators/protocol/server/src/server-dentry.c @@ -218,7 +218,8 @@ __do_path_resolve_cbk (call_frame_t *frame, int32_t op_errno, inode_t *inode, struct stat *stbuf, - dict_t *dict) + dict_t *dict, + struct stat *postparent) { server_state_t *state = NULL; call_stub_t *stub = NULL; diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 8e4e9e725..a37f4da43 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -405,7 +405,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rmdir_rsp_t *rsp = NULL; @@ -435,6 +436,11 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); + if (op_ret == 0) { + gf_stat_from_stat (&rsp->preparent, preparent); + gf_stat_from_stat (&rsp->postparent, postparent); + } + server_loc_wipe (&(state->loc)); protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_RMDIR, @@ -457,7 +463,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mkdir_rsp_t *rsp = NULL; @@ -508,7 +515,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf) + inode_t *inode, struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_mknod_rsp_t *rsp = NULL; @@ -1116,7 +1124,9 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *stbuf, + struct stat *preoldparent, struct stat *postoldparent, + struct stat *prenewparent, struct stat *postnewparent) { gf_hdr_common_t *hdr = NULL; gf_fop_rename_rsp_t *rsp = NULL; @@ -1174,7 +1184,8 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_unlink_rsp_t *rsp = NULL; @@ -1210,6 +1221,11 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_errno = gf_errno_to_error (op_errno); hdr->rsp.op_errno = hton32 (gf_errno); + if (op_ret == 0) { + gf_stat_from_stat (&rsp->preparent, preparent); + gf_stat_from_stat (&rsp->postparent, postparent); + } + server_loc_wipe (&(state->loc)); protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UNLINK, @@ -1231,7 +1247,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_symlink_rsp_t *rsp = NULL; @@ -1283,7 +1300,8 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, - struct stat *stbuf) + struct stat *stbuf, struct stat *preparent, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_link_rsp_t *rsp = NULL; @@ -1347,7 +1365,8 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_truncate_rsp_t *rsp = NULL; @@ -1366,7 +1385,7 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->prestat, prebuf); } else { gf_log (this->name, GF_LOG_DEBUG, "%"PRId64": TRUNCATE %s (%"PRId64") ==> %"PRId32" (%s)", @@ -1443,7 +1462,8 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_ftruncate_rsp_t *rsp = NULL; @@ -1460,7 +1480,7 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno); if (op_ret == 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->prestat, prebuf); } else { state = CALL_STATE (frame); @@ -1533,7 +1553,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_fsync_rsp_t *rsp = NULL; @@ -1610,7 +1631,8 @@ server_release_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *stbuf) + int32_t op_ret, int32_t op_errno, struct stat *prebuf, + struct stat *postbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_write_rsp_t *rsp = NULL; @@ -1627,7 +1649,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno)); if (op_ret >= 0) { - gf_stat_from_stat (&rsp->stat, stbuf); + gf_stat_from_stat (&rsp->poststat, postbuf); } else { state = CALL_STATE(frame); @@ -1772,7 +1794,8 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct stat *stbuf) + fd_t *fd, inode_t *inode, struct stat *stbuf, + struct stat *preparent, struct stat *postparent) { server_connection_t *conn = NULL; gf_hdr_common_t *hdr = NULL; @@ -1848,7 +1871,8 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *buf) + int32_t op_ret, int32_t op_errno, const char *buf, + struct stat *sbuf) { gf_hdr_common_t *hdr = NULL; gf_fop_readlink_rsp_t *rsp = NULL; @@ -2064,7 +2088,8 @@ server_fsetattr_cbk (call_frame_t *frame, int server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, - inode_t *inode, struct stat *stbuf, dict_t *dict) + inode_t *inode, struct stat *stbuf, dict_t *dict, + struct stat *postparent) { gf_hdr_common_t *hdr = NULL; gf_fop_lookup_rsp_t *rsp = NULL; @@ -2346,7 +2371,8 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, */ server_rename_cbk (stub->frame, NULL, stub->frame->this, - -1, ENOENT, NULL); + -1, ENOENT, NULL, NULL, NULL, NULL, + NULL); server_loc_wipe (&stub->args.rename.old); server_loc_wipe (&stub->args.rename.new); FREE (stub); @@ -2438,7 +2464,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_lookup_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.lookup.loc); FREE (stub); return 0; @@ -2528,7 +2554,8 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, BOUND_XL(stub->frame)->name, op_ret, op_errno); server_unlink_cbk (stub->frame, NULL, - stub->frame->this, -1, ENOENT); + stub->frame->this, -1, ENOENT, NULL, + NULL); server_loc_wipe (&stub->args.unlink.loc); FREE (stub); return 0; @@ -2558,7 +2585,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, op_ret, op_errno); server_symlink_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.symlink.loc); FREE (stub); return 0; @@ -2587,7 +2614,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, BOUND_XL(stub->frame)->name, op_ret, op_errno); server_rmdir_cbk (stub->frame, NULL, stub->frame->this, - -1, ENOENT); + -1, ENOENT, NULL, NULL); server_loc_wipe (&stub->args.rmdir.loc); FREE (stub); return 0; @@ -2621,7 +2648,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_link_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.link.oldloc); server_loc_wipe (&stub->args.link.newloc); FREE (stub); @@ -2659,7 +2686,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_link_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.link.oldloc); server_loc_wipe (&stub->args.link.newloc); @@ -2698,7 +2725,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_truncate_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL); + NULL, NULL); server_loc_wipe (&stub->args.truncate.loc); FREE (stub); return 0; @@ -2918,7 +2945,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_readlink_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL); + NULL, NULL); server_loc_wipe (&stub->args.readlink.loc); FREE (stub); return 0; @@ -2948,7 +2975,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_mkdir_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL); + NULL, NULL, NULL, NULL); server_loc_wipe (&stub->args.mkdir.loc); FREE (stub); break; @@ -2979,7 +3006,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_create_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, - NULL, NULL, NULL); + NULL, NULL, NULL, NULL, NULL); if (stub->args.create.fd) fd_unref (stub->args.create.fd); server_loc_wipe (&stub->args.create.loc); @@ -3012,7 +3039,7 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno, server_mknod_cbk (stub->frame, NULL, stub->frame->this, -1, ENOENT, NULL, - NULL); + NULL, NULL, NULL); server_loc_wipe (&stub->args.mknod.loc); FREE (stub); break; @@ -3255,7 +3282,7 @@ server_lookup (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: server_lookup_cbk (frame, NULL, frame->this, -1,EINVAL, NULL, NULL, - NULL); + NULL, NULL); if (xattr_req) dict_unref (xattr_req); @@ -3515,7 +3542,7 @@ server_readlink (call_frame_t *frame, xlator_t *bound_xl, } return 0; fail: - server_readlink_cbk (frame, NULL,frame->this, -1, EINVAL, NULL); + server_readlink_cbk (frame, NULL,frame->this, -1, EINVAL, NULL, NULL); return 0; } @@ -3551,7 +3578,7 @@ server_create_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, return 0; fail: server_create_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, - NULL); + NULL, NULL, NULL); return 0; } @@ -3606,14 +3633,14 @@ server_create (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: server_create_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL, - NULL); + NULL, NULL, NULL); return 0; } int server_open_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, fd_t *fd) + int32_t flags, fd_t *fd, int32_t wbflags) { server_state_t *state = NULL; fd_t *new_fd = NULL; @@ -3633,7 +3660,7 @@ server_open_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, STACK_WIND (frame, server_open_cbk, BOUND_XL(frame), BOUND_XL(frame)->fops->open, - loc, flags, state->fd); + loc, flags, state->fd, wbflags); return 0; fail: @@ -3673,7 +3700,7 @@ server_open (call_frame_t *frame, xlator_t *bound_xl, open_stub = fop_open_stub (frame, server_open_resume, - &(state->loc), state->flags, NULL); + &(state->loc), state->flags, NULL, 0); GF_VALIDATE_OR_GOTO(bound_xl->name, open_stub, fail); if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) || @@ -3803,7 +3830,7 @@ server_writev (call_frame_t *frame, xlator_t *bound_xl, return 0; fail: - server_writev_cbk (frame, NULL, frame->this, -1, EINVAL, NULL); + server_writev_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); if (iobref) iobref_unref (iobref); @@ -3892,7 +3919,7 @@ server_fsync (call_frame_t *frame, xlator_t *bound_xl, state->fd, state->flags); return 0; fail: - server_fsync_cbk (frame, NULL, frame->this, -1, EINVAL); + server_fsync_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); return 0; } @@ -3990,7 +4017,7 @@ server_ftruncate (call_frame_t *frame, xlator_t *bound_xl, state->fd, state->offset); return 0; fail: - server_ftruncate_cbk (frame, NULL, frame->this, -1, EINVAL, NULL); + server_ftruncate_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL); return 0; } diff --git a/xlators/storage/bdb/src/bdb.c b/xlators/storage/bdb/src/bdb.c index bb6d3a434..daead5604 100644 --- a/xlators/storage/bdb/src/bdb.c +++ b/xlators/storage/bdb/src/bdb.c @@ -374,7 +374,8 @@ bdb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, - fd_t *fd) + fd_t *fd, + int32_t wbflags) { int32_t op_ret = -1; int32_t op_errno = EINVAL; diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c4f47049c..bdfeac1ee 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1822,7 +1822,7 @@ posix_create (call_frame_t *frame, xlator_t *this, int32_t posix_open (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, fd_t *fd) + loc_t *loc, int32_t flags, fd_t *fd, int wbflags) { int32_t op_ret = -1; int32_t op_errno = 0; |