|
|
21ab4e |
From 2ab72d3db1ab8c916bbc33c5833c161ce98eff63 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
21ab4e |
Date: Tue, 13 Jun 2017 23:35:40 +0530
|
|
|
21ab4e |
Subject: [PATCH 514/525] cluster/ec: lk shouldn't be a transaction
|
|
|
21ab4e |
|
|
|
21ab4e |
Problem:
|
|
|
21ab4e |
When application sends a blocking lock, the lk fop actually waits under
|
|
|
21ab4e |
inodelk. This can lead to a dead-lock.
|
|
|
21ab4e |
1) Let's say app-1 takes exculsive-fcntl-lock on the file
|
|
|
21ab4e |
2) app-2 attempts an exclusive-fcntl-lock on the file which goes to blocking
|
|
|
21ab4e |
stage note: app-2 is blocked inside transaction which holds an inode-lock
|
|
|
21ab4e |
3) app-1 tries to perform write which needs inode-lock so it gets blocked on
|
|
|
21ab4e |
app-2 to unlock inodelk and app-2 is blocked on app-1 to unlock fcntl-lock
|
|
|
21ab4e |
|
|
|
21ab4e |
Fix:
|
|
|
21ab4e |
Correct way to fix this issue and make fcntl locks perform well would be to
|
|
|
21ab4e |
introduce
|
|
|
21ab4e |
2-phase locking for fcntl lock:
|
|
|
21ab4e |
1) Implement a try-lock phase where locks xlator will not merge lk call with
|
|
|
21ab4e |
existing calls until a commit-lock phase.
|
|
|
21ab4e |
2) If in try-lock phase we get quorum number of success without any EAGAIN
|
|
|
21ab4e |
error, then send a commit-lock which will merge locks.
|
|
|
21ab4e |
3) In case there are any errors, unlock should just delete the lock-object
|
|
|
21ab4e |
which was tried earlier and shouldn't touch the committed locks.
|
|
|
21ab4e |
|
|
|
21ab4e |
Unfortunately this is a sizeable feature and need to be thought through for any
|
|
|
21ab4e |
corner cases. Until then remove transaction from lk call.
|
|
|
21ab4e |
|
|
|
21ab4e |
>BUG: 1455049
|
|
|
21ab4e |
>Change-Id: I18a782903ba0eb43f1e6526fb0cf8c626c460159
|
|
|
21ab4e |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/17542
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Reviewed-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
21ab4e |
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
|
|
|
21ab4e |
|
|
|
21ab4e |
BUG: 1444515
|
|
|
21ab4e |
Change-Id: I723e675119a08ec2a9c9073eb5eac73dc455af0d
|
|
|
21ab4e |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/109275
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/cluster/ec/src/ec-locks.c | 20 +-------------------
|
|
|
21ab4e |
1 file changed, 1 insertion(+), 19 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/cluster/ec/src/ec-locks.c b/xlators/cluster/ec/src/ec-locks.c
|
|
|
21ab4e |
index 70b07c3..ff09852 100644
|
|
|
21ab4e |
--- a/xlators/cluster/ec/src/ec-locks.c
|
|
|
21ab4e |
+++ b/xlators/cluster/ec/src/ec-locks.c
|
|
|
21ab4e |
@@ -1020,12 +1020,6 @@ int32_t ec_manager_lk(ec_fop_data_t * fop, int32_t state)
|
|
|
21ab4e |
|
|
|
21ab4e |
/* Fall through */
|
|
|
21ab4e |
|
|
|
21ab4e |
- case EC_STATE_LOCK:
|
|
|
21ab4e |
- ec_lock_prepare_fd(fop, fop->fd, EC_UPDATE_DATA | EC_QUERY_INFO);
|
|
|
21ab4e |
- ec_lock(fop);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- return EC_STATE_DISPATCH;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
case EC_STATE_DISPATCH:
|
|
|
21ab4e |
ec_dispatch_all(fop);
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -1080,10 +1074,9 @@ int32_t ec_manager_lk(ec_fop_data_t * fop, int32_t state)
|
|
|
21ab4e |
cbk->op_errno, &cbk->flock, cbk->xdata);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- return EC_STATE_LOCK_REUSE;
|
|
|
21ab4e |
+ return EC_STATE_END;
|
|
|
21ab4e |
|
|
|
21ab4e |
case -EC_STATE_INIT:
|
|
|
21ab4e |
- case -EC_STATE_LOCK:
|
|
|
21ab4e |
case -EC_STATE_DISPATCH:
|
|
|
21ab4e |
case -EC_STATE_REPORT:
|
|
|
21ab4e |
GF_ASSERT(fop->error != 0);
|
|
|
21ab4e |
@@ -1094,17 +1087,6 @@ int32_t ec_manager_lk(ec_fop_data_t * fop, int32_t state)
|
|
|
21ab4e |
NULL, NULL);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- return EC_STATE_LOCK_REUSE;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- case -EC_STATE_LOCK_REUSE:
|
|
|
21ab4e |
- case EC_STATE_LOCK_REUSE:
|
|
|
21ab4e |
- ec_lock_reuse(fop);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- return EC_STATE_UNLOCK;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- case -EC_STATE_UNLOCK:
|
|
|
21ab4e |
- case EC_STATE_UNLOCK:
|
|
|
21ab4e |
- ec_unlock(fop);
|
|
|
21ab4e |
|
|
|
21ab4e |
return EC_STATE_END;
|
|
|
21ab4e |
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|