summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-data.h
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2016-04-28 08:42:40 +0200
committerJeff Darcy <jdarcy@redhat.com>2016-05-02 07:45:01 -0700
commit209985e861f4d8a22bfdb457c0e8d7045ab44553 (patch)
treeb230d7fcf9f9d3c313a7745642826882c6a9e22c /xlators/cluster/ec/src/ec-data.h
parent77def44d497d090ef3f393b6d9403c1a29dcf993 (diff)
cluster/ec: Fix issues with eager locking
Due to a race in timer cancellation, in some cases it was possible to unlock the lock while another concurrent fop that needed it continues execution as if it were not released. This patch also fixes an issue that caused a lock to not be released if an error was found while preparing ec_update_size_version(). Change-Id: I1344a3f5ecfc333f05a09e62653838264c9c26b1 BUG: 1331254 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/14112 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Chen Chen <chenchen@smartquerier.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/ec/src/ec-data.h')
-rw-r--r--xlators/cluster/ec/src/ec-data.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/xlators/cluster/ec/src/ec-data.h b/xlators/cluster/ec/src/ec-data.h
index 91f33c111ee..4a2a11f4ccd 100644
--- a/xlators/cluster/ec/src/ec-data.h
+++ b/xlators/cluster/ec/src/ec-data.h
@@ -140,17 +140,28 @@ struct _ec_lock
{
ec_inode_t *ctx;
gf_timer_t *timer;
- struct list_head owners; /* List of owners of this lock. */
- struct list_head waiting; /* Queue of requests being serviced. */
- struct list_head frozen; /* Queue of requests that will be serviced in
- the next unlock/lock cycle. */
+
+ /* List of owners of this lock. All fops added to this list are running
+ * concurrently. */
+ struct list_head owners;
+
+ /* List of fops waiting to be an owner of the lock. Fops are added to this
+ * list when the current owner has an incompatible access (shared vs
+ * exclusive) or the lock is not acquired yet. */
+ struct list_head waiting;
+
+ /* List of fops that will wait until the next unlock/lock cycle. This
+ * happens when the currently acquired lock is decided to be released as
+ * soon as possible. In this case, all frozen fops will be continued only
+ * after the lock is reacquired. */
+ struct list_head frozen;
+
int32_t exclusive;
uintptr_t mask;
uintptr_t good_mask;
uintptr_t healing;
- int32_t refs;
- int32_t refs_frozen;
- int32_t inserted;
+ uint32_t refs_owners; /* Refs for fops owning the lock */
+ uint32_t refs_pending; /* Refs assigned to fops being prepared */
gf_boolean_t acquired;
gf_boolean_t getting_size;
gf_boolean_t release;