From d25237709278f9530c7a3989a37254c628539375 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 11 Jun 2016 18:43:42 +0530 Subject: cluster/ec: Unlock stale locks when inodelk/entrylk/lk fails Thanks to Rafi for hinting a while back that this kind of problem he saw once. I didn't think the theory was valid. Could have caught it earlier if I had tested his theory. Change-Id: Iac6ffcdba2950aa6f8cf94f8994adeed6e6a9c9b BUG: 1344836 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/14703 Reviewed-by: Xavier Hernandez Smoke: Gluster Build System Tested-by: mohammed rafi kc NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/cluster/ec/src/ec-locks.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/ec/src/ec-locks.c b/xlators/cluster/ec/src/ec-locks.c index 7902a99ba84..0253b51bf5e 100644 --- a/xlators/cluster/ec/src/ec-locks.c +++ b/xlators/cluster/ec/src/ec-locks.c @@ -197,10 +197,11 @@ int32_t ec_manager_entrylk(ec_fop_data_t * fop, int32_t state) return EC_STATE_PREPARE_ANSWER; case EC_STATE_PREPARE_ANSWER: + case -EC_STATE_PREPARE_ANSWER: if (fop->entrylk_cmd != ENTRYLK_UNLOCK) { uintptr_t mask; - fop->error = ec_lock_check(fop, &mask); + ec_fop_set_error (fop, ec_lock_check(fop, &mask)); if (fop->error != 0) { if (mask != 0) { if (fop->id == GF_FOP_ENTRYLK) { @@ -258,7 +259,6 @@ int32_t ec_manager_entrylk(ec_fop_data_t * fop, int32_t state) case -EC_STATE_INIT: case -EC_STATE_DISPATCH: - case -EC_STATE_PREPARE_ANSWER: case -EC_STATE_REPORT: GF_ASSERT(fop->error != 0); @@ -590,10 +590,11 @@ int32_t ec_manager_inodelk(ec_fop_data_t * fop, int32_t state) return EC_STATE_PREPARE_ANSWER; case EC_STATE_PREPARE_ANSWER: + case -EC_STATE_PREPARE_ANSWER: if (fop->flock.l_type != F_UNLCK) { uintptr_t mask; - fop->error = ec_lock_check(fop, &mask); + ec_fop_set_error (fop, ec_lock_check(fop, &mask)); if (fop->error != 0) { if (mask != 0) { ec_t *ec = fop->xl->private; @@ -659,7 +660,6 @@ int32_t ec_manager_inodelk(ec_fop_data_t * fop, int32_t state) case -EC_STATE_INIT: case -EC_STATE_DISPATCH: - case -EC_STATE_PREPARE_ANSWER: case -EC_STATE_REPORT: GF_ASSERT(fop->error != 0); @@ -1026,10 +1026,11 @@ int32_t ec_manager_lk(ec_fop_data_t * fop, int32_t state) return EC_STATE_PREPARE_ANSWER; case EC_STATE_PREPARE_ANSWER: + case -EC_STATE_PREPARE_ANSWER: if (fop->flock.l_type != F_UNLCK) { uintptr_t mask; - fop->error = ec_lock_check(fop, &mask); + ec_fop_set_error (fop, ec_lock_check(fop, &mask)); if (fop->error != 0) { if (mask != 0) { ec_t *ec = fop->xl->private; @@ -1077,7 +1078,6 @@ int32_t ec_manager_lk(ec_fop_data_t * fop, int32_t state) case -EC_STATE_INIT: case -EC_STATE_DISPATCH: - case -EC_STATE_PREPARE_ANSWER: case -EC_STATE_REPORT: GF_ASSERT(fop->error != 0); -- cgit