diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2017-04-05 09:52:39 +0200 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-05-09 09:51:19 +0000 |
commit | af226d250bcced782d19412bd7de1ca32834c8eb (patch) | |
tree | 5cea75627d8f25b1dae259e6c7372f1703629c6c | |
parent | 4f4ad03e0c4739d3fe1b0640ab8b4e1ffc985374 (diff) |
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 <xhernandez@datalab.es>
Reviewed-on: https://review.gluster.org/16998
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: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 23 |
1 files changed, 8 insertions, 15 deletions
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; |