diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2015-05-13 16:57:49 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-05-15 01:24:51 -0700 |
commit | 503acdb32ca84102d07cd1142eff464152b06690 (patch) | |
tree | 8f4165f54a99a88a90998c5f6f843c0af269d644 /xlators/cluster/ec/src | |
parent | 1cabc769c7b636f89f6f28aaa0d534401a82d4a8 (diff) |
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 <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/10770
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Diffstat (limited to 'xlators/cluster/ec/src')
-rw-r--r-- | xlators/cluster/ec/src/ec-locks.c | 13 |
1 files 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; } |