|
|
a3470f |
From 684f7a9f2f6d79ac45fdf2cf994c5fca139e51cd Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
a3470f |
Date: Wed, 31 Jan 2018 22:10:46 +0530
|
|
|
a3470f |
Subject: [PATCH 178/180] cluster/ec: Do lock conflict check correctly for
|
|
|
a3470f |
wait-list
|
|
|
a3470f |
|
|
|
a3470f |
Problem:
|
|
|
a3470f |
ec_link_has_lock_conflict() is traversing over only owner_list
|
|
|
a3470f |
but the function is also getting called with wait_list.
|
|
|
a3470f |
|
|
|
a3470f |
Fix:
|
|
|
a3470f |
Modify ec_link_has_lock_conflict() to traverse lists correctly.
|
|
|
a3470f |
Updated the callers to reflect the changes.
|
|
|
a3470f |
|
|
|
a3470f |
>BUG: 1540896
|
|
|
a3470f |
>Change-Id: Ibd7ea10f4498e7c2761f9a6faac6d5cb7d750c91
|
|
|
a3470f |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
a3470f |
|
|
|
a3470f |
Master Patch: https://review.gluster.org/19415
|
|
|
a3470f |
Release-3.13 Patch: https://review.gluster.org/19428
|
|
|
a3470f |
|
|
|
a3470f |
BUG: 1540908
|
|
|
a3470f |
Change-Id: I859aab86d591c22d635bf7a2ef17b77b605d32d8
|
|
|
a3470f |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/129249
|
|
|
a3470f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
a3470f |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
a3470f |
---
|
|
|
a3470f |
xlators/cluster/ec/src/ec-common.c | 23 +++++++++++++++--------
|
|
|
a3470f |
1 file changed, 15 insertions(+), 8 deletions(-)
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
|
|
|
a3470f |
index 051fff6..bd2ae50 100644
|
|
|
a3470f |
--- a/xlators/cluster/ec/src/ec-common.c
|
|
|
a3470f |
+++ b/xlators/cluster/ec/src/ec-common.c
|
|
|
a3470f |
@@ -1643,18 +1643,27 @@ ec_lock_update_fd(ec_lock_t *lock, ec_fop_data_t *fop)
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
static gf_boolean_t
|
|
|
a3470f |
-ec_link_has_lock_conflict (ec_lock_link_t *link, struct list_head *owners)
|
|
|
a3470f |
+ec_link_has_lock_conflict (ec_lock_link_t *link, gf_boolean_t waitlist_check)
|
|
|
a3470f |
{
|
|
|
a3470f |
- ec_lock_link_t *owner_link = NULL;
|
|
|
a3470f |
+ ec_lock_link_t *trav_link = NULL;
|
|
|
a3470f |
ec_t *ec = link->fop->xl->private;
|
|
|
a3470f |
|
|
|
a3470f |
if (!ec->parallel_writes)
|
|
|
a3470f |
return _gf_true;
|
|
|
a3470f |
|
|
|
a3470f |
- list_for_each_entry (owner_link, owners, owner_list) {
|
|
|
a3470f |
- if (ec_lock_conflict (owner_link, link))
|
|
|
a3470f |
+ list_for_each_entry (trav_link, &link->lock->owners, owner_list) {
|
|
|
a3470f |
+ if (ec_lock_conflict (trav_link, link))
|
|
|
a3470f |
return _gf_true;
|
|
|
a3470f |
}
|
|
|
a3470f |
+
|
|
|
a3470f |
+ if (!waitlist_check)
|
|
|
a3470f |
+ return _gf_false;
|
|
|
a3470f |
+
|
|
|
a3470f |
+ list_for_each_entry (trav_link, &link->lock->waiting, wait_list) {
|
|
|
a3470f |
+ if (ec_lock_conflict (trav_link, link))
|
|
|
a3470f |
+ return _gf_true;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+
|
|
|
a3470f |
return _gf_false;
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
@@ -1676,7 +1685,7 @@ ec_lock_wake_shared(ec_lock_t *lock, struct list_head *list)
|
|
|
a3470f |
|
|
|
a3470f |
/* If the fop is not shareable, only this fop can be assigned as owner.
|
|
|
a3470f |
* Other fops will need to wait until this one finishes. */
|
|
|
a3470f |
- if (ec_link_has_lock_conflict (link, &lock->owners)) {
|
|
|
a3470f |
+ if (ec_link_has_lock_conflict (link, _gf_false)) {
|
|
|
a3470f |
conflict = _gf_true;
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
@@ -1923,9 +1932,7 @@ ec_lock_assign_owner(ec_lock_link_t *link)
|
|
|
a3470f |
* owners, or waiters(to prevent starvation).
|
|
|
a3470f |
* Otherwise we need to wait.
|
|
|
a3470f |
*/
|
|
|
a3470f |
- if (!lock->acquired ||
|
|
|
a3470f |
- ec_link_has_lock_conflict (link, &lock->owners) ||
|
|
|
a3470f |
- ec_link_has_lock_conflict (link, &lock->waiting)) {
|
|
|
a3470f |
+ if (!lock->acquired || ec_link_has_lock_conflict (link, _gf_true)) {
|
|
|
a3470f |
ec_trace("LOCK_QUEUE_WAIT", fop, "lock=%p", lock);
|
|
|
a3470f |
|
|
|
a3470f |
list_add_tail(&link->wait_list, &lock->waiting);
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|