From 1a7d49cfecd75b97641ab9261ee3c930bd51e895 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 6 Jul 2015 14:23:56 +0530 Subject: cluster/ec: Don't read from bad subvols >Change-Id: Ic22813371faca4e8198c9b0b20518e68d275f3c1 >BUG: 1232678 >Signed-off-by: Pranith Kumar K >Reviewed-on: http://review.gluster.org/11531 >Reviewed-by: Xavier Hernandez >Tested-by: NetBSD Build System >Tested-by: Gluster Build System BUG: 1243647 Change-Id: Ic8570710a16715322bc0be59367007567f6438cd Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/11682 Tested-by: Gluster Build System Reviewed-by: Xavier Hernandez --- xlators/cluster/ec/src/ec-common.c | 41 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'xlators/cluster/ec/src/ec-common.c') diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 455df99c80c..200aedaa5b1 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -382,6 +382,24 @@ void ec_complete(ec_fop_data_t * fop) ec_fop_data_release(fop); } +/* There could be already granted locks sitting on the bricks, unlock for which + * must be wound at all costs*/ +static gf_boolean_t +ec_must_wind (ec_fop_data_t *fop) +{ + if ((fop->id == GF_FOP_INODELK) || (fop->id == GF_FOP_FINODELK) || + (fop->id == GF_FOP_LK)) { + if (fop->flock.l_type == F_UNLCK) + return _gf_true; + } else if ((fop->id == GF_FOP_ENTRYLK) || + (fop->id == GF_FOP_FENTRYLK)) { + if (fop->entrylk_cmd == ENTRYLK_UNLOCK) + return _gf_true; + } + + return _gf_false; +} + int32_t ec_child_select(ec_fop_data_t * fop) { ec_t * ec = fop->xl->private; @@ -391,6 +409,11 @@ int32_t ec_child_select(ec_fop_data_t * fop) ec_fop_cleanup(fop); fop->mask &= ec->node_mask; + /* Wind the fop on same subvols as parent for any internal extra fops like + * head/tail read in case of writev fop. Unlocks shouldn't do this because + * unlock should go on all subvols where lock is performed*/ + if (fop->parent && !ec_must_wind (fop)) + fop->mask &= fop->parent->mask; mask = ec->xl_up; if (fop->parent == NULL) @@ -1868,24 +1891,6 @@ void ec_lock_reuse(ec_fop_data_t *fop) } } -/* There could be already granted locks sitting on the bricks, unlock for which - * must be wound at all costs*/ -static gf_boolean_t -ec_must_wind (ec_fop_data_t *fop) -{ - if ((fop->id == GF_FOP_INODELK) || (fop->id == GF_FOP_FINODELK) || - (fop->id == GF_FOP_LK)) { - if (fop->flock.l_type == F_UNLCK) - return _gf_true; - } else if ((fop->id == GF_FOP_ENTRYLK) || - (fop->id == GF_FOP_FENTRYLK)) { - if (fop->entrylk_cmd == ENTRYLK_UNLOCK) - return _gf_true; - } - - return _gf_false; -} - void __ec_manager(ec_fop_data_t * fop, int32_t error) { ec_t *ec = fop->xl->private; -- cgit