diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2016-11-24 18:36:28 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-11-25 01:45:20 -0800 |
commit | af3672ce94fa83c73fa8e8ba9fd7b8473d3da9ee (patch) | |
tree | b8dd73319a53927f85ae46dc9bbf520cc8cbe747 /xlators/cluster | |
parent | 41ee2fbad54c89add98c4c0423211f246409708a (diff) |
cluster/afr: Handle rpc errors, xdr failures etc with proper NULL checks
Backport of: http://review.gluster.org/15924
Change-Id: Ie2a181e113ba24abca8cd4fd6bb722d048f014a8
BUG: 1398499
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/15925
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>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 23 |
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 12d3d9f439d..2cbe66110a5 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -1251,12 +1251,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); |