diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-02-28 14:50:16 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-04-03 23:03:10 -0700 |
commit | dcf3ecd3c08b37226481b81fb0f8b3987cbcbab4 (patch) | |
tree | 396bf4a65eeef7671ff3f6254586b40c3b2c05a2 | |
parent | 5cdd09c3087e7f0581392dd06d4a1d587176abcb (diff) |
cluster/afr: Treat all dir fop failure as success in changelog
For example:
If a new entry creation fop fails with EEXIST or a delete entry fop
fails with ENOENT, on all the subvols the fop is wound, then no
change took place to the directory. So we can treat that case as no
change happened to the directory.
Change-Id: I3b3a7931954da2166a9cba19ff9f76f37739d751
BUG: 860210
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4626
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-write.c | 32 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.h | 3 |
3 files changed, 35 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index a988ea2a829..5a22696ce39 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -231,7 +231,27 @@ afr_dir_fop_mark_entry_pending_changelog (call_frame_t *frame, xlator_t *this) afr_mark_new_entry_changelog (frame, this); out: - local->transaction.resume (frame, this); + return; +} + +void +afr_dir_fop_handle_all_fop_failures (call_frame_t *frame) +{ + xlator_t *this = NULL; + afr_local_t *local = NULL; + afr_private_t *priv = NULL; + + this = frame->this; + local = frame->local; + priv = this->private; + + if (local->op_ret >= 0) + goto out; + + __mark_all_success (local->pending, priv->child_count, + local->transaction.type); +out: + return; } void @@ -253,6 +273,8 @@ afr_dir_fop_done (call_frame_t *frame, xlator_t *this) done: local->transaction.unwind (frame, this); afr_dir_fop_mark_entry_pending_changelog (frame, this); + afr_dir_fop_handle_all_fop_failures (frame); + local->transaction.resume (frame, this); } /* {{{ create */ @@ -870,6 +892,7 @@ afr_mkdir (call_frame_t *frame, xlator_t *this, if (params) local->xdata_req = dict_ref (params); + local->op = GF_FOP_MKDIR; local->transaction.fop = afr_mkdir_wind; local->transaction.done = afr_mkdir_done; local->transaction.unwind = afr_mkdir_unwind; @@ -1071,6 +1094,7 @@ afr_link (call_frame_t *frame, xlator_t *this, } UNLOCK (&priv->read_child_lock); + local->op = GF_FOP_LINK; local->transaction.fop = afr_link_wind; local->transaction.done = afr_link_done; local->transaction.unwind = afr_link_unwind; @@ -1275,6 +1299,7 @@ afr_symlink (call_frame_t *frame, xlator_t *this, if (params) local->xdata_req = dict_ref (params); + local->op = GF_FOP_SYMLINK; local->transaction.fop = afr_symlink_wind; local->transaction.done = afr_symlink_done; local->transaction.unwind = afr_symlink_unwind; @@ -1371,6 +1396,7 @@ afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (afr_fop_failed (op_ret, op_errno) && op_errno != ENOTEMPTY) afr_transaction_fop_failed (frame, this, child_index); local->op_errno = op_errno; + local->child_errno[child_index] = op_errno; if (op_ret > -1) __dir_entry_fop_common_cbk (frame, child_index, this, @@ -1479,6 +1505,7 @@ afr_rename (call_frame_t *frame, xlator_t *this, local->read_child_index = afr_inode_get_read_ctx (this, oldloc->inode, NULL); + local->op = GF_FOP_RENAME; local->transaction.fop = afr_rename_wind; local->transaction.done = afr_rename_done; local->transaction.unwind = afr_rename_unwind; @@ -1699,6 +1726,7 @@ afr_unlink (call_frame_t *frame, xlator_t *this, if (xdata) local->xdata_req = dict_ref (xdata); + local->op = GF_FOP_UNLINK; local->transaction.fop = afr_unlink_wind; local->transaction.done = afr_unlink_done; local->transaction.unwind = afr_unlink_unwind; @@ -1794,6 +1822,7 @@ afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (afr_fop_failed (op_ret, op_errno) && (op_errno != ENOTEMPTY)) afr_transaction_fop_failed (frame, this, child_index); local->op_errno = op_errno; + local->child_errno[child_index] = op_errno; if (op_ret > -1) __dir_entry_fop_common_cbk (frame, child_index, this, op_ret, op_errno, NULL, NULL, @@ -1899,6 +1928,7 @@ afr_rmdir (call_frame_t *frame, xlator_t *this, local->cont.rmdir.flags = flags; loc_copy (&local->loc, loc); + local->op = GF_FOP_RMDIR; local->transaction.fop = afr_rmdir_wind; local->transaction.done = afr_rmdir_done; local->transaction.unwind = afr_rmdir_unwind; diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 50c15c3463f..502e1ed496f 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -162,7 +162,7 @@ __mark_non_participant_children (int32_t *pending[], int child_count, } -static void +void __mark_all_success (int32_t *pending[], int child_count, afr_transaction_type type) { diff --git a/xlators/cluster/afr/src/afr-transaction.h b/xlators/cluster/afr/src/afr-transaction.h index e95bc5b1491..55e8bbcca08 100644 --- a/xlators/cluster/afr/src/afr-transaction.h +++ b/xlators/cluster/afr/src/afr-transaction.h @@ -37,4 +37,7 @@ afr_set_delayed_post_op (call_frame_t *frame, xlator_t *this); void afr_delayed_changelog_wake_up (xlator_t *this, fd_t *fd); +void +__mark_all_success (int32_t *pending[], int child_count, + afr_transaction_type type); #endif /* __TRANSACTION_H__ */ |