From af226d250bcced782d19412bd7de1ca32834c8eb Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Wed, 5 Apr 2017 09:52:39 +0200 Subject: cluster/ec: fix incorrect answer check in seek fop A bad check in the answer of a seek request caused a segmentation fault when seek reported an error. Change-Id: Ifb25ae8bf7cc4019d46171c431f7b09b376960e8 BUG: 1439068 Signed-off-by: Xavier Hernandez Reviewed-on: https://review.gluster.org/16998 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Pranith Kumar Karampuri --- xlators/cluster/ec/src/ec-inode-read.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index 775b2baa043..ddae9bd99f1 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -1569,23 +1569,16 @@ int32_t ec_manager_seek(ec_fop_data_t *fop, int32_t state) return EC_STATE_PREPARE_ANSWER; case EC_STATE_PREPARE_ANSWER: - cbk = fop->answer; - if (cbk != NULL) { - if (ec_dispatch_one_retry(fop, &cbk)) { - return EC_STATE_DISPATCH; - } - if (cbk->op_ret >= 0) { - ec_t *ec = fop->xl->private; + if (ec_dispatch_one_retry(fop, &cbk)) { + return EC_STATE_DISPATCH; + } + if ((cbk != NULL) && (cbk->op_ret >= 0)) { + ec_t *ec = fop->xl->private; - cbk->offset *= ec->fragments; - if (cbk->offset < fop->user_size) { - cbk->offset = fop->user_size; - } - } else { - ec_fop_set_error(fop, cbk->op_errno); + cbk->offset *= ec->fragments; + if (cbk->offset < fop->user_size) { + cbk->offset = fop->user_size; } - } else { - ec_fop_set_error(fop, EIO); } return EC_STATE_REPORT; -- cgit