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