|
|
3604df |
From c424d672103287c016f76b3129e46ad9ea085f61 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
3604df |
Date: Wed, 24 Aug 2016 21:01:05 +0530
|
|
|
3604df |
Subject: [PATCH 100/141] cluster/ec: Use locks for opendir
|
|
|
3604df |
|
|
|
3604df |
Problem:
|
|
|
3604df |
In some cases we see that readdir keeps winding to the brick that doesn't have
|
|
|
3604df |
any blocked locks i.e. first brick. This is leading to the client assuming that
|
|
|
3604df |
there are no blocking locks on the inode so it won't give away the lock. Other
|
|
|
3604df |
clients end up blocked on the lock as if the command hung.
|
|
|
3604df |
|
|
|
3604df |
Fix:
|
|
|
3604df |
Proper way to fix this issue is to use infra present in
|
|
|
3604df |
http://review.gluster.org/14736 This is a stop gap fix where we start taking
|
|
|
3604df |
inodelks in opendir which goes to all the bricks, this will detect if there is
|
|
|
3604df |
any contention.
|
|
|
3604df |
|
|
|
3604df |
cherry picked from commit f013335400d033a9677797377b90b968803135f4:
|
|
|
3604df |
>BUG: 1346719
|
|
|
3604df |
>Change-Id: I91109107a26f6535b945ac476338e9f21dc31eb9
|
|
|
3604df |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15309
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
3604df |
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I91109107a26f6535b945ac476338e9f21dc31eb9
|
|
|
3604df |
BUG: 1361519
|
|
|
3604df |
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87175
|
|
|
3604df |
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
3604df |
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
xlators/cluster/ec/src/ec-dir-read.c | 22 +++++++++++++++++++++-
|
|
|
3604df |
1 files changed, 21 insertions(+), 1 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/cluster/ec/src/ec-dir-read.c b/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
3604df |
index fc8b38b..ed53a04 100644
|
|
|
3604df |
--- a/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
3604df |
+++ b/xlators/cluster/ec/src/ec-dir-read.c
|
|
|
3604df |
@@ -138,6 +138,13 @@ int32_t ec_manager_opendir(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
UNLOCK(&fop->fd->lock);
|
|
|
3604df |
|
|
|
3604df |
/* Fall through */
|
|
|
3604df |
+
|
|
|
3604df |
+ case EC_STATE_LOCK:
|
|
|
3604df |
+ ec_lock_prepare_inode(fop, &fop->loc[0], EC_QUERY_INFO);
|
|
|
3604df |
+ ec_lock(fop);
|
|
|
3604df |
+
|
|
|
3604df |
+ return EC_STATE_DISPATCH;
|
|
|
3604df |
+
|
|
|
3604df |
case EC_STATE_DISPATCH:
|
|
|
3604df |
ec_dispatch_all(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -173,9 +180,10 @@ int32_t ec_manager_opendir(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
cbk->op_errno, cbk->fd, cbk->xdata);
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
- return EC_STATE_END;
|
|
|
3604df |
+ return EC_STATE_LOCK_REUSE;
|
|
|
3604df |
|
|
|
3604df |
case -EC_STATE_INIT:
|
|
|
3604df |
+ case -EC_STATE_LOCK:
|
|
|
3604df |
case -EC_STATE_DISPATCH:
|
|
|
3604df |
case -EC_STATE_PREPARE_ANSWER:
|
|
|
3604df |
case -EC_STATE_REPORT:
|
|
|
3604df |
@@ -187,6 +195,18 @@ int32_t ec_manager_opendir(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
NULL, NULL);
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ return EC_STATE_LOCK_REUSE;
|
|
|
3604df |
+
|
|
|
3604df |
+ case -EC_STATE_LOCK_REUSE:
|
|
|
3604df |
+ case EC_STATE_LOCK_REUSE:
|
|
|
3604df |
+ ec_lock_reuse(fop);
|
|
|
3604df |
+
|
|
|
3604df |
+ return EC_STATE_UNLOCK;
|
|
|
3604df |
+
|
|
|
3604df |
+ case -EC_STATE_UNLOCK:
|
|
|
3604df |
+ case EC_STATE_UNLOCK:
|
|
|
3604df |
+ ec_unlock(fop);
|
|
|
3604df |
+
|
|
|
3604df |
return EC_STATE_END;
|
|
|
3604df |
|
|
|
3604df |
default:
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|