From 1cd0e86cea9a6d3e52340cfa33622bfb4b9ce4d6 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 31 May 2016 14:49:33 +0530 Subject: cluster/afr: Unwind with xdata in inode-write fops When there is a failure afr was not unwinding xdata to xlators above. xdata need not be NULL on failures. So it is important to send it to parent xlators. >Change-Id: Ic36aac10a79fa91121961932dd1920cb1c2c3a4c >BUG: 1340623 >Signed-off-by: Pranith Kumar K >Reviewed-on: http://review.gluster.org/14567 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Jeff Darcy BUG: 1342178 Change-Id: Idd74d2bc898fe5aef537ab48c1754510030c8825 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/14618 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- xlators/cluster/afr/src/afr-common.c | 2 +- xlators/cluster/afr/src/afr-inode-write.c | 13 +++++++------ xlators/cluster/afr/src/afr-transaction.c | 3 ++- xlators/cluster/afr/src/afr.h | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index c20c53218f9..e59f160db0c 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1640,7 +1640,7 @@ afr_read_subvol_decide (inode_t *inode, xlator_t *this, data_subvol = afr_data_subvol_get (inode, this, NULL, NULL, NULL, args); mdata_subvol = afr_metadata_subvol_get (inode, this, - 0, 0, args); + NULL, NULL, NULL, args); if (data_subvol == -1 || mdata_subvol == -1) return -1; diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index 47320ce9412..76526bcf177 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -79,16 +79,17 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this) if (local->inode) { if (local->transaction.type == AFR_METADATA_TRANSACTION) - read_subvol = afr_metadata_subvol_get (local->inode, this, - NULL, NULL, - &args); + read_subvol = afr_metadata_subvol_get (local->inode, + this, NULL, local->readable, NULL, &args); else read_subvol = afr_data_subvol_get (local->inode, this, - NULL, NULL, NULL, &args); + NULL, local->readable, NULL, &args); } local->op_ret = -1; local->op_errno = afr_final_errno (local, priv); + afr_pick_error_xdata (local, priv, local->inode, local->readable, NULL, + NULL); for (i = 0; i < priv->child_count; i++) { if (!local->replies[i].valid) @@ -156,6 +157,8 @@ __afr_inode_write_fill (call_frame_t *frame, xlator_t *this, int child_index, local->replies[child_index].op_ret = op_ret; local->replies[child_index].op_errno = op_errno; + if (xdata) + local->replies[child_index].xdata = dict_ref (xdata); if (op_ret >= 0) { if (prebuf) @@ -164,8 +167,6 @@ __afr_inode_write_fill (call_frame_t *frame, xlator_t *this, int child_index, local->replies[child_index].poststat = *postbuf; if (xattr) local->replies[child_index].xattr = dict_ref (xattr); - if (xdata) - local->replies[child_index].xdata = dict_ref (xdata); } else { afr_transaction_fop_failed (frame, this, child_index); } diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index b5e50c454c2..24af6290098 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -811,7 +811,8 @@ afr_handle_quorum (call_frame_t *frame) local->readable2); break; default: - /*TBD*/ + afr_pick_error_xdata (local, priv, local->inode, + local->readable, NULL, NULL); break; } } diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index c6afbbe20e0..31d761f638d 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -868,8 +868,8 @@ afr_read_subvol_get (inode_t *inode, xlator_t *this, int *subvol_p, #define afr_data_subvol_get(i, t, s, r, e, a) \ afr_read_subvol_get(i, t, s, r, e, AFR_DATA_TRANSACTION, a) -#define afr_metadata_subvol_get(i, t, s, e, a) \ - afr_read_subvol_get(i, t, s, NULL, e, AFR_METADATA_TRANSACTION, a) +#define afr_metadata_subvol_get(i, t, s, r, e, a) \ + afr_read_subvol_get(i, t, s, r, e, AFR_METADATA_TRANSACTION, a) int afr_inode_refresh (call_frame_t *frame, xlator_t *this, inode_t *inode, -- cgit