summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-11-24 18:36:28 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-11-24 19:03:20 -0800
commit3a5169907b44d79e207c35941b1973b1f60d2079 (patch)
tree45903db7e4b8bbe5c85f1f0b226a57d75d782b2b /xlators/cluster
parente966fcbc2808eb474ccf83290fe488eb2f10c9d1 (diff)
cluster/afr: Handle rpc errors, xdr failures etc with proper NULL checks
Change-Id: Id8ba76ba116d056bc7299dc5ce0980680a5a23f8 BUG: 1398226 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/15924 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index 88ff206a38c..a456c827f4b 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1249,12 +1249,23 @@ afr_pre_op_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->op_errno = op_errno;
afr_transaction_fop_failed (frame, this, child_index);
}
- write_args_cbk = &args_cbk->rsp_list[1];
- afr_inode_write_fill (frame, this, (long) i, write_args_cbk->op_ret,
- write_args_cbk->op_errno,
- &write_args_cbk->prestat,
- &write_args_cbk->poststat,
- write_args_cbk->xdata);
+
+ /* If the compound fop failed due to saved_frame_unwind(), then
+ * protocol/client fails it even before args_cbk is allocated.
+ * Handle that case by passing the op_ret, op_errno values explicitly.
+ */
+ if ((op_ret == -1) && (args_cbk == NULL)) {
+ afr_inode_write_fill (frame, this, (long) i, op_ret, op_errno,
+ NULL, NULL, NULL);
+ } else {
+ write_args_cbk = &args_cbk->rsp_list[1];
+ afr_inode_write_fill (frame, this, (long) i,
+ write_args_cbk->op_ret,
+ write_args_cbk->op_errno,
+ &write_args_cbk->prestat,
+ &write_args_cbk->poststat,
+ write_args_cbk->xdata);
+ }
call_count = afr_frame_return (frame);