summaryrefslogtreecommitdiffstats
path: root/xlators/features/qemu-block/src/coroutine-synctask.h
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2013-10-18 07:36:38 -0400
committerAnand Avati <avati@redhat.com>2013-11-10 23:45:46 -0800
commitb06ecde2997b72a41b2f2d25d55e61d30ea46bc2 (patch)
treeff630d050b46310141d0ca11ee56b04736d06cea /xlators/features/qemu-block/src/coroutine-synctask.h
parent0826f9073a93c6d499f3d2077695455854d0fa7f (diff)
features/qemu-block: simplify coroutine model to use single synctask, ucontext
The current coroutine model, mapping synctasks 1-1 with qemu internal Coroutines, has some unresolved raciness issues. This problem usually manifests as lifecycle mismatches between top-level (gluster created) synctasks and the subsequently created internal coroutines from that context. Qemu's internal queueing (and locking) can cause situations where the top-level synctask is destroyed before the internal scheduler has released references to memory, leading to use after free crashes and asserts. Simplify the coroutine model to use a single synctask as a coroutine processor and rely on the existing native ucontext coroutine implementation. The syncenv thread is donated to qemu and ensures a single top-level coroutine is processed at a time. Qemu now has complete control over coroutine scheduling. BUG: 986775 Change-Id: I38223479a608d80353128e390f243933fc946fd6 Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-on: http://review.gluster.org/6110 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/qemu-block/src/coroutine-synctask.h')
-rw-r--r--xlators/features/qemu-block/src/coroutine-synctask.h51
1 files changed, 0 insertions, 51 deletions
diff --git a/xlators/features/qemu-block/src/coroutine-synctask.h b/xlators/features/qemu-block/src/coroutine-synctask.h
deleted file mode 100644
index 0f0aa99cc..000000000
--- a/xlators/features/qemu-block/src/coroutine-synctask.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Copyright (c) 2013 Red Hat, Inc. <http://www.redhat.com>
- This file is part of GlusterFS.
-
- This file is licensed to you under your choice of the GNU Lesser
- General Public License, version 3 or any later version (LGPLv3 or
- later), or the GNU General Public License, version 2 (GPLv2), in all
- cases as published by the Free Software Foundation.
-*/
-
-#ifndef __COROUTINE_SYNCTASK_H
-#define __COROUTINE_SYNCTASK_H
-
-#include "syncop.h"
-#include "block/coroutine_int.h"
-#include "qemu-common.h"
-#include "block/coroutine_int.h"
-
-/*
- Three entities:
-
- synctask - glusterfs implementation of xlator friendly lightweight threads
- Coroutine - qemu coroutine API for its block drivers
- CoroutineSynctask - implementation of Coroutine using synctasks
-
- Coroutine is an "embedded" structure inside CoroutineSynctask, called "base".
-
- E.g:
-
- Coroutine *co;
- CoroutineSynctask *cs;
- struct synctask *synctask;
-
- cs == synctask->opaque;
- co == &(cs->base);
- cs = DO_UPCAST(CoroutineSynctask, base, co);
- synctask == cs->synctask;
-
-*/
-
-typedef struct {
- Coroutine base;
- struct synctask *synctask;
- CoroutineAction action;
- bool run;
- bool die;
-} CoroutineSynctask;
-
-
-
-#endif /* !__COROUTINE_SYNCTASK_H */