mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Condition variable reference counts
Reference count every entry and exit from the condition variable functions: cv_wait(), cv_wait_timeout(), cv_signal(), cv_broadcast(). This allows us to safely block in cv_destroy() until all consumers have been scheduled and are no longer accessing the condition variable memory. In addition poison the magic value at the start of cv_destroy() to ensure there are never any new callers after cv_destroy() is called. The consumer is responsible for ensuring this never occurs. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
@@ -35,12 +35,13 @@
|
||||
* calling any of the wait/signal funs, and passed into the wait funs.
|
||||
*/
|
||||
#define CV_MAGIC 0x346545f4
|
||||
#define CV_POISON 0x95
|
||||
#define CV_DESTROY 0x346545f5
|
||||
|
||||
typedef struct {
|
||||
int cv_magic;
|
||||
wait_queue_head_t cv_event;
|
||||
wait_queue_head_t cv_destroy;
|
||||
atomic_t cv_refs;
|
||||
atomic_t cv_waiters;
|
||||
kmutex_t *cv_mutex;
|
||||
} kcondvar_t;
|
||||
|
||||
Reference in New Issue
Block a user