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/cluster | |
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/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-write.c | 33 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-read.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.c | 21 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-algorithm.c | 6 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 9 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 10 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-entry.c | 24 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 3 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 19 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 184 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-linkfile.c | 14 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 14 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 3 | ||||
-rw-r--r-- | xlators/cluster/dht/src/nufa.c | 12 | ||||
-rw-r--r-- | xlators/cluster/ha/src/ha.c | 80 | ||||
-rw-r--r-- | xlators/cluster/map/src/map.c | 72 | ||||
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 310 | ||||
-rw-r--r-- | xlators/cluster/unify/src/unify.c | 197 |
18 files changed, 809 insertions, 204 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 51629234f88..5cd05b13864 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 2032065119a..8c0431f5a51 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 591f7cd49aa..601913a0fca 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 46d451913b0..5197f6be43f 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 4a260ed903e..ef25204a11a 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 576a15e06f2..5300f0a7528 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 b3bb6720917..fa938415864 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 686446b5f30..9a02ab6ddb3 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 ef93e5078a2..b65a4dc466d 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 d5d6f4c3e2f..49af12101b7 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 213d3f2bf72..d28f7beca09 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 6c34dabad1e..f91d1983d69 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 df8b2047b2b..d3b36363ee3 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 6be7206bfb5..17516a122c3 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 b380cb1e9a7..b2ca48b1089 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 3eb49e2eddc..91cf8eb24a1 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 5a02d17bc2e..2d875ab3e2f 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 b641fb3307e..80ba10278c1 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; |