From 503acdb32ca84102d07cd1142eff464152b06690 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 13 May 2015 16:57:49 +0530 Subject: cluster/ec: Prevent unnecessary self-heals When a blocking lock is requested, lock request is succeeded even when ec->fragment number of locks are acquired successfully in non-blocking locking phase. This will lead to fop succeeding only on the bricks where the locks are acquired, leading to the necessity of self-heals. To prevent these un-necessary self-heals, if the remaining locks fail with EAGAIN in non-blocking lock phase try blocking locking phase instead. Change-Id: I940969e39acc620ccde2a876546cea77f7e130b6 BUG: 1221145 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/10770 Tested-by: Gluster Build System Reviewed-by: Xavier Hernandez --- xlators/cluster/ec/src/ec-locks.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xlators/cluster/ec/src/ec-locks.c b/xlators/cluster/ec/src/ec-locks.c index 10572037932..22b6fa4d6e5 100644 --- a/xlators/cluster/ec/src/ec-locks.c +++ b/xlators/cluster/ec/src/ec-locks.c @@ -37,13 +37,22 @@ int32_t ec_lock_check(ec_fop_data_t *fop, uintptr_t *mask) locked |= ans->mask; cbk = ans; } else { - notlocked |= ans->mask; + if (ans->op_errno == EAGAIN) { + switch (fop->uint32) { + case EC_LOCK_MODE_NONE: + case EC_LOCK_MODE_ALL: + /* Goal is to treat non-blocking lock as failure + * even if there is a signle EAGAIN*/ + notlocked |= ans->mask; + break; + } + } } } if (error == -1) { if (ec_bits_count(locked | notlocked) >= ec->fragments) { - if (ec_bits_count (locked) >= ec->fragments) { + if (notlocked == 0) { if (fop->answer == NULL) { fop->answer = cbk; } -- cgit